From afb7e907450dc8e1aabe7fcfe4646d93c07613b4 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Sun, 7 Jun 2026 10:52:00 +0200 Subject: [PATCH 01/22] Set up to compile with old O2 --- Common/Tools/EventSelectionModule.h | 3 +- PWGDQ/Tasks/CMakeLists.txt | 5 + PWGDQ/Tasks/tableReader_withAssoc.cxx | 3 +- PWGDQ/Tasks/taskJPsiMu.cxx | 154 ++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 PWGDQ/Tasks/taskJPsiMu.cxx diff --git a/Common/Tools/EventSelectionModule.h b/Common/Tools/EventSelectionModule.h index eb4108bf6e6..8cd0ad0d5da 100644 --- a/Common/Tools/EventSelectionModule.h +++ b/Common/Tools/EventSelectionModule.h @@ -27,7 +27,8 @@ #include #include #include -#include +// #include +#include #include #include #include diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index 4bb0cf6d714..535232298e3 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -163,3 +163,8 @@ o2physics_add_dpl_workflow(muon-global-alignment SOURCES muonGlobalAlignment.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2::MCHGeometryTransformer COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jpsi-muon-correlations + SOURCES taskJPsiMu.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore O2::MCHGeometryTransformer + COMPONENT_NAME Analysis) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 38e6a67c83a..89ffc55d72a 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -30,7 +30,8 @@ #include #include #include -#include +// #include +#include #include #include #include diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx new file mode 100644 index 00000000000..180c311e0de --- /dev/null +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -0,0 +1,154 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +/// @author Kaare Endrup Iversen +// Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no +// +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include + +using std::string; + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod; + +// Some definitions +namespace o2::aod +{ + +namespace dqanalysisflags +{ +// DECLARE_SOA_COLUMN(IsEventSelected, isEventSelected, int); +DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision +// DECLARE_SOA_COLUMN(IsMuonSelected, isMuonSelected, int); +DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc) +} + +DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents +DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc +} + +// Declarations of various short names +using MyEvents = soa::Join; +using MyEventsSelected = soa::Join; +using MyEventsVtxCov = soa::Join; +using MyEventsVtxCovSelected = soa::Join; + +using MyPairCandidatesSelected = soa::Join; +using MyMuonTracks = soa::Join; +using MyMuonTracksSelected = soa::Join; +using MyMuonTracksWithCov = soa::Join; +using MyMuonTracksSelectedWithCov = soa::Join; + +// bit maps used for the Fill functions of the VarManager +constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended; +constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra; + +struct DqJPsiMuonCorrelations { + + // Configurables for the dilepton and dilepton cuts + Configurable fConfigDileptonLowMass{"cfgDileptonLowMass", 2., "Low mass cut for the dileptons used in analysis"}; + Configurable fConfigDileptonHighMass{"cfgDileptonHighMass", 4., "High mass cut for the dileptons used in analysis"}; + + // Connect to ccdb + Service ccdb; + 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"}; + Configurable url{"ccdb-url", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + + // Define the filter for events + Filter eventFilter = aod::dqanalysisflags::isEventSelected == 1; + + // Define the filter for the dileptons + Filter dileptonFilter = aod::reducedpair::sign == 0; + + constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map + + // use two values array to avoid mixing up the quantities + float* fValuesDilepton; + float* fValuesMuon; + + HistogramRegistry registry{"registry"}; + + void init(o2::framework::InitContext&) + { + ccdb->setURL(url.value); + ccdb->setCaching(true); + ccdb->setCreatedNotAfter(nolaterthan.value); + + fValuesDilepton = new float[VarManager::kNVars]; + fValuesMuon = new float[VarManager::kNVars]; + VarManager::SetDefaultVarNames(); + + LOG(info) << "Initialized DqJPsiMuonCorrelations task" << std::endl; + } + + // Template function to run pair - muon combinations + template + void runDileptonMuon(TEvent const& event, TMuons const& muons, TDileptons const& dileptons) + { + // VarManager::ResetValues(0, VarManager::kNVars, fValuesHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesMuon); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDilepton); + VarManager::FillEvent(event, fValuesMuon); + VarManager::FillEvent(event, fValuesDilepton); + + if (dileptons.size() > 0) { + LOG(info) << "Dileptons in event: " << dileptons.size() << std::endl; + } else { + LOG(info) << "No dileptons in event" << std::endl; + } + } + + void processSkimmedDimuon(MyEventsSelected::iterator const& event, MyMuonTracksSelected const& muons, soa::Filtered const& dileptons) + { + LOG(info) << "Processing event " << event.globalIndex() << " with " << muons.size() << " muons and " << dileptons.size() << " dileptons" << std::endl; + runDileptonMuon(event, muons, dileptons); + } + void processDummy(MyEvents&) + { + } + + PROCESS_SWITCH(DqJPsiMuonCorrelations, processSkimmedDimuon, "Run dilepton-muon pairing, using skimmed data", false); + PROCESS_SWITCH(DqJPsiMuonCorrelations, processDummy, "Dummy function", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 7bba97edbb47ffcaf92f519eaa98f8f5b599a3dd Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Mon, 8 Jun 2026 14:26:23 +0200 Subject: [PATCH 02/22] Cleanup tables, add temporary test variables --- PWGDQ/Tasks/taskJPsiMu.cxx | 50 ++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 180c311e0de..c63fe767cad 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -53,9 +53,7 @@ namespace o2::aod namespace dqanalysisflags { -// DECLARE_SOA_COLUMN(IsEventSelected, isEventSelected, int); DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision -// DECLARE_SOA_COLUMN(IsMuonSelected, isMuonSelected, int); DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc) } @@ -64,16 +62,10 @@ DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuo } // Declarations of various short names -using MyEvents = soa::Join; using MyEventsSelected = soa::Join; -using MyEventsVtxCov = soa::Join; -using MyEventsVtxCovSelected = soa::Join; using MyPairCandidatesSelected = soa::Join; -using MyMuonTracks = soa::Join; -using MyMuonTracksSelected = soa::Join; -using MyMuonTracksWithCov = soa::Join; -using MyMuonTracksSelectedWithCov = soa::Join; +using MyMuonTracksSelected = soa::Join; // bit maps used for the Fill functions of the VarManager constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended; @@ -103,6 +95,9 @@ struct DqJPsiMuonCorrelations { float* fValuesMuon; HistogramRegistry registry{"registry"}; + + // int nMuons; + // int nEvents; void init(o2::framework::InitContext&) { @@ -114,7 +109,8 @@ struct DqJPsiMuonCorrelations { fValuesMuon = new float[VarManager::kNVars]; VarManager::SetDefaultVarNames(); - LOG(info) << "Initialized DqJPsiMuonCorrelations task" << std::endl; + // nMuons = 0; + // nEvents = 0; } // Template function to run pair - muon combinations @@ -127,16 +123,40 @@ struct DqJPsiMuonCorrelations { VarManager::FillEvent(event, fValuesMuon); VarManager::FillEvent(event, fValuesDilepton); - if (dileptons.size() > 0) { - LOG(info) << "Dileptons in event: " << dileptons.size() << std::endl; - } else { - LOG(info) << "No dileptons in event" << std::endl; + if (!event.isEventSelected_bit(0)) { + return; } + + // if (dileptons.size() > 0) { + // LOG(info) << "Processing event " << event.globalIndex() << " with " << muons.size() << " muons and " << dileptons.size() << " dileptons" << std::endl; + // LOG(info) << "Dilepton leg indexes: "; + // for (auto& dilepton : dileptons) { + // LOG(info) << dilepton.index0Id() << " and " << dilepton.index1Id() << " "; + // } + // LOG(info) << std::endl; + // LOG(info) << "Muon indexes: "; + // for (auto& muon : muons) { + // LOG(info) << muon.reducedmuonId() << " "; + // } + // LOG(info) << std::endl; + // } + + // for (auto& muon : muons) { + // // VarManager::FillTrack(muon, fValuesMuon); + // if (!muon.isMuonSelected_raw()) { + // continue; + // } + // nMuons++; + // LOG(info) << "Total number of muons processed: " << nMuons << std::endl; + // } + // nEvents++; + // LOG(info) << "Total number of events processed: " << nEvents << std::endl; + + } void processSkimmedDimuon(MyEventsSelected::iterator const& event, MyMuonTracksSelected const& muons, soa::Filtered const& dileptons) { - LOG(info) << "Processing event " << event.globalIndex() << " with " << muons.size() << " muons and " << dileptons.size() << " dileptons" << std::endl; runDileptonMuon(event, muons, dileptons); } void processDummy(MyEvents&) From cb13ef90e1bda1472447532b5dc6bd86d63bbf80 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 09:34:44 +0200 Subject: [PATCH 03/22] Add initial histograms without weights --- PWGDQ/Tasks/taskJPsiMu.cxx | 53 +++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index c63fe767cad..1c2b085ef95 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -62,10 +62,14 @@ DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuo } // Declarations of various short names +using MyEvents = soa::Join; using MyEventsSelected = soa::Join; +using MyEventsVtxCov = soa::Join; +using MyEventsVtxCovSelected = soa::Join; using MyPairCandidatesSelected = soa::Join; -using MyMuonTracksSelected = soa::Join; +using MyMuonTracks = soa::Join; +using MyMuonAssocsSelected = soa::Join; // bit maps used for the Fill functions of the VarManager constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended; @@ -74,8 +78,15 @@ constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | Va struct DqJPsiMuonCorrelations { // Configurables for the dilepton and dilepton cuts - Configurable fConfigDileptonLowMass{"cfgDileptonLowMass", 2., "Low mass cut for the dileptons used in analysis"}; - Configurable fConfigDileptonHighMass{"cfgDileptonHighMass", 4., "High mass cut for the dileptons used in analysis"}; + Configurable fConfigDileptonLowMass{"cfgDileptonLowMass", 2.8, "Low mass cut for the dileptons used in analysis"}; + Configurable fConfigDileptonHighMass{"cfgDileptonHighMass", 3.4, "High mass cut for the dileptons used in analysis"}; + Configurable fConfigBackgroundLowMass{"cfgBackgroundLowMass", 2.5, "Low mass cut for the background used in analysis"}; + Configurable fConfigBackgroundHighMass{"cfgBackgroundHighMass", 3.7, "High mass cut for the background used in analysis"}; + + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f}, "p_{T} (GeV/c)"}; + ConfigurableAxis axisInvMass{"axisInvMass", {80, 1.0f, 5.0f}, "Invariant Mass (GeV/c^{2})"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI/2.0f, 3.0f*constants::math::PI/2.0f}, "#Delta#phi (rad)"}; + ConfigurableAxis axisDeltaEta{"axisDeltaEta", {10, -2.0f, 2.0f}, "#Delta#eta"}; // Connect to ccdb Service ccdb; @@ -111,11 +122,17 @@ struct DqJPsiMuonCorrelations { // nMuons = 0; // nEvents = 0; + + registry.add("h2dDimuonPtInvVsInvMass", "h2dDimuonPtInvVsInvMass", kTH2D, {axisInvMass, axisPt}); + registry.add("h2dDimuonMuonDeltaEtaVsMuonPtSignal", "h2dDimuonMuonDeltaEtaVsMuonPtSignal", kTH2D, {axisDeltaEta, axisPt}); + registry.add("h2dDimuonMuonDeltaPhiVsMuonPtSignal", "h2dDimuonMuonDeltaPhiVsMuonPtSignal", kTH2D, {axisDeltaPhi, axisPt}); + registry.add("h2dDimuonMuonDeltaEtaVsMuonPtBackground", "h2dDimuonMuonDeltaEtaVsMuonPtBackground", kTH2D, {axisDeltaEta, axisPt}); + registry.add("h2dDimuonMuonDeltaPhiVsMuonPtBackground", "h2dDimuonMuonDeltaPhiVsMuonPtBackground", kTH2D, {axisDeltaPhi, axisPt}); } // Template function to run pair - muon combinations - template - void runDileptonMuon(TEvent const& event, TMuons const& muons, TDileptons const& dileptons) + template + void runDileptonMuon(TEvent const& event, TMuonAssocs const& assocs, TMuonTracks const& /*tracks*/, TDileptons const& dileptons) { // VarManager::ResetValues(0, VarManager::kNVars, fValuesHadron); VarManager::ResetValues(0, VarManager::kNVars, fValuesMuon); @@ -152,12 +169,34 @@ struct DqJPsiMuonCorrelations { // nEvents++; // LOG(info) << "Total number of events processed: " << nEvents << std::endl; + if (dileptons.size() > 0) { + + for (auto& dilepton : dileptons) { + VarManager::FillTrack(dilepton, fValuesDilepton); + registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt()); + for (auto& assoc : assocs) { + if (!assoc.isMuonSelected_bit(0)) { + continue; + } + auto track = assoc.template reducedmuon_as(); + + if (dilepton.mass() > fConfigDileptonLowMass && dilepton.mass() < fConfigDileptonHighMass) { + registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), track.eta() - dilepton.eta(), track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), track.phi() - dilepton.phi(), track.pt()); + } else if (dilepton.mass() > fConfigBackgroundLowMass && dilepton.mass() < fConfigBackgroundHighMass) { + registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), track.eta() - dilepton.eta(), track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), track.phi() - dilepton.phi(), track.pt()); + } + } + + } + } } - void processSkimmedDimuon(MyEventsSelected::iterator const& event, MyMuonTracksSelected const& muons, soa::Filtered const& dileptons) + void processSkimmedDimuon(MyEventsSelected::iterator const& event, MyMuonAssocsSelected const& muonassocs, MyMuonTracks const& muontracks, soa::Filtered const& dileptons) { - runDileptonMuon(event, muons, dileptons); + runDileptonMuon(event, muonassocs, muontracks, dileptons); } void processDummy(MyEvents&) { From 9bdb48dcf15d544501426e96ac1e4a16b89e376e Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 09:41:58 +0200 Subject: [PATCH 04/22] Cleanup comments and unused variables --- PWGDQ/Tasks/taskJPsiMu.cxx | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 1c2b085ef95..a69d9cd32b0 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -64,8 +64,6 @@ DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuo // Declarations of various short names using MyEvents = soa::Join; using MyEventsSelected = soa::Join; -using MyEventsVtxCov = soa::Join; -using MyEventsVtxCovSelected = soa::Join; using MyPairCandidatesSelected = soa::Join; using MyMuonTracks = soa::Join; @@ -106,9 +104,6 @@ struct DqJPsiMuonCorrelations { float* fValuesMuon; HistogramRegistry registry{"registry"}; - - // int nMuons; - // int nEvents; void init(o2::framework::InitContext&) { @@ -120,9 +115,6 @@ struct DqJPsiMuonCorrelations { fValuesMuon = new float[VarManager::kNVars]; VarManager::SetDefaultVarNames(); - // nMuons = 0; - // nEvents = 0; - registry.add("h2dDimuonPtInvVsInvMass", "h2dDimuonPtInvVsInvMass", kTH2D, {axisInvMass, axisPt}); registry.add("h2dDimuonMuonDeltaEtaVsMuonPtSignal", "h2dDimuonMuonDeltaEtaVsMuonPtSignal", kTH2D, {axisDeltaEta, axisPt}); registry.add("h2dDimuonMuonDeltaPhiVsMuonPtSignal", "h2dDimuonMuonDeltaPhiVsMuonPtSignal", kTH2D, {axisDeltaPhi, axisPt}); @@ -144,31 +136,6 @@ struct DqJPsiMuonCorrelations { return; } - // if (dileptons.size() > 0) { - // LOG(info) << "Processing event " << event.globalIndex() << " with " << muons.size() << " muons and " << dileptons.size() << " dileptons" << std::endl; - // LOG(info) << "Dilepton leg indexes: "; - // for (auto& dilepton : dileptons) { - // LOG(info) << dilepton.index0Id() << " and " << dilepton.index1Id() << " "; - // } - // LOG(info) << std::endl; - // LOG(info) << "Muon indexes: "; - // for (auto& muon : muons) { - // LOG(info) << muon.reducedmuonId() << " "; - // } - // LOG(info) << std::endl; - // } - - // for (auto& muon : muons) { - // // VarManager::FillTrack(muon, fValuesMuon); - // if (!muon.isMuonSelected_raw()) { - // continue; - // } - // nMuons++; - // LOG(info) << "Total number of muons processed: " << nMuons << std::endl; - // } - // nEvents++; - // LOG(info) << "Total number of events processed: " << nEvents << std::endl; - if (dileptons.size() > 0) { for (auto& dilepton : dileptons) { From d95b96354b33f782ff9ec82fbcc50ad08ba4afe5 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 10:00:48 +0200 Subject: [PATCH 05/22] Wrapping of deltaPhi --- PWGDQ/Tasks/taskJPsiMu.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index a69d9cd32b0..d1f5bbcbfa7 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -148,12 +148,20 @@ struct DqJPsiMuonCorrelations { } auto track = assoc.template reducedmuon_as(); + float deltaEta = track.eta() - dilepton.eta(); + float deltaPhi = track.phi() - dilepton.phi(); + if (deltaPhi < -constants::math::PI/2.0f) { + deltaPhi += 2.0f * constants::math::PI; + } else if (deltaPhi > constants::math::PI*3.0f/2.0f) { + deltaPhi -= 2.0f * constants::math::PI; + } + if (dilepton.mass() > fConfigDileptonLowMass && dilepton.mass() < fConfigDileptonHighMass) { - registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), track.eta() - dilepton.eta(), track.pt()); - registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), track.phi() - dilepton.phi(), track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), deltaEta, track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), deltaPhi, track.pt()); } else if (dilepton.mass() > fConfigBackgroundLowMass && dilepton.mass() < fConfigBackgroundHighMass) { - registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), track.eta() - dilepton.eta(), track.pt()); - registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), track.phi() - dilepton.phi(), track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), deltaEta, track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), deltaPhi, track.pt()); } } From 56fdf05b77d51325df9896deadcda88daa977487 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 10:04:49 +0200 Subject: [PATCH 06/22] Cleanup and add todos --- PWGDQ/Tasks/taskJPsiMu.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index d1f5bbcbfa7..e047d57dc4d 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -126,7 +126,6 @@ struct DqJPsiMuonCorrelations { template void runDileptonMuon(TEvent const& event, TMuonAssocs const& assocs, TMuonTracks const& /*tracks*/, TDileptons const& dileptons) { - // VarManager::ResetValues(0, VarManager::kNVars, fValuesHadron); VarManager::ResetValues(0, VarManager::kNVars, fValuesMuon); VarManager::ResetValues(0, VarManager::kNVars, fValuesDilepton); VarManager::FillEvent(event, fValuesMuon); @@ -138,6 +137,8 @@ struct DqJPsiMuonCorrelations { if (dileptons.size() > 0) { + // TODO: Implement cuts on dileptons and assocs + for (auto& dilepton : dileptons) { VarManager::FillTrack(dilepton, fValuesDilepton); registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt()); @@ -148,6 +149,8 @@ struct DqJPsiMuonCorrelations { } auto track = assoc.template reducedmuon_as(); + // TODO: Check if the associated track is part of the dilepton candidate, if so skip it to avoid auto-correlations + float deltaEta = track.eta() - dilepton.eta(); float deltaPhi = track.phi() - dilepton.phi(); if (deltaPhi < -constants::math::PI/2.0f) { @@ -156,6 +159,8 @@ struct DqJPsiMuonCorrelations { deltaPhi -= 2.0f * constants::math::PI; } + // TODO: Implement weights for efficiency and acceptance correction + if (dilepton.mass() > fConfigDileptonLowMass && dilepton.mass() < fConfigDileptonHighMass) { registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), deltaEta, track.pt()); registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), deltaPhi, track.pt()); @@ -165,6 +170,7 @@ struct DqJPsiMuonCorrelations { } } + // TODO: Implement trigger counting } } } From 350a8db087d1ea1dd9bb9b93fb409cd4c52ef828 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 10:25:44 +0200 Subject: [PATCH 07/22] Autocorrelation check --- PWGDQ/Tasks/taskJPsiMu.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index e047d57dc4d..1dcbfbe475c 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -147,9 +147,13 @@ struct DqJPsiMuonCorrelations { if (!assoc.isMuonSelected_bit(0)) { continue; } - auto track = assoc.template reducedmuon_as(); - // TODO: Check if the associated track is part of the dilepton candidate, if so skip it to avoid auto-correlations + // Skip associated muons that are part of the dilepton candidate + if (dilepton.index0Id() == assoc.reducedmuonId() || dilepton.index1Id() == assoc.reducedmuonId()) { + continue; + } + + auto track = assoc.template reducedmuon_as(); float deltaEta = track.eta() - dilepton.eta(); float deltaPhi = track.phi() - dilepton.phi(); From f9517b8d1f41f54738a82e1ebe4d59292458af64 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 11:35:15 +0200 Subject: [PATCH 08/22] Add configurable and eff bins check --- PWGDQ/Tasks/taskJPsiMu.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 1dcbfbe475c..238ca9c2b73 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -75,17 +75,29 @@ constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | Va struct DqJPsiMuonCorrelations { - // Configurables for the dilepton and dilepton cuts + // Configurables for the dilepton signal region Configurable fConfigDileptonLowMass{"cfgDileptonLowMass", 2.8, "Low mass cut for the dileptons used in analysis"}; Configurable fConfigDileptonHighMass{"cfgDileptonHighMass", 3.4, "High mass cut for the dileptons used in analysis"}; Configurable fConfigBackgroundLowMass{"cfgBackgroundLowMass", 2.5, "Low mass cut for the background used in analysis"}; Configurable fConfigBackgroundHighMass{"cfgBackgroundHighMass", 3.7, "High mass cut for the background used in analysis"}; + // Configurables for the dilepton and associated muon cuts + Configurable fConfigMuonPtMin{"cfgMuonPtMin", 1.0, "Minimum pT cut for the associated muons"}; + Configurable fConfigMuonPtMax{"cfgMuonPtMax", 10.0, "Maximum pT cut for the associated muons"}; + Configurable fConfigMuonEtaMin{"cfgMuonEtaMin", -4.0, "Minimum eta cut for the associated muons"}; + Configurable fConfigMuonEtaMax{"cfgMuonEtaMax", -2.5, "Maximum eta cut for the associated muons"}; + Configurable fConfigDileptonEtaMin{"cfgDileptonEtaMin", -4.0, "Minimum eta cut for the dileptons"}; + Configurable fConfigDileptonEtaMax{"cfgDileptonEtaMax", -2.5, "Maximum eta cut for the dileptons"}; + + // Configurables for histograms ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f}, "p_{T} (GeV/c)"}; ConfigurableAxis axisInvMass{"axisInvMass", {80, 1.0f, 5.0f}, "Invariant Mass (GeV/c^{2})"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI/2.0f, 3.0f*constants::math::PI/2.0f}, "#Delta#phi (rad)"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {10, -2.0f, 2.0f}, "#Delta#eta"}; + // Configurable for acceptance efficiency correction + Configurable> fConfigBinEff{"cfgBinEff", std::vector{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, "acceptance efficiency correction factors for each pT bin"}; + // Connect to ccdb Service ccdb; 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"}; @@ -120,6 +132,11 @@ struct DqJPsiMuonCorrelations { registry.add("h2dDimuonMuonDeltaPhiVsMuonPtSignal", "h2dDimuonMuonDeltaPhiVsMuonPtSignal", kTH2D, {axisDeltaPhi, axisPt}); registry.add("h2dDimuonMuonDeltaEtaVsMuonPtBackground", "h2dDimuonMuonDeltaEtaVsMuonPtBackground", kTH2D, {axisDeltaEta, axisPt}); registry.add("h2dDimuonMuonDeltaPhiVsMuonPtBackground", "h2dDimuonMuonDeltaPhiVsMuonPtBackground", kTH2D, {axisDeltaPhi, axisPt}); + + if (axisPt.value.size()-2 != fConfigBinEff.value.size()) { + LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEff: %zu (excluding 'VARIABLE_WIDTH' entry)", + axisPt.value.size()-1, fConfigBinEff.value.size()); + } } // Template function to run pair - muon combinations From 95488cedb3935a4c7b33d3456b1c7f374a905b2a Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 11:48:36 +0200 Subject: [PATCH 09/22] Implement kinematic cuts --- PWGDQ/Tasks/taskJPsiMu.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 238ca9c2b73..35cccaed942 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -82,12 +82,12 @@ struct DqJPsiMuonCorrelations { Configurable fConfigBackgroundHighMass{"cfgBackgroundHighMass", 3.7, "High mass cut for the background used in analysis"}; // Configurables for the dilepton and associated muon cuts - Configurable fConfigMuonPtMin{"cfgMuonPtMin", 1.0, "Minimum pT cut for the associated muons"}; - Configurable fConfigMuonPtMax{"cfgMuonPtMax", 10.0, "Maximum pT cut for the associated muons"}; - Configurable fConfigMuonEtaMin{"cfgMuonEtaMin", -4.0, "Minimum eta cut for the associated muons"}; - Configurable fConfigMuonEtaMax{"cfgMuonEtaMax", -2.5, "Maximum eta cut for the associated muons"}; + Configurable fConfigDileptonPtMin{"cfgDileptonPtMin", 1.0, "Minimum pT cut for the associated muons"}; + Configurable fConfigDileptonPtMax{"cfgDileptonPtMax", 10.0, "Maximum pT cut for the associated muons"}; Configurable fConfigDileptonEtaMin{"cfgDileptonEtaMin", -4.0, "Minimum eta cut for the dileptons"}; Configurable fConfigDileptonEtaMax{"cfgDileptonEtaMax", -2.5, "Maximum eta cut for the dileptons"}; + Configurable fConfigMuonEtaMin{"cfgMuonEtaMin", -4.0, "Minimum eta cut for the associated muons"}; + Configurable fConfigMuonEtaMax{"cfgMuonEtaMax", -2.5, "Maximum eta cut for the associated muons"}; // Configurables for histograms ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f}, "p_{T} (GeV/c)"}; @@ -153,14 +153,19 @@ struct DqJPsiMuonCorrelations { } if (dileptons.size() > 0) { - - // TODO: Implement cuts on dileptons and assocs - for (auto& dilepton : dileptons) { VarManager::FillTrack(dilepton, fValuesDilepton); + + // Dilepton kinematic cuts + if ((dilepton.eta() < fConfigDileptonEtaMin || dilepton.eta() > fConfigDileptonEtaMax) || + (dilepton.pt() < fConfigDileptonPtMin || dilepton.pt() > fConfigDileptonPtMax)) { + continue; + } + registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt()); for (auto& assoc : assocs) { + // Check selection bit if (!assoc.isMuonSelected_bit(0)) { continue; } @@ -170,8 +175,15 @@ struct DqJPsiMuonCorrelations { continue; } + // Get muon track information auto track = assoc.template reducedmuon_as(); + // Muon kinematic cuts + if ((track.eta() < fConfigMuonEtaMin || track.eta() > fConfigMuonEtaMax) || + (track.pt() < axisPt.value.front() || track.pt() > axisPt.value.back())) { + continue; + } + float deltaEta = track.eta() - dilepton.eta(); float deltaPhi = track.phi() - dilepton.phi(); if (deltaPhi < -constants::math::PI/2.0f) { From e8764e3bc57716d3ff9d6246acfe50dae5c342c1 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 12:36:39 +0200 Subject: [PATCH 10/22] Add trigger counting --- PWGDQ/Tasks/taskJPsiMu.cxx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 35cccaed942..15e06c1f9cb 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -83,7 +83,7 @@ struct DqJPsiMuonCorrelations { // Configurables for the dilepton and associated muon cuts Configurable fConfigDileptonPtMin{"cfgDileptonPtMin", 1.0, "Minimum pT cut for the associated muons"}; - Configurable fConfigDileptonPtMax{"cfgDileptonPtMax", 10.0, "Maximum pT cut for the associated muons"}; + Configurable fConfigDileptonPtMax{"cfgDileptonPtMax", 20.0, "Maximum pT cut for the associated muons"}; Configurable fConfigDileptonEtaMin{"cfgDileptonEtaMin", -4.0, "Minimum eta cut for the dileptons"}; Configurable fConfigDileptonEtaMax{"cfgDileptonEtaMax", -2.5, "Maximum eta cut for the dileptons"}; Configurable fConfigMuonEtaMin{"cfgMuonEtaMin", -4.0, "Minimum eta cut for the associated muons"}; @@ -123,26 +123,34 @@ struct DqJPsiMuonCorrelations { ccdb->setCaching(true); ccdb->setCreatedNotAfter(nolaterthan.value); + // Assert correct size of the efficiency correction vector + if (axisPt.value.size()-2 != fConfigBinEff.value.size()) { + LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEff: %zu (excluding 'VARIABLE_WIDTH' entry)", + axisPt.value.size()-1, fConfigBinEff.value.size()); + } + + // Set up varmanager variable names fValuesDilepton = new float[VarManager::kNVars]; fValuesMuon = new float[VarManager::kNVars]; VarManager::SetDefaultVarNames(); + // Define trigger histograms + ConfigurableAxis axisTriggerMass{"axisTriggerMass", {VARIABLE_WIDTH, fConfigBackgroundLowMass, fConfigDileptonLowMass, fConfigDileptonHighMass, fConfigBackgroundHighMass}, "Invariant Mass (GeV/c^{2}) for trigger counting"}; registry.add("h2dDimuonPtInvVsInvMass", "h2dDimuonPtInvVsInvMass", kTH2D, {axisInvMass, axisPt}); + registry.add("h2dTriggersPtInvVsInvMassRegion", "h2dTriggersPtInvVsInvMassRegion", kTH2D, {axisTriggerMass, axisPt}); + + // Define histograms for the dilepton-muon correlations registry.add("h2dDimuonMuonDeltaEtaVsMuonPtSignal", "h2dDimuonMuonDeltaEtaVsMuonPtSignal", kTH2D, {axisDeltaEta, axisPt}); registry.add("h2dDimuonMuonDeltaPhiVsMuonPtSignal", "h2dDimuonMuonDeltaPhiVsMuonPtSignal", kTH2D, {axisDeltaPhi, axisPt}); registry.add("h2dDimuonMuonDeltaEtaVsMuonPtBackground", "h2dDimuonMuonDeltaEtaVsMuonPtBackground", kTH2D, {axisDeltaEta, axisPt}); registry.add("h2dDimuonMuonDeltaPhiVsMuonPtBackground", "h2dDimuonMuonDeltaPhiVsMuonPtBackground", kTH2D, {axisDeltaPhi, axisPt}); - - if (axisPt.value.size()-2 != fConfigBinEff.value.size()) { - LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEff: %zu (excluding 'VARIABLE_WIDTH' entry)", - axisPt.value.size()-1, fConfigBinEff.value.size()); - } } // Template function to run pair - muon combinations template void runDileptonMuon(TEvent const& event, TMuonAssocs const& assocs, TMuonTracks const& /*tracks*/, TDileptons const& dileptons) { + // Reset the VarManager values at the beginning of each event VarManager::ResetValues(0, VarManager::kNVars, fValuesMuon); VarManager::ResetValues(0, VarManager::kNVars, fValuesDilepton); VarManager::FillEvent(event, fValuesMuon); @@ -162,7 +170,9 @@ struct DqJPsiMuonCorrelations { continue; } + // Fill invariant mass vs pT histogram for the dileptons and for trigger counting registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt()); + registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt()); for (auto& assoc : assocs) { // Check selection bit @@ -202,8 +212,6 @@ struct DqJPsiMuonCorrelations { registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), deltaPhi, track.pt()); } } - - // TODO: Implement trigger counting } } } From 2596de87f17608aaa5cc4812d92563e2636a40be Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 13:35:03 +0200 Subject: [PATCH 11/22] Add weights from eff and deltay --- PWGDQ/Tasks/taskJPsiMu.cxx | 48 +++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 15e06c1f9cb..ff1c6e17eeb 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -73,6 +73,10 @@ using MyMuonAssocsSelected = soa::Join& pT_bins, const std::vector& efficiency, const double eta_min, const double eta_max); + struct DqJPsiMuonCorrelations { // Configurables for the dilepton signal region @@ -96,7 +100,8 @@ struct DqJPsiMuonCorrelations { ConfigurableAxis axisDeltaEta{"axisDeltaEta", {10, -2.0f, 2.0f}, "#Delta#eta"}; // Configurable for acceptance efficiency correction - Configurable> fConfigBinEff{"cfgBinEff", std::vector{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, "acceptance efficiency correction factors for each pT bin"}; + Configurable> fConfigBinEffJPsi{"cfgBinEffJPsi", std::vector{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, "acceptance efficiency correction factors for each pT bin"}; + Configurable> fConfigBinEffMuon{"cfgBinEffMuon", std::vector{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}, "acceptance efficiency correction factors for each pT bin"}; // Connect to ccdb Service ccdb; @@ -124,9 +129,9 @@ struct DqJPsiMuonCorrelations { ccdb->setCreatedNotAfter(nolaterthan.value); // Assert correct size of the efficiency correction vector - if (axisPt.value.size()-2 != fConfigBinEff.value.size()) { - LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEff: %zu (excluding 'VARIABLE_WIDTH' entry)", - axisPt.value.size()-1, fConfigBinEff.value.size()); + if (axisPt.value.size()-2 != fConfigBinEffJPsi.value.size() || axisPt.value.size()-2 != fConfigBinEffMuon.value.size()) { + LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEffJPsi: %zu and fConfigBinEffMuon: %zu (excluding 'VARIABLE_WIDTH' entry)", + axisPt.value.size()-1, fConfigBinEffJPsi.value.size(), fConfigBinEffMuon.value.size()); } // Set up varmanager variable names @@ -171,8 +176,10 @@ struct DqJPsiMuonCorrelations { } // Fill invariant mass vs pT histogram for the dileptons and for trigger counting - registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt()); - registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt()); + double w_dilepton = getWeight(dilepton.pt(), axisPt.value, fConfigBinEffJPsi.value, fConfigDileptonEtaMin, fConfigDileptonEtaMax); + + registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt(), w_dilepton); + registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt(), w_dilepton); for (auto& assoc : assocs) { // Check selection bit @@ -194,6 +201,7 @@ struct DqJPsiMuonCorrelations { continue; } + // Compute deltaEta and deltaPhi between the dilepton and the associated muon float deltaEta = track.eta() - dilepton.eta(); float deltaPhi = track.phi() - dilepton.phi(); if (deltaPhi < -constants::math::PI/2.0f) { @@ -202,14 +210,15 @@ struct DqJPsiMuonCorrelations { deltaPhi -= 2.0f * constants::math::PI; } - // TODO: Implement weights for efficiency and acceptance correction + // Fill signal and background histograms based on the dilepton mass + double w_muon = getWeight(track.pt(), axisPt.value, fConfigBinEffMuon.value, fConfigMuonEtaMin, fConfigMuonEtaMax); if (dilepton.mass() > fConfigDileptonLowMass && dilepton.mass() < fConfigDileptonHighMass) { - registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), deltaEta, track.pt()); - registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), deltaPhi, track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), deltaEta, track.pt(), w_dilepton * w_muon); + registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), deltaPhi, track.pt(), w_dilepton * w_muon); } else if (dilepton.mass() > fConfigBackgroundLowMass && dilepton.mass() < fConfigBackgroundHighMass) { - registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), deltaEta, track.pt()); - registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), deltaPhi, track.pt()); + registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), deltaEta, track.pt(), w_dilepton * w_muon); + registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), deltaPhi, track.pt(), w_dilepton * w_muon); } } } @@ -233,3 +242,20 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc)}; } + +double getRapidity(const double pT, const double eta) { + double mJPsi = 3.096916; // J/Psi mass in GeV/c^2 + return log((sqrt(pow(mJPsi, 2) + (pow(pT, 2) * pow(cosh(eta), 2))) + pT * sinh(eta)) / (sqrt(pow(mJPsi, 2) + pow(pT, 2)))); +} + +double getWeight(const double pT, const std::vector& pT_bins, const std::vector& efficiency, const double eta_min, const double eta_max) { + + int eff_bin = -1; + for (size_t b = 0; b < pT_bins.size() - 1; ++b) { + if (pT >= pT_bins[b] && pT < pT_bins[b + 1]) { + eff_bin = b; + break; + } + } + return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))); +} From 28f5ca6411cdc73bf126d7da0742ddb148f186da Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 14:19:54 +0200 Subject: [PATCH 12/22] Reverse deltaEta/Phi --- PWGDQ/Tasks/taskJPsiMu.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index ff1c6e17eeb..2b47fed51d5 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -202,8 +202,8 @@ struct DqJPsiMuonCorrelations { } // Compute deltaEta and deltaPhi between the dilepton and the associated muon - float deltaEta = track.eta() - dilepton.eta(); - float deltaPhi = track.phi() - dilepton.phi(); + float deltaEta = dilepton.eta() - track.eta(); + float deltaPhi = dilepton.phi() - track.phi(); if (deltaPhi < -constants::math::PI/2.0f) { deltaPhi += 2.0f * constants::math::PI; } else if (deltaPhi > constants::math::PI*3.0f/2.0f) { From 106e1a8525bade228e8589e6ddd49b600407c196 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 9 Jun 2026 19:18:59 +0200 Subject: [PATCH 13/22] FIx pt axis index bug --- PWGDQ/Tasks/taskJPsiMu.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 2b47fed51d5..a4b80e6cf07 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -197,7 +197,7 @@ struct DqJPsiMuonCorrelations { // Muon kinematic cuts if ((track.eta() < fConfigMuonEtaMin || track.eta() > fConfigMuonEtaMax) || - (track.pt() < axisPt.value.front() || track.pt() > axisPt.value.back())) { + (track.pt() < axisPt.value[1] || track.pt() > axisPt.value.back())) { continue; } @@ -252,7 +252,8 @@ double getWeight(const double pT, const std::vector& pT_bins, const std: int eff_bin = -1; for (size_t b = 0; b < pT_bins.size() - 1; ++b) { - if (pT >= pT_bins[b] && pT < pT_bins[b + 1]) { + // Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration + if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) { eff_bin = b; break; } From 93f05b303690e3967436b8e7fcdfbc09a0b56904 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 17 Jun 2026 14:17:20 +0200 Subject: [PATCH 14/22] Efficiency validity check --- PWGDQ/Tasks/taskJPsiMu.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index a4b80e6cf07..98d1b50817d 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -258,5 +258,8 @@ double getWeight(const double pT, const std::vector& pT_bins, const std: break; } } +if ((efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))) == 0) { + LOG(info) << "Efficiency correction factor is zero for pT: " << pT << ", efficiency: " << efficiency[eff_bin] << ", eta range: [" << eta_min << ", " << eta_max << "]."; + } return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))); } From 83f1bfa45e7ab8fb04f0bcbedf85e9c37ee4ee88 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 17 Jun 2026 14:18:32 +0200 Subject: [PATCH 15/22] Kinematic cuts for dilepton leg --- PWGDQ/Tasks/taskJPsiMu.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 98d1b50817d..0ad25a49f89 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -65,7 +65,8 @@ DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuo using MyEvents = soa::Join; using MyEventsSelected = soa::Join; -using MyPairCandidatesSelected = soa::Join; +// using MyPairCandidatesSelected = soa::Join; +using MyPairCandidatesSelected = soa::Join; using MyMuonTracks = soa::Join; using MyMuonAssocsSelected = soa::Join; @@ -86,8 +87,8 @@ struct DqJPsiMuonCorrelations { Configurable fConfigBackgroundHighMass{"cfgBackgroundHighMass", 3.7, "High mass cut for the background used in analysis"}; // Configurables for the dilepton and associated muon cuts - Configurable fConfigDileptonPtMin{"cfgDileptonPtMin", 1.0, "Minimum pT cut for the associated muons"}; - Configurable fConfigDileptonPtMax{"cfgDileptonPtMax", 20.0, "Maximum pT cut for the associated muons"}; + Configurable fConfigDileptonPtMin{"cfgDileptonPtMin", 1.0, "Minimum pT cut for the dilepton"}; + Configurable fConfigDileptonPtMax{"cfgDileptonPtMax", 20.0, "Maximum pT cut for the dilepton"}; Configurable fConfigDileptonEtaMin{"cfgDileptonEtaMin", -4.0, "Minimum eta cut for the dileptons"}; Configurable fConfigDileptonEtaMax{"cfgDileptonEtaMax", -2.5, "Maximum eta cut for the dileptons"}; Configurable fConfigMuonEtaMin{"cfgMuonEtaMin", -4.0, "Minimum eta cut for the associated muons"}; @@ -172,6 +173,13 @@ struct DqJPsiMuonCorrelations { // Dilepton kinematic cuts if ((dilepton.eta() < fConfigDileptonEtaMin || dilepton.eta() > fConfigDileptonEtaMax) || (dilepton.pt() < fConfigDileptonPtMin || dilepton.pt() > fConfigDileptonPtMax)) { +continue; + } + // Dilepton leg kinematic cuts + if ((dilepton.eta1() < fConfigMuonEtaMin || dilepton.eta1() > fConfigMuonEtaMax) || + (dilepton.pt1() < axisPt.value[1] || dilepton.pt1() > axisPt.value.back()) || + (dilepton.eta2() < fConfigMuonEtaMin || dilepton.eta2() > fConfigMuonEtaMax) || + (dilepton.pt2() < axisPt.value[1] || dilepton.pt2() > axisPt.value.back())) { continue; } From f3c4f6016c78a593ac999e1b16532d50de9194df Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 17 Jun 2026 14:18:52 +0200 Subject: [PATCH 16/22] QA Histograms --- PWGDQ/Tasks/taskJPsiMu.cxx | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 0ad25a49f89..6fb0f2c94b3 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -150,6 +150,17 @@ struct DqJPsiMuonCorrelations { registry.add("h2dDimuonMuonDeltaPhiVsMuonPtSignal", "h2dDimuonMuonDeltaPhiVsMuonPtSignal", kTH2D, {axisDeltaPhi, axisPt}); registry.add("h2dDimuonMuonDeltaEtaVsMuonPtBackground", "h2dDimuonMuonDeltaEtaVsMuonPtBackground", kTH2D, {axisDeltaEta, axisPt}); registry.add("h2dDimuonMuonDeltaPhiVsMuonPtBackground", "h2dDimuonMuonDeltaPhiVsMuonPtBackground", kTH2D, {axisDeltaPhi, axisPt}); + + // QA histograms + registry.add("hEventPosZ", "hEventPosZ", kTH1D, {{50, -25, 25}}); + registry.add("hEventPosZDilepton", "hEventPosZDilepton", kTH1D, {{50, -25, 25}}); + registry.add("hEventPosZMuon", "hEventPosZMuon", kTH1D, {{50, -25, 25}}); + registry.add("hEventPosZMuonSel", "hEventPosZMuonSel", kTH1D, {{50, -25, 25}}); + registry.add("hEventPosZThreeMuon", "hEventPosZThreeMuon", kTH1D, {{50, -25, 25}}); + registry.add("hEventPosZThreeMuonSel", "hEventPosZThreeMuonSel", kTH1D, {{50, -25, 25}}); + + registry.add("hReducedIdMuon", "hReducedIdMuon", kTH1D, {{100, -4.0, 0.0}}); + registry.add("hReducedIdMuonSel", "hReducedIdMuonSel", kTH1D, {{100, -4.0, 0.0}}); } // Template function to run pair - muon combinations @@ -166,7 +177,38 @@ struct DqJPsiMuonCorrelations { return; } + registry.fill(HIST("hEventPosZ"), event.posZ()); + if (assocs.size() > 0) { + registry.fill(HIST("hEventPosZMuon"), event.posZ()); + + int nSelected = 0; + for (auto& assoc : assocs) { + registry.fill(HIST("hReducedIdMuon"), assoc.reducedmuonId()); + if (assoc.isMuonSelected_bit(0)) { + registry.fill(HIST("hReducedIdMuonSel"), assoc.reducedmuonId()); + nSelected++; + } + } + if (nSelected > 0) { + registry.fill(HIST("hEventPosZMuonSel"), event.posZ()); + } + } + if (assocs.size() > 2) { + registry.fill(HIST("hEventPosZThreeMuon"), event.posZ()); + + int nSelected = 0; + for (auto& assoc : assocs) { + if (assoc.isMuonSelected_bit(0)) { + nSelected++; + } + } + if (nSelected > 2) { + registry.fill(HIST("hEventPosZThreeMuonSel"), event.posZ()); + } + } if (dileptons.size() > 0) { + registry.fill(HIST("hEventPosZDilepton"), event.posZ()); + for (auto& dilepton : dileptons) { VarManager::FillTrack(dilepton, fValuesDilepton); From 31079c2bd5c79effc27483a0e9ea1c5ab7f6e93e Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 17 Jun 2026 14:20:37 +0200 Subject: [PATCH 17/22] Cleanup --- PWGDQ/Tasks/taskJPsiMu.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 6fb0f2c94b3..c58a9562553 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -215,14 +215,14 @@ struct DqJPsiMuonCorrelations { // Dilepton kinematic cuts if ((dilepton.eta() < fConfigDileptonEtaMin || dilepton.eta() > fConfigDileptonEtaMax) || (dilepton.pt() < fConfigDileptonPtMin || dilepton.pt() > fConfigDileptonPtMax)) { -continue; + continue; } // Dilepton leg kinematic cuts if ((dilepton.eta1() < fConfigMuonEtaMin || dilepton.eta1() > fConfigMuonEtaMax) || (dilepton.pt1() < axisPt.value[1] || dilepton.pt1() > axisPt.value.back()) || (dilepton.eta2() < fConfigMuonEtaMin || dilepton.eta2() > fConfigMuonEtaMax) || (dilepton.pt2() < axisPt.value[1] || dilepton.pt2() > axisPt.value.back())) { - continue; + continue; } // Fill invariant mass vs pT histogram for the dileptons and for trigger counting @@ -308,7 +308,7 @@ double getWeight(const double pT, const std::vector& pT_bins, const std: break; } } -if ((efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))) == 0) { + if ((efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))) == 0) { LOG(info) << "Efficiency correction factor is zero for pT: " << pT << ", efficiency: " << efficiency[eff_bin] << ", eta range: [" << eta_min << ", " << eta_max << "]."; } return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))); From 62e7ec8d5bdec6781d394881403c01d6d3c111a1 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 17 Jun 2026 14:25:17 +0200 Subject: [PATCH 18/22] Remove unnecessary histograms --- PWGDQ/Tasks/taskJPsiMu.cxx | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index c58a9562553..83eafe7fd8f 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -152,15 +152,7 @@ struct DqJPsiMuonCorrelations { registry.add("h2dDimuonMuonDeltaPhiVsMuonPtBackground", "h2dDimuonMuonDeltaPhiVsMuonPtBackground", kTH2D, {axisDeltaPhi, axisPt}); // QA histograms - registry.add("hEventPosZ", "hEventPosZ", kTH1D, {{50, -25, 25}}); - registry.add("hEventPosZDilepton", "hEventPosZDilepton", kTH1D, {{50, -25, 25}}); registry.add("hEventPosZMuon", "hEventPosZMuon", kTH1D, {{50, -25, 25}}); - registry.add("hEventPosZMuonSel", "hEventPosZMuonSel", kTH1D, {{50, -25, 25}}); - registry.add("hEventPosZThreeMuon", "hEventPosZThreeMuon", kTH1D, {{50, -25, 25}}); - registry.add("hEventPosZThreeMuonSel", "hEventPosZThreeMuonSel", kTH1D, {{50, -25, 25}}); - - registry.add("hReducedIdMuon", "hReducedIdMuon", kTH1D, {{100, -4.0, 0.0}}); - registry.add("hReducedIdMuonSel", "hReducedIdMuonSel", kTH1D, {{100, -4.0, 0.0}}); } // Template function to run pair - muon combinations @@ -177,37 +169,11 @@ struct DqJPsiMuonCorrelations { return; } - registry.fill(HIST("hEventPosZ"), event.posZ()); if (assocs.size() > 0) { registry.fill(HIST("hEventPosZMuon"), event.posZ()); - - int nSelected = 0; - for (auto& assoc : assocs) { - registry.fill(HIST("hReducedIdMuon"), assoc.reducedmuonId()); - if (assoc.isMuonSelected_bit(0)) { - registry.fill(HIST("hReducedIdMuonSel"), assoc.reducedmuonId()); - nSelected++; - } - } - if (nSelected > 0) { - registry.fill(HIST("hEventPosZMuonSel"), event.posZ()); - } } - if (assocs.size() > 2) { - registry.fill(HIST("hEventPosZThreeMuon"), event.posZ()); - int nSelected = 0; - for (auto& assoc : assocs) { - if (assoc.isMuonSelected_bit(0)) { - nSelected++; - } - } - if (nSelected > 2) { - registry.fill(HIST("hEventPosZThreeMuonSel"), event.posZ()); - } - } if (dileptons.size() > 0) { - registry.fill(HIST("hEventPosZDilepton"), event.posZ()); for (auto& dilepton : dileptons) { VarManager::FillTrack(dilepton, fValuesDilepton); From 7fea404df51524d68eca2722173f6c118e72f9a4 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 17 Jun 2026 14:25:38 +0200 Subject: [PATCH 19/22] Remove eff check --- PWGDQ/Tasks/taskJPsiMu.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 83eafe7fd8f..71f94a71abc 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -274,8 +274,5 @@ double getWeight(const double pT, const std::vector& pT_bins, const std: break; } } - if ((efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))) == 0) { - LOG(info) << "Efficiency correction factor is zero for pT: " << pT << ", efficiency: " << efficiency[eff_bin] << ", eta range: [" << eta_min << ", " << eta_max << "]."; - } return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))); } From 5e20d26b18fccdf429271b841d0855c595b5a1b9 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Tue, 14 Jul 2026 14:38:41 +0200 Subject: [PATCH 20/22] Revert changes to new O2 --- Common/Tools/EventSelectionModule.h | 3 +-- PWGDQ/Tasks/tableReader_withAssoc.cxx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Common/Tools/EventSelectionModule.h b/Common/Tools/EventSelectionModule.h index 8cd0ad0d5da..eb4108bf6e6 100644 --- a/Common/Tools/EventSelectionModule.h +++ b/Common/Tools/EventSelectionModule.h @@ -27,8 +27,7 @@ #include #include #include -// #include -#include +#include #include #include #include diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 89ffc55d72a..38e6a67c83a 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -30,8 +30,7 @@ #include #include #include -// #include -#include +#include #include #include #include From 2f14af7a2ac821cc7a6cd08051686a98a8c90383 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 14 Jul 2026 12:43:00 +0000 Subject: [PATCH 21/22] Please consider the following formatting changes --- PWGDQ/Tasks/taskJPsiMu.cxx | 54 ++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index 71f94a71abc..da415e1f6f3 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -53,13 +53,13 @@ namespace o2::aod namespace dqanalysisflags { -DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision -DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc) -} +DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision +DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc) +} // namespace dqanalysisflags -DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents -DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc -} +DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents +DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc +} // namespace o2::aod // Declarations of various short names using MyEvents = soa::Join; @@ -97,7 +97,7 @@ struct DqJPsiMuonCorrelations { // Configurables for histograms ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f}, "p_{T} (GeV/c)"}; ConfigurableAxis axisInvMass{"axisInvMass", {80, 1.0f, 5.0f}, "Invariant Mass (GeV/c^{2})"}; - ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI/2.0f, 3.0f*constants::math::PI/2.0f}, "#Delta#phi (rad)"}; + ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI / 2.0f, 3.0f * constants::math::PI / 2.0f}, "#Delta#phi (rad)"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {10, -2.0f, 2.0f}, "#Delta#eta"}; // Configurable for acceptance efficiency correction @@ -115,7 +115,7 @@ struct DqJPsiMuonCorrelations { // Define the filter for the dileptons Filter dileptonFilter = aod::reducedpair::sign == 0; - constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map + constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map // use two values array to avoid mixing up the quantities float* fValuesDilepton; @@ -130,9 +130,9 @@ struct DqJPsiMuonCorrelations { ccdb->setCreatedNotAfter(nolaterthan.value); // Assert correct size of the efficiency correction vector - if (axisPt.value.size()-2 != fConfigBinEffJPsi.value.size() || axisPt.value.size()-2 != fConfigBinEffMuon.value.size()) { + if (axisPt.value.size() - 2 != fConfigBinEffJPsi.value.size() || axisPt.value.size() - 2 != fConfigBinEffMuon.value.size()) { LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEffJPsi: %zu and fConfigBinEffMuon: %zu (excluding 'VARIABLE_WIDTH' entry)", - axisPt.value.size()-1, fConfigBinEffJPsi.value.size(), fConfigBinEffMuon.value.size()); + axisPt.value.size() - 1, fConfigBinEffJPsi.value.size(), fConfigBinEffMuon.value.size()); } // Set up varmanager variable names @@ -188,7 +188,7 @@ struct DqJPsiMuonCorrelations { (dilepton.pt1() < axisPt.value[1] || dilepton.pt1() > axisPt.value.back()) || (dilepton.eta2() < fConfigMuonEtaMin || dilepton.eta2() > fConfigMuonEtaMax) || (dilepton.pt2() < axisPt.value[1] || dilepton.pt2() > axisPt.value.back())) { - continue; + continue; } // Fill invariant mass vs pT histogram for the dileptons and for trigger counting @@ -198,7 +198,7 @@ struct DqJPsiMuonCorrelations { registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt(), w_dilepton); for (auto& assoc : assocs) { - // Check selection bit + // Check selection bit if (!assoc.isMuonSelected_bit(0)) { continue; } @@ -220,9 +220,9 @@ struct DqJPsiMuonCorrelations { // Compute deltaEta and deltaPhi between the dilepton and the associated muon float deltaEta = dilepton.eta() - track.eta(); float deltaPhi = dilepton.phi() - track.phi(); - if (deltaPhi < -constants::math::PI/2.0f) { + if (deltaPhi < -constants::math::PI / 2.0f) { deltaPhi += 2.0f * constants::math::PI; - } else if (deltaPhi > constants::math::PI*3.0f/2.0f) { + } else if (deltaPhi > constants::math::PI * 3.0f / 2.0f) { deltaPhi -= 2.0f * constants::math::PI; } @@ -259,20 +259,22 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc)}; } -double getRapidity(const double pT, const double eta) { - double mJPsi = 3.096916; // J/Psi mass in GeV/c^2 - return log((sqrt(pow(mJPsi, 2) + (pow(pT, 2) * pow(cosh(eta), 2))) + pT * sinh(eta)) / (sqrt(pow(mJPsi, 2) + pow(pT, 2)))); +double getRapidity(const double pT, const double eta) +{ + double mJPsi = 3.096916; // J/Psi mass in GeV/c^2 + return log((sqrt(pow(mJPsi, 2) + (pow(pT, 2) * pow(cosh(eta), 2))) + pT * sinh(eta)) / (sqrt(pow(mJPsi, 2) + pow(pT, 2)))); } -double getWeight(const double pT, const std::vector& pT_bins, const std::vector& efficiency, const double eta_min, const double eta_max) { +double getWeight(const double pT, const std::vector& pT_bins, const std::vector& efficiency, const double eta_min, const double eta_max) +{ - int eff_bin = -1; - for (size_t b = 0; b < pT_bins.size() - 1; ++b) { - // Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration - if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) { - eff_bin = b; - break; - } + int eff_bin = -1; + for (size_t b = 0; b < pT_bins.size() - 1; ++b) { + // Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration + if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) { + eff_bin = b; + break; } - return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))); + } + return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min))); } From 670d4268ab9a00439f8f61647d7874f818afc211 Mon Sep 17 00:00:00 2001 From: Kaare Endrup Date: Wed, 15 Jul 2026 15:51:43 +0200 Subject: [PATCH 22/22] Remove unused includes, change int type --- PWGDQ/Tasks/taskJPsiMu.cxx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/PWGDQ/Tasks/taskJPsiMu.cxx b/PWGDQ/Tasks/taskJPsiMu.cxx index da415e1f6f3..31c85381deb 100644 --- a/PWGDQ/Tasks/taskJPsiMu.cxx +++ b/PWGDQ/Tasks/taskJPsiMu.cxx @@ -11,8 +11,6 @@ /// @author Kaare Endrup Iversen // Contact: iarsene@cern.ch, i.c.arsene@fys.uio.no // -#include "PWGDQ/Core/AnalysisCompositeCut.h" -#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/VarManager.h" #include "PWGDQ/DataModel/ReducedInfoTables.h" @@ -21,22 +19,15 @@ #include #include #include -#include #include #include #include #include -#include #include -#include - -#include - #include #include #include -#include #include #include @@ -269,7 +260,7 @@ double getWeight(const double pT, const std::vector& pT_bins, const std: { int eff_bin = -1; - for (size_t b = 0; b < pT_bins.size() - 1; ++b) { + for (uint8_t b = 0; b < pT_bins.size() - 1; ++b) { // Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) { eff_bin = b;