From 14410d74bc8c58e5c2cc267941d00be133b6dbe1 Mon Sep 17 00:00:00 2001 From: ariffero Date: Wed, 7 Jan 2026 18:10:13 +0100 Subject: [PATCH 01/13] Change V0A veto: veto only sel BC --- PWGUD/Tasks/FwdMuonsUPC.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index b3351965727..89d4de9776f 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -531,7 +531,7 @@ struct FwdMuonsUPC { 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 (std::abs(ampsRelBCsV0A[i]) <= 0) { if (ampsV0A[i] > kMaxAmpV0A) return; } @@ -774,7 +774,7 @@ struct FwdMuonsUPC { 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 (std::abs(ampsRelBCsV0A[i]) <= 0) { if (ampsV0A[i] > kMaxAmpV0A) return; } From 189d42375fe8a6afd39e190f34473ecd8638e93c Mon Sep 17 00:00:00 2001 From: ariffero Date: Tue, 31 Mar 2026 12:23:19 +0200 Subject: [PATCH 02/13] Remove histos and add checks on two-trakcs cand in FwdMuonsUPC --- PWGUD/Tasks/FwdMuonsUPC.cxx | 293 +++++++----------------------------- 1 file changed, 54 insertions(+), 239 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index 89d4de9776f..248facf6537 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -16,28 +16,17 @@ /// \author Andrea Giovanni Riffero +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" #include "PWGUD/DataModel/UDTables.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include +#include "TLorentzVector.h" +#include "TRandom3.h" // table for saving tree with info on data namespace dimu @@ -183,7 +172,6 @@ const int kReqMatchMIDTracks = 2; const int kReqMatchMFTTracks = 2; const int kMaxChi2MFTMatch = 30; const float kMaxZDCTime = 2.; -const float kMaxZDCTimeHisto = 10.; const int kMuonPDG = 13; struct FwdMuonsUPC { @@ -201,11 +189,6 @@ struct FwdMuonsUPC { // defining histograms using histogram registry: different histos for the different process functions HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry reg0n0n{"reg0n0n", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry regXn0n{"regXn0n", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry regXnXn{"regXnXn", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry mcGenRegistry{"mcGenRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - HistogramRegistry mcRecoRegistry{"mcRecoRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // CONFIGURABLES static constexpr double Pi = o2::constants::math::PI; @@ -217,34 +200,10 @@ struct FwdMuonsUPC { 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"}; - // pT of single muons - Configurable nBinsPtSingle{"nBinsPtSingle", 500, "N bins in pT histo single muon"}; - Configurable lowPtSingle{"lowPtSingle", 0., "lower limit in pT histo single muon"}; - Configurable highPtSingle{"highPtSingle", 2., "upper limit in pT histo single muon"}; - // eta of single muons - Configurable nBinsEtaSingle{"nBinsEtaSingle", 250, "N bins in eta histo single muon"}; - Configurable lowEtaSingle{"lowEtaSingle", -4.5, "lower limit in eta histo single muon"}; - Configurable highEtaSingle{"highEtaSingle", -2., "upper limit in eta histo single muon"}; - // phi of single muons - Configurable nBinsPhiSingle{"nBinsPhiSingle", 600, "N bins in phi histo single muon"}; - Configurable lowPhiSingle{"lowPhiSingle", -Pi, "lower limit in phi histo single muon"}; - Configurable highPhiSingle{"highPhiSingle", Pi, "upper limit in phi histo single muon"}; - // ZDC - Configurable nBinsZDCen{"nBinsZDCen", 200, "N bins in ZN energy"}; - Configurable lowEnZN{"lowEnZN", -50., "lower limit in ZN energy histo"}; - Configurable highEnZN{"highEnZN", 250., "upper limit in ZN energy histo"}; // my track type // 0 = MCH-MID-MFT // 1 = MCH-MID @@ -271,103 +230,14 @@ struct FwdMuonsUPC { // axis const AxisSpec axisPt{nBinsPt, lowPt, highPt, "#it{p}_{T} GeV/#it{c}"}; const AxisSpec axisPtFit = {ptFitBinning, "#it{p}_{T} (GeV/c)"}; - const AxisSpec axisPtFit2 = {ptFitBinningHalfWidth, "#it{p}_{T} (GeV/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"}; - const AxisSpec axisPtSingle{nBinsPtSingle, lowPtSingle, highPtSingle, "#it{p}_{T}_{ trk} GeV/#it{c}"}; - const AxisSpec axisTimeZN{200, -10, 10, "ZDC time (ns)"}; - const AxisSpec axisEnergyZNA{nBinsZDCen, lowEnZN, highEnZN, "ZNA energy (TeV)"}; - const AxisSpec axisEnergyZNC{nBinsZDCen, lowEnZN, highEnZN, "ZNC energy (TeV)"}; - const AxisSpec axisEtaSingle{nBinsEtaSingle, lowEtaSingle, highEtaSingle, "#eta_{trk}"}; - const AxisSpec axisPhiSingle{nBinsPhiSingle, lowPhiSingle, highPhiSingle, "#varphi_{trk}"}; // 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("hPtFit", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPtFit}); - registry.add("hPtFit2", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPtFit2}); - 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}); - registry.add("hCharge", "Charge;;;#counts", kTH1D, {{5, -2.5, 2.5}}); - registry.add("hContrib", "hContrib;;#counts", kTH1D, {{6, -0.5, 5.5}}); - registry.add("hEvSign", "Sum of the charges of all the tracks in each event;;#counts", kTH1D, {{5, -2.5, 2.5}}); - registry.add("hPtTrkPos", "Pt of positive muons;;#counts", kTH1D, {axisPtSingle}); - registry.add("hPtTrkNeg", "Pt of negative muons;;#counts", kTH1D, {axisPtSingle}); - registry.add("hEtaTrkPos", "#eta of positive muons;;#counts", kTH1D, {axisEtaSingle}); - registry.add("hEtaTrkNeg", "#eta of negative muons;;#counts", kTH1D, {axisEtaSingle}); - registry.add("hPhiTrkPos", "#varphi of positive muons;;#counts", kTH1D, {axisPhiSingle}); - registry.add("hPhiTrkNeg", "#varphi of negative muons;;#counts", kTH1D, {axisPhiSingle}); - registry.add("hSameSign", "hSameSign;;#counts", kTH1D, {{6, -0.5, 5.5}}); - registry.add("hPhiCharge", "#phi #it{charge}", kTH1D, {axisPhi}); - registry.add("hPhiAverage", "#phi #it{average}", kTH1D, {axisPhi}); - - // data - registry.add("hTimeZNA", "ZNA Times;;#counts", kTH1D, {axisTimeZN}); - registry.add("hTimeZNC", "ZNC Times;;#counts", kTH1D, {axisTimeZN}); - registry.add("hEnergyZN", "ZNA vs ZNC energy", kTH2D, {axisEnergyZNA, axisEnergyZNC}); - - reg0n0n.add("hMass", "Invariant mass of muon pairs - 0n0n;;#counts", kTH1D, {axisMass}); - reg0n0n.add("hPt", "Transverse momentum of muon pairs - 0n0n;;#counts", kTH1D, {axisPt}); - reg0n0n.add("hEta", "Pseudorapidty of muon pairs - 0n0n;;#counts", kTH1D, {axisEta}); - reg0n0n.add("hRapidity", "Rapidty of muon pairs - 0n0n;;#counts", kTH1D, {axisRapidity}); - reg0n0n.add("hPtFit", "Transverse momentum of muon pairs - 0n0n;;#counts", kTH1D, {axisPtFit}); - - regXn0n.add("hMass", "Invariant mass of muon pairs - Xn0n;;#counts", kTH1D, {axisMass}); - regXn0n.add("hPt", "Transverse momentum of muon pairs - Xn0n;;#counts", kTH1D, {axisPt}); - regXn0n.add("hEta", "Pseudorapidty of muon pairs - Xn0n;;#counts", kTH1D, {axisEta}); - regXn0n.add("hRapidity", "Rapidty of muon pairs - Xn0n;;#counts", kTH1D, {axisRapidity}); - regXn0n.add("hPtFit", "Transverse momentum of muon pairs - Xn0n;;#counts", kTH1D, {axisPtFit}); - - regXnXn.add("hMass", "Invariant mass of muon pairs - XnXn;;#counts", kTH1D, {axisMass}); - regXnXn.add("hPt", "Transverse momentum of muon pairs - XnXn;;#counts", kTH1D, {axisPt}); - regXnXn.add("hEta", "Pseudorapidty of muon pairs - XnXn;;#counts", kTH1D, {axisEta}); - regXnXn.add("hRapidity", "Rapidty of muon pairs - XnXn;;#counts", kTH1D, {axisRapidity}); - regXnXn.add("hPtFit", "Transverse momentum of muon pairs - XnXn;;#counts", kTH1D, {axisPtFit}); - - // gen MC - mcGenRegistry.add("hMass", "Invariant mass of muon pairs;;#counts", kTH1D, {axisMass}); - mcGenRegistry.add("hPt", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPt}); - mcGenRegistry.add("hEta", "Pseudorapidty of muon pairs;;#counts", kTH1D, {axisEta}); - mcGenRegistry.add("hRapidity", "Rapidty of muon pairs;;#counts", kTH1D, {axisRapidity}); - mcGenRegistry.add("hPhi", "#varphi of muon pairs;;#counts", kTH1D, {axisPhi}); - mcGenRegistry.add("hPtTrkPos", "Pt of positive muons;;#counts", kTH1D, {axisPtSingle}); - mcGenRegistry.add("hPtTrkNeg", "Pt of negative muons;;#counts", kTH1D, {axisPtSingle}); - mcGenRegistry.add("hEtaTrkPos", "#eta of positive muons;;#counts", kTH1D, {axisEtaSingle}); - mcGenRegistry.add("hEtaTrkNeg", "#eta of negative muons;;#counts", kTH1D, {axisEtaSingle}); - mcGenRegistry.add("hPhiTrkPos", "#varphi of positive muons;;#counts", kTH1D, {axisPhiSingle}); - mcGenRegistry.add("hPhiTrkNeg", "#varphi of negative muons;;#counts", kTH1D, {axisPhiSingle}); - mcGenRegistry.add("hPhiCharge", "#phi #it{charge}", kTH1D, {axisPhi}); - mcGenRegistry.add("hPhiAverage", "#phi #it{average}", kTH1D, {axisPhi}); - - // reco MC - mcRecoRegistry.add("hMass", "Invariant mass of muon pairs;;#counts", kTH1D, {axisMass}); - mcRecoRegistry.add("hPt", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPt}); - mcRecoRegistry.add("hPtFit", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPtFit}); - mcRecoRegistry.add("hPtFit2", "Transverse momentum of muon pairs;;#counts", kTH1D, {axisPtFit2}); - mcRecoRegistry.add("hEta", "Pseudorapidty of muon pairs;;#counts", kTH1D, {axisEta}); - mcRecoRegistry.add("hRapidity", "Rapidty of muon pairs;;#counts", kTH1D, {axisRapidity}); - mcRecoRegistry.add("hPhi", "#varphi of muon pairs;;#counts", kTH1D, {axisPhi}); - mcRecoRegistry.add("hCharge", "Charge;;;#counts", kTH1D, {{5, -2.5, 2.5}}); - mcRecoRegistry.add("hContrib", "hContrib;;#counts", kTH1D, {{6, -0.5, 5.5}}); - mcRecoRegistry.add("hEvSign", "Sum of the charges of all the tracks in each event;;#counts", kTH1D, {{5, -2.5, 2.5}}); - mcRecoRegistry.add("hPtTrkPos", "Pt of positive muons;;#counts", kTH1D, {axisPtSingle}); - mcRecoRegistry.add("hPtTrkNeg", "Pt of negative muons;;#counts", kTH1D, {axisPtSingle}); - mcRecoRegistry.add("hEtaTrkPos", "#eta of positive muons;;#counts", kTH1D, {axisEtaSingle}); - mcRecoRegistry.add("hEtaTrkNeg", "#eta of negative muons;;#counts", kTH1D, {axisEtaSingle}); - mcRecoRegistry.add("hPhiTrkPos", "#varphi of positive muons;;#counts", kTH1D, {axisPhiSingle}); - mcRecoRegistry.add("hPhiTrkNeg", "#varphi of negative muons;;#counts", kTH1D, {axisPhiSingle}); - mcRecoRegistry.add("hSameSign", "hSameSign;;#counts", kTH1D, {{6, -0.5, 5.5}}); - mcRecoRegistry.add("hPhiCharge", "#phi #it{charge}", kTH1D, {axisPhi}); - mcRecoRegistry.add("hPhiAverage", "#phi #it{average}", kTH1D, {axisPhi}); - - // corr gen-reco - mcRecoRegistry.add("hPtcorr", "gen pT vs reco pT", kTH2D, {axisPt, axisPt}); - mcRecoRegistry.add("hRapcorr", "gen rapidity vs reco rapidity", kTH2D, {axisRapidity, axisRapidity}); - mcRecoRegistry.add("hPhicorr", "gen #phi vs reco #phi", kTH2D, {axisPhi, axisPhi}); } // FUNCTIONS @@ -405,6 +275,9 @@ struct FwdMuonsUPC { if (candId < 0) { continue; } + if (std::abs(tr.pdgCode()) != kMuonPDG) { + continue; + } tracksPerCand[candId].push_back(tr.globalIndex()); } } @@ -531,15 +404,20 @@ struct FwdMuonsUPC { const auto& ampsV0A = cand.amplitudesV0A(); const auto& ampsRelBCsV0A = cand.ampRelBCsV0A(); for (unsigned int i = 0; i < ampsV0A.size(); ++i) { - if (std::abs(ampsRelBCsV0A[i]) <= 0) { + if (std::abs(ampsRelBCsV0A[i]) <= 1) { if (ampsV0A[i] > kMaxAmpV0A) return; } } + //select events with exactly 2 forward tracks + if (cand.numContrib() != 2) { + return; + } + // select opposite charge events only if (cand.netCharge() != 0) { - registry.fill(HIST("hSameSign"), cand.numContrib()); + //registry.fill(HIST("hSameSign"), cand.numContrib()); return; } @@ -602,13 +480,6 @@ struct FwdMuonsUPC { float phiCharge = 0; computePhiAnis(p1, p2, tr1.sign(), phiAverage, phiCharge); - // zdc info - if (std::abs(zdc.timeA) < kMaxZDCTimeHisto) - registry.fill(HIST("hTimeZNA"), zdc.timeA); - if (std::abs(zdc.timeC) < kMaxZDCTimeHisto) - registry.fill(HIST("hTimeZNC"), zdc.timeC); - registry.fill(HIST("hEnergyZN"), zdc.enA, zdc.enC); - // divide the events in neutron classes bool neutronA = false; bool neutronC = false; @@ -628,50 +499,20 @@ struct FwdMuonsUPC { // 0n0n if (neutronC == false && neutronA == false) { znClass = 1; - reg0n0n.fill(HIST("hMass"), p.M()); - reg0n0n.fill(HIST("hPt"), p.Pt()); - reg0n0n.fill(HIST("hPtFit"), p.Pt()); - reg0n0n.fill(HIST("hEta"), p.Eta()); - reg0n0n.fill(HIST("hRapidity"), p.Rapidity()); } else if (neutronA ^ neutronC) { // Xn0n + 0nXn if (neutronA) znClass = 2; else if (neutronC) znClass = 3; - regXn0n.fill(HIST("hMass"), p.M()); - regXn0n.fill(HIST("hPt"), p.Pt()); - regXn0n.fill(HIST("hPtFit"), p.Pt()); - regXn0n.fill(HIST("hEta"), p.Eta()); - regXn0n.fill(HIST("hRapidity"), p.Rapidity()); } else if (neutronA && neutronC) { // XnXn znClass = 4; - regXnXn.fill(HIST("hMass"), p.M()); - regXnXn.fill(HIST("hPt"), p.Pt()); - regXnXn.fill(HIST("hPtFit"), p.Pt()); - regXnXn.fill(HIST("hEta"), p.Eta()); - regXnXn.fill(HIST("hRapidity"), p.Rapidity()); } - // fill the histos without looking at neutron emission - registry.fill(HIST("hContrib"), cand.numContrib()); - registry.fill(HIST("hPtTrkPos"), p1.Pt()); - registry.fill(HIST("hPtTrkNeg"), p2.Pt()); - registry.fill(HIST("hEtaTrkPos"), p1.Eta()); - registry.fill(HIST("hEtaTrkNeg"), p2.Eta()); - registry.fill(HIST("hPhiTrkPos"), p1.Phi()); - registry.fill(HIST("hPhiTrkNeg"), p2.Phi()); - registry.fill(HIST("hEvSign"), cand.netCharge()); + // fill the histos registry.fill(HIST("hMass"), p.M()); registry.fill(HIST("hPt"), p.Pt()); registry.fill(HIST("hPtFit"), p.Pt()); - registry.fill(HIST("hPtFit2"), p.Pt()); - registry.fill(HIST("hEta"), p.Eta()); registry.fill(HIST("hRapidity"), p.Rapidity()); - registry.fill(HIST("hPhi"), p.Phi()); - registry.fill(HIST("hCharge"), tr1.sign()); - registry.fill(HIST("hCharge"), tr2.sign()); - registry.fill(HIST("hPhiAverage"), phiAverage); - registry.fill(HIST("hPhiCharge"), phiCharge); // store the event to save it into a tree if (tr1.sign() > 0) { @@ -698,8 +539,13 @@ struct FwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != kMuonPDG && std::abs(McPart2.pdgCode()) != kMuonPDG) + if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG){ LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); + return; + } + if (McPart1.pdgCode() + McPart2.pdgCode() != 0) { + return; + } // create Lorentz vectors TLorentzVector p1, p2; @@ -731,19 +577,10 @@ struct FwdMuonsUPC { computePhiAnis(p1, p2, -McPart1.pdgCode(), phiAverage, phiCharge); // fill the histos - mcGenRegistry.fill(HIST("hPtTrkPos"), p1.Pt()); - mcGenRegistry.fill(HIST("hPtTrkNeg"), p2.Pt()); - mcGenRegistry.fill(HIST("hEtaTrkPos"), p1.Eta()); - mcGenRegistry.fill(HIST("hEtaTrkNeg"), p2.Eta()); - mcGenRegistry.fill(HIST("hPhiTrkPos"), p1.Phi()); - mcGenRegistry.fill(HIST("hPhiTrkNeg"), p2.Phi()); - mcGenRegistry.fill(HIST("hMass"), p.M()); - mcGenRegistry.fill(HIST("hPt"), p.Pt()); - mcGenRegistry.fill(HIST("hEta"), p.Eta()); - mcGenRegistry.fill(HIST("hRapidity"), p.Rapidity()); - mcGenRegistry.fill(HIST("hPhi"), p.Phi()); - mcGenRegistry.fill(HIST("hPhiAverage"), phiAverage); - mcGenRegistry.fill(HIST("hPhiCharge"), phiCharge); + registry.fill(HIST("hMass"), p.M()); + registry.fill(HIST("hPt"), p.Pt()); + registry.fill(HIST("hPtFit"), p.Pt()); + registry.fill(HIST("hRapidity"), p.Rapidity()); // store the event to save it into a tree if (McPart1.pdgCode() < 0) { @@ -767,14 +604,14 @@ struct FwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != kMuonPDG && std::abs(McPart2.pdgCode()) != kMuonPDG) + if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG) LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); // 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]) <= 0) { + if (std::abs(ampsRelBCsV0A[i]) <= 1) { if (ampsV0A[i] > kMaxAmpV0A) return; } @@ -782,7 +619,7 @@ struct FwdMuonsUPC { // select opposite charge events only if (cand.netCharge() != 0) { - registry.fill(HIST("hSameSign"), cand.numContrib()); + //registry.fill(HIST("hSameSign"), cand.numContrib()); return; } @@ -854,7 +691,7 @@ struct FwdMuonsUPC { // compute gen phi for azimuth anisotropy float phiGenAverage = 0; float phiGenCharge = 0; - computePhiAnis(p1, p2, -McPart1.pdgCode(), phiGenAverage, phiGenCharge); + computePhiAnis(p1Mc, p2Mc, -McPart1.pdgCode(), phiGenAverage, phiGenCharge); // print info in case of problems if (tr1.sign() * McPart1.pdgCode() > 0 || tr2.sign() * McPart2.pdgCode() > 0) { @@ -865,46 +702,10 @@ struct FwdMuonsUPC { } // fill the histos - // reco info - mcRecoRegistry.fill(HIST("hContrib"), cand.numContrib()); - mcRecoRegistry.fill(HIST("hPtTrkPos"), p1.Pt()); - mcRecoRegistry.fill(HIST("hPtTrkNeg"), p2.Pt()); - mcRecoRegistry.fill(HIST("hEtaTrkPos"), p1.Eta()); - mcRecoRegistry.fill(HIST("hEtaTrkNeg"), p2.Eta()); - mcRecoRegistry.fill(HIST("hPhiTrkPos"), p1.Phi()); - mcRecoRegistry.fill(HIST("hPhiTrkNeg"), p2.Phi()); - mcRecoRegistry.fill(HIST("hEvSign"), cand.netCharge()); - mcRecoRegistry.fill(HIST("hMass"), p.M()); - mcRecoRegistry.fill(HIST("hPt"), p.Pt()); - mcRecoRegistry.fill(HIST("hPtFit"), p.Pt()); - mcRecoRegistry.fill(HIST("hPtFit2"), p.Pt()); - mcRecoRegistry.fill(HIST("hEta"), p.Eta()); - mcRecoRegistry.fill(HIST("hRapidity"), p.Rapidity()); - mcRecoRegistry.fill(HIST("hPhi"), p.Phi()); - mcRecoRegistry.fill(HIST("hCharge"), tr1.sign()); - mcRecoRegistry.fill(HIST("hCharge"), tr2.sign()); - mcRecoRegistry.fill(HIST("hPhiAverage"), phiAverage); - mcRecoRegistry.fill(HIST("hPhiCharge"), phiCharge); - - // gen info (of reco events) - mcGenRegistry.fill(HIST("hPtTrkPos"), p1Mc.Pt()); - mcGenRegistry.fill(HIST("hPtTrkNeg"), p2Mc.Pt()); - mcGenRegistry.fill(HIST("hEtaTrkPos"), p1Mc.Eta()); - mcGenRegistry.fill(HIST("hEtaTrkNeg"), p2Mc.Eta()); - mcGenRegistry.fill(HIST("hPhiTrkPos"), p1Mc.Phi()); - mcGenRegistry.fill(HIST("hPhiTrkNeg"), p2Mc.Phi()); - mcGenRegistry.fill(HIST("hMass"), pMc.M()); - mcGenRegistry.fill(HIST("hPt"), pMc.Pt()); - mcGenRegistry.fill(HIST("hEta"), pMc.Eta()); - mcGenRegistry.fill(HIST("hRapidity"), pMc.Rapidity()); - mcGenRegistry.fill(HIST("hPhi"), pMc.Phi()); - mcGenRegistry.fill(HIST("hPhiAverage"), phiGenAverage); - mcGenRegistry.fill(HIST("hPhiCharge"), phiGenCharge); - - // reco-gen correlations - mcRecoRegistry.fill(HIST("hPtcorr"), p.Pt(), pMc.Pt()); - mcRecoRegistry.fill(HIST("hRapcorr"), p.Rapidity(), pMc.Rapidity()); - mcRecoRegistry.fill(HIST("hPhicorr"), p.Phi(), pMc.Phi()); + registry.fill(HIST("hMass"), p.M()); + registry.fill(HIST("hPt"), p.Pt()); + registry.fill(HIST("hPtFit"), p.Pt()); + registry.fill(HIST("hRapidity"), p.Rapidity()); // store the event to save it into a tree if (tr1.sign() > 0) { @@ -946,6 +747,10 @@ struct FwdMuonsUPC { // loop over the candidates for (const auto& item : tracksPerCand) { + if (item.second.size() != 2) { + LOGF(debug, "number track = %d", item.second.size()); + continue; + } int32_t trId1 = item.second[0]; int32_t trId2 = item.second[1]; int32_t candID = item.first; @@ -973,13 +778,23 @@ struct FwdMuonsUPC { // process MC Truth void processMcGen(aod::UDMcCollisions const& mccollisions, aod::UDMcParticles const& McParts) { - // map with the tracks std::unordered_map> tracksPerCand; collectMcCandIDs(tracksPerCand, McParts); // loop over the candidates for (const auto& item : tracksPerCand) { + if (item.second.size() != 2) { + LOGF(debug, "mc parts = %d", item.second.size()); + for (auto id : item.second) { + auto p = McParts.iteratorAt(id); + LOGF(debug, + " part %d: pdg=%d status=%d has_mothers=%d has_daughters=%d", + id, p.pdgCode(), p.statusCode(), + p.has_mothers(), p.has_daughters()); + } + continue; + } int32_t trId1 = item.second[0]; int32_t trId2 = item.second[1]; int32_t candID = item.first; @@ -995,7 +810,7 @@ struct FwdMuonsUPC { // process reco MC (gen info included) void processMcReco(CandidatesFwd const& eventCandidates, CompleteFwdTracks const& fwdTracks, - aod::UDMcCollisions const&, + aod::UDMcCollisions const& /*mccollisions*/, aod::UDMcParticles const& McParts) { std::unordered_map> tracksPerCandAll; From 7a5ff14f043cb7b430564811a9a5c908181fb734 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 19 May 2026 14:58:53 +0000 Subject: [PATCH 03/13] Please consider the following formatting changes --- PWGUD/Tasks/FwdMuonsUPC.cxx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index 248facf6537..ba75cd267b0 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -16,18 +16,19 @@ /// \author Andrea Giovanni Riffero -#include -#include +#include "PWGUD/DataModel/UDTables.h" -#include "Framework/runDataProcessing.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" -#include "PWGUD/DataModel/UDTables.h" +#include "Framework/AnalysisTask.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" #include "TLorentzVector.h" #include "TRandom3.h" +#include +#include + // table for saving tree with info on data namespace dimu { @@ -410,14 +411,14 @@ struct FwdMuonsUPC { } } - //select events with exactly 2 forward tracks + // select events with exactly 2 forward tracks if (cand.numContrib() != 2) { return; } // select opposite charge events only if (cand.netCharge() != 0) { - //registry.fill(HIST("hSameSign"), cand.numContrib()); + // registry.fill(HIST("hSameSign"), cand.numContrib()); return; } @@ -539,7 +540,7 @@ struct FwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG){ + if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG) { LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); return; } @@ -619,7 +620,7 @@ struct FwdMuonsUPC { // select opposite charge events only if (cand.netCharge() != 0) { - //registry.fill(HIST("hSameSign"), cand.numContrib()); + // registry.fill(HIST("hSameSign"), cand.numContrib()); return; } From ac96e41c19440f3a17e5c6167e8248fa0dc242f0 Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 14:22:54 +0200 Subject: [PATCH 04/13] Fix o2linter warnings on TLorenzVector --- PWGUD/Tasks/FwdMuonsUPC.cxx | 76 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index ba75cd267b0..f13f4019a31 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -23,8 +23,9 @@ #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" -#include "TLorentzVector.h" #include "TRandom3.h" +#include +#include #include #include @@ -349,9 +350,9 @@ struct FwdMuonsUPC { { float rAbs = fwdTrack.rAtAbsorberEnd(); float pDca = fwdTrack.pDca(); - TLorentzVector p; auto mMu = particleMass(kMuonPDG); - p.SetXYZM(fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), mMu); + ROOT::Math::PxPyPzMVector p{fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), mMu}; + float eta = p.Eta(); float pt = p.Pt(); float pDcaMax = rAbs < kRAbsMid ? kPDca1 : kPDca2; @@ -368,9 +369,9 @@ struct FwdMuonsUPC { } // function to compute phi for azimuth anisotropy - void computePhiAnis(TLorentzVector p1, TLorentzVector p2, int sign1, float& phiAverage, float& phiCharge) + void computePhiAnis(ROOT::Math::PxPyPzMVector p1, ROOT::Math::PxPyPzMVector p2, int sign1, float& phiAverage, float& phiCharge) { - TLorentzVector tSum, tDiffAv, tDiffCh; + ROOT::Math::PxPyPzMVector tSum, tDiffAv, tDiffCh; tSum = p1 + p2; float halfUnity = 0.5; if (sign1 > 0) { @@ -388,9 +389,9 @@ struct FwdMuonsUPC { } // average - phiAverage = tSum.DeltaPhi(tDiffAv); + phiAverage = ROOT::Math::VectorUtil::DeltaPhi(tSum, tDiffAv); // charge - phiCharge = tSum.DeltaPhi(tDiffCh); + phiCharge = ROOT::Math::VectorUtil::DeltaPhi(tSum, tDiffCh); } // function that processes the candidates: @@ -453,11 +454,10 @@ struct FwdMuonsUPC { return; // form Lorentz vectors - TLorentzVector p1, p2; auto mMu = particleMass(kMuonPDG); - p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu); - p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu); - TLorentzVector p = p1 + p2; + ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), mMu}; + ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p = p1 + p2; // cut on pair kinematics // select mass @@ -520,15 +520,15 @@ struct FwdMuonsUPC { dimuSel(cand.runNumber(), p.M(), p.E(), p.Px(), p.Py(), p.Pz(), p.Pt(), p.Rapidity(), p.Phi(), phiAverage, phiCharge, - p1.E(), p1.Px(), p1.Py(), p1.Pz(), p1.Pt(), p1.PseudoRapidity(), p1.Phi(), static_cast(myTrackType), - p2.E(), p2.Px(), p2.Py(), p2.Pz(), p2.Pt(), p2.PseudoRapidity(), p2.Phi(), static_cast(myTrackType), + p1.E(), p1.Px(), p1.Py(), p1.Pz(), p1.Pt(), p1.Eta(), p1.Phi(), static_cast(myTrackType), + p2.E(), p2.Px(), p2.Py(), p2.Pz(), p2.Pt(), p2.Eta(), p2.Phi(), static_cast(myTrackType), zdc.timeA, zdc.enA, zdc.timeC, zdc.enC, znClass); } else { dimuSel(cand.runNumber(), p.M(), p.E(), p.Px(), p.Py(), p.Pz(), p.Pt(), p.Rapidity(), p.Phi(), phiAverage, phiCharge, - p2.E(), p2.Px(), p2.Py(), p2.Pz(), p2.Pt(), p2.PseudoRapidity(), p2.Phi(), static_cast(myTrackType), - p1.E(), p1.Px(), p1.Py(), p1.Pz(), p1.Pt(), p1.PseudoRapidity(), p1.Phi(), static_cast(myTrackType), + p2.E(), p2.Px(), p2.Py(), p2.Pz(), p2.Pt(), p2.Eta(), p2.Phi(), static_cast(myTrackType), + p1.E(), p1.Px(), p1.Py(), p1.Pz(), p1.Pt(), p1.Eta(), p1.Phi(), static_cast(myTrackType), zdc.timeA, zdc.enA, zdc.timeC, zdc.enC, znClass); } } @@ -549,11 +549,10 @@ struct FwdMuonsUPC { } // create Lorentz vectors - TLorentzVector p1, p2; auto mMu = particleMass(kMuonPDG); - p1.SetXYZM(McPart1.px(), McPart1.py(), McPart1.pz(), mMu); - p2.SetXYZM(McPart2.px(), McPart2.py(), McPart2.pz(), mMu); - TLorentzVector p = p1 + p2; + ROOT::Math::PxPyPzMVector p1{McPart1.px(), McPart1.py(), McPart1.pz(), mMu}; + ROOT::Math::PxPyPzMVector p2{McPart2.px(), McPart2.py(), McPart2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p = p1 + p2; // cut on pair kinematics // select mass @@ -587,13 +586,13 @@ struct FwdMuonsUPC { if (McPart1.pdgCode() < 0) { dimuGen(p.M(), p.Pt(), p.Rapidity(), p.Phi(), phiAverage, phiCharge, - p1.Pt(), p1.PseudoRapidity(), p1.Phi(), - p2.Pt(), p2.PseudoRapidity(), p2.Phi()); + p1.Pt(), p1.Eta(), p1.Phi(), + p2.Pt(), p2.Eta(), p2.Phi()); } else { dimuGen(p.M(), p.Pt(), p.Rapidity(), p.Phi(), phiAverage, phiCharge, - p2.Pt(), p2.PseudoRapidity(), p2.Phi(), - p1.Pt(), p1.PseudoRapidity(), p1.Phi()); + p2.Pt(), p2.Eta(), p2.Phi(), + p1.Pt(), p1.Eta(), p1.Phi()); } } @@ -655,11 +654,10 @@ struct FwdMuonsUPC { return; // form Lorentz vectors - TLorentzVector p1, p2; auto mMu = particleMass(kMuonPDG); - p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), mMu); - p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), mMu); - TLorentzVector p = p1 + p2; + ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), mMu}; + ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p = p1 + p2; // cut on pair kinematics (reco candidates) // select mass @@ -683,11 +681,9 @@ struct FwdMuonsUPC { float phiCharge = 0; computePhiAnis(p1, p2, tr1.sign(), phiAverage, phiCharge); - // gen particle - TLorentzVector p1Mc, p2Mc; - p1Mc.SetXYZM(McPart1.px(), McPart1.py(), McPart1.pz(), mMu); - p2Mc.SetXYZM(McPart2.px(), McPart2.py(), McPart2.pz(), mMu); - TLorentzVector pMc = p1Mc + p2Mc; + ROOT::Math::PxPyPzMVector p1Mc{McPart1.px(), McPart1.py(), McPart1.pz(), mMu}; + ROOT::Math::PxPyPzMVector p2Mc{McPart2.px(), McPart2.py(), McPart2.pz(), mMu}; + ROOT::Math::PxPyPzMVector pMc = p2Mc + p2Mc; // compute gen phi for azimuth anisotropy float phiGenAverage = 0; @@ -713,22 +709,22 @@ struct FwdMuonsUPC { dimuReco(cand.runNumber(), p.M(), p.Pt(), p.Rapidity(), p.Phi(), phiAverage, phiCharge, - p1.Pt(), p1.PseudoRapidity(), p1.Phi(), static_cast(myTrackType), - p2.Pt(), p2.PseudoRapidity(), p2.Phi(), static_cast(myTrackType), + p1.Pt(), p1.Eta(), p1.Phi(), static_cast(myTrackType), + p2.Pt(), p2.Eta(), p2.Phi(), static_cast(myTrackType), // gen info pMc.Pt(), pMc.Rapidity(), pMc.Phi(), - p1Mc.Pt(), p1Mc.PseudoRapidity(), p1Mc.Phi(), - p2Mc.Pt(), p2Mc.PseudoRapidity(), p2Mc.Phi()); + p1Mc.Pt(), p1Mc.Eta(), p1Mc.Phi(), + p2Mc.Pt(), p2Mc.Eta(), p2Mc.Phi()); } else { dimuReco(cand.runNumber(), p.M(), p.Pt(), p.Rapidity(), p.Phi(), phiAverage, phiCharge, - p2.Pt(), p2.PseudoRapidity(), p2.Phi(), static_cast(myTrackType), - p1.Pt(), p1.PseudoRapidity(), p1.Phi(), static_cast(myTrackType), + p2.Pt(), p2.Eta(), p2.Phi(), static_cast(myTrackType), + p1.Pt(), p1.Eta(), p1.Phi(), static_cast(myTrackType), // gen info pMc.Pt(), pMc.Rapidity(), pMc.Phi(), - p2Mc.Pt(), p2Mc.PseudoRapidity(), p2Mc.Phi(), - p1Mc.Pt(), p1Mc.PseudoRapidity(), p1Mc.Phi()); + p2Mc.Pt(), p2Mc.Eta(), p2Mc.Phi(), + p1Mc.Pt(), p1Mc.Eta(), p1Mc.Phi()); } } From d99a3edfbf8cb6287be732aa184a4dac9c8ff013 Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 15:19:34 +0200 Subject: [PATCH 05/13] Fix o2 linter warnings on pgd --- PWGUD/Tasks/FwdMuonsUPC.cxx | 41 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index f13f4019a31..36844592c47 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -16,6 +16,7 @@ /// \author Andrea Giovanni Riffero +#include "CommonConstants/PhysicsConstants.h" #include "PWGUD/DataModel/UDTables.h" #include "Framework/AnalysisDataModel.h" @@ -26,6 +27,7 @@ #include "TRandom3.h" #include #include +#include #include #include @@ -174,13 +176,9 @@ const int kReqMatchMIDTracks = 2; const int kReqMatchMFTTracks = 2; const int kMaxChi2MFTMatch = 30; const float kMaxZDCTime = 2.; -const int kMuonPDG = 13; struct FwdMuonsUPC { - // a pdg object - Service pdg; - using CandidatesFwd = soa::Join; using ForwardTracks = soa::Join; using CompleteFwdTracks = soa::Join; @@ -244,13 +242,6 @@ struct FwdMuonsUPC { // FUNCTIONS - // retrieve particle mass (GeV/c^2) from TDatabasePDG - float particleMass(int pid) - { - auto mass = pdg->Mass(pid); - return mass; - } - // 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) @@ -277,7 +268,7 @@ struct FwdMuonsUPC { if (candId < 0) { continue; } - if (std::abs(tr.pdgCode()) != kMuonPDG) { + if (std::abs(tr.pdgCode()) != PDG_t::kMuonMinus) { continue; } tracksPerCand[candId].push_back(tr.globalIndex()); @@ -350,8 +341,7 @@ struct FwdMuonsUPC { { float rAbs = fwdTrack.rAtAbsorberEnd(); float pDca = fwdTrack.pDca(); - auto mMu = particleMass(kMuonPDG); - ROOT::Math::PxPyPzMVector p{fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), mMu}; + ROOT::Math::PxPyPzMVector p{fwdTrack.px(), fwdTrack.py(), fwdTrack.pz(), o2::constants::physics::MassMuon}; float eta = p.Eta(); float pt = p.Pt(); @@ -454,9 +444,8 @@ struct FwdMuonsUPC { return; // form Lorentz vectors - auto mMu = particleMass(kMuonPDG); - ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), mMu}; - ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassMuon}; + ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassMuon}; ROOT::Math::PxPyPzMVector p = p1 + p2; // cut on pair kinematics @@ -540,7 +529,7 @@ struct FwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG) { + if (std::abs(McPart1.pdgCode()) != PDG_t::kMuonMinus || std::abs(McPart2.pdgCode()) != PDG_t::kMuonMinus) { LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); return; } @@ -549,9 +538,8 @@ struct FwdMuonsUPC { } // create Lorentz vectors - auto mMu = particleMass(kMuonPDG); - ROOT::Math::PxPyPzMVector p1{McPart1.px(), McPart1.py(), McPart1.pz(), mMu}; - ROOT::Math::PxPyPzMVector p2{McPart2.px(), McPart2.py(), McPart2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p1{McPart1.px(), McPart1.py(), McPart1.pz(), o2::constants::physics::MassMuon}; + ROOT::Math::PxPyPzMVector p2{McPart2.px(), McPart2.py(), McPart2.pz(), o2::constants::physics::MassMuon}; ROOT::Math::PxPyPzMVector p = p1 + p2; // cut on pair kinematics @@ -604,7 +592,7 @@ struct FwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != kMuonPDG || std::abs(McPart2.pdgCode()) != kMuonPDG) + if (std::abs(McPart1.pdgCode()) != PDG_t::kMuonMinus || std::abs(McPart2.pdgCode()) != PDG_t::kMuonMinus) LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); // V0 selection @@ -654,9 +642,8 @@ struct FwdMuonsUPC { return; // form Lorentz vectors - auto mMu = particleMass(kMuonPDG); - ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), mMu}; - ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p1{tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassMuon}; + ROOT::Math::PxPyPzMVector p2{tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassMuon}; ROOT::Math::PxPyPzMVector p = p1 + p2; // cut on pair kinematics (reco candidates) @@ -681,8 +668,8 @@ struct FwdMuonsUPC { float phiCharge = 0; computePhiAnis(p1, p2, tr1.sign(), phiAverage, phiCharge); - ROOT::Math::PxPyPzMVector p1Mc{McPart1.px(), McPart1.py(), McPart1.pz(), mMu}; - ROOT::Math::PxPyPzMVector p2Mc{McPart2.px(), McPart2.py(), McPart2.pz(), mMu}; + ROOT::Math::PxPyPzMVector p1Mc{McPart1.px(), McPart1.py(), McPart1.pz(), o2::constants::physics::MassMuon}; + ROOT::Math::PxPyPzMVector p2Mc{McPart2.px(), McPart2.py(), McPart2.pz(), o2::constants::physics::MassMuon}; ROOT::Math::PxPyPzMVector pMc = p2Mc + p2Mc; // compute gen phi for azimuth anisotropy From 9f32210231183facfa62e33d9c922af1e151b5cd Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 15:38:50 +0200 Subject: [PATCH 06/13] Fix o2linter warnings on non-const iterators --- PWGUD/Tasks/FwdMuonsUPC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index 36844592c47..97f1302f52b 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -770,7 +770,7 @@ struct FwdMuonsUPC { for (const auto& item : tracksPerCand) { if (item.second.size() != 2) { LOGF(debug, "mc parts = %d", item.second.size()); - for (auto id : item.second) { + for (const auto id : item.second) { auto p = McParts.iteratorAt(id); LOGF(debug, " part %d: pdg=%d status=%d has_mothers=%d has_daughters=%d", From 099afbb9587670279f91498a488044ca3f3e6292 Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 15:42:40 +0200 Subject: [PATCH 07/13] Fix o2linter warnings on magic numbers --- PWGUD/Tasks/FwdMuonsUPC.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index 97f1302f52b..9e3a711803d 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -176,6 +176,8 @@ const int kReqMatchMIDTracks = 2; const int kReqMatchMFTTracks = 2; const int kMaxChi2MFTMatch = 30; const float kMaxZDCTime = 2.; +const int k2Tracks = 2; +const int k4Tracks = 4; struct FwdMuonsUPC { @@ -403,7 +405,7 @@ struct FwdMuonsUPC { } // select events with exactly 2 forward tracks - if (cand.numContrib() != 2) { + if (cand.numContrib() != k2Tracks) { return; } @@ -731,7 +733,7 @@ struct FwdMuonsUPC { // loop over the candidates for (const auto& item : tracksPerCand) { - if (item.second.size() != 2) { + if (item.second.size() != k2Tracks) { LOGF(debug, "number track = %d", item.second.size()); continue; } @@ -768,7 +770,7 @@ struct FwdMuonsUPC { // loop over the candidates for (const auto& item : tracksPerCand) { - if (item.second.size() != 2) { + if (item.second.size() != k2Tracks) { LOGF(debug, "mc parts = %d", item.second.size()); for (const auto id : item.second) { auto p = McParts.iteratorAt(id); @@ -802,7 +804,7 @@ struct FwdMuonsUPC { // loop over the candidates for (const auto& item : tracksPerCandAll) { - if (item.second.size() != 4) { + if (item.second.size() != k4Tracks) { LOGF(debug, "number track (reco + gen) = %d", item.second.size()); continue; } From 34518f6942df39eb5178d5eaf0f053b3cc914f7b Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 15:48:04 +0200 Subject: [PATCH 08/13] Fix o2linter warnings --- PWGUD/Tasks/FwdMuonsUPC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index 9e3a711803d..70ff0feeb52 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -772,7 +772,7 @@ struct FwdMuonsUPC { for (const auto& item : tracksPerCand) { if (item.second.size() != k2Tracks) { LOGF(debug, "mc parts = %d", item.second.size()); - for (const auto id : item.second) { + for (const auto& id : item.second) { auto p = McParts.iteratorAt(id); LOGF(debug, " part %d: pdg=%d status=%d has_mothers=%d has_daughters=%d", From 3185b13e88c98449f3eac3520c2b82246bb1cc81 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 21 May 2026 13:55:27 +0000 Subject: [PATCH 09/13] Please consider the following formatting changes --- PWGUD/Tasks/FwdMuonsUPC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index 70ff0feeb52..a4e77c91f13 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -16,9 +16,9 @@ /// \author Andrea Giovanni Riffero -#include "CommonConstants/PhysicsConstants.h" #include "PWGUD/DataModel/UDTables.h" +#include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/O2DatabasePDGPlugin.h" From 2e790ad009f9f0af61cf73041a70f51ed940f7de Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 16:24:09 +0200 Subject: [PATCH 10/13] Do not revert PR #15390 Change "" to <> in include statements --- PWGUD/Tasks/FwdMuonsUPC.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/FwdMuonsUPC.cxx index a4e77c91f13..19fe87b0648 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/FwdMuonsUPC.cxx @@ -16,15 +16,15 @@ /// \author Andrea Giovanni Riffero -#include "PWGUD/DataModel/UDTables.h" +#include -#include "CommonConstants/PhysicsConstants.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Framework/runDataProcessing.h" +#include +#include +#include +#include +#include -#include "TRandom3.h" +#include #include #include #include From 85168d22041c6f0314b8db1819954e47cf3b69a9 Mon Sep 17 00:00:00 2001 From: ariffero Date: Thu, 21 May 2026 16:27:30 +0200 Subject: [PATCH 11/13] Rename FwdMuonsUPC.cxx in fwdMuonsUPC.cxx --- PWGUD/Tasks/CMakeLists.txt | 2 +- PWGUD/Tasks/{FwdMuonsUPC.cxx => fwdMuonsUPC.cxx} | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) rename PWGUD/Tasks/{FwdMuonsUPC.cxx => fwdMuonsUPC.cxx} (99%) diff --git a/PWGUD/Tasks/CMakeLists.txt b/PWGUD/Tasks/CMakeLists.txt index b30af171280..963307998fb 100644 --- a/PWGUD/Tasks/CMakeLists.txt +++ b/PWGUD/Tasks/CMakeLists.txt @@ -200,7 +200,7 @@ o2physics_add_dpl_workflow(upc-pion-analysis COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(fwd-muons-upc - SOURCES FwdMuonsUPC.cxx + SOURCES fwdMuonsUPC.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector COMPONENT_NAME Analysis) diff --git a/PWGUD/Tasks/FwdMuonsUPC.cxx b/PWGUD/Tasks/fwdMuonsUPC.cxx similarity index 99% rename from PWGUD/Tasks/FwdMuonsUPC.cxx rename to PWGUD/Tasks/fwdMuonsUPC.cxx index 19fe87b0648..4b12e813393 100644 --- a/PWGUD/Tasks/FwdMuonsUPC.cxx +++ b/PWGUD/Tasks/fwdMuonsUPC.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file FwdMuonsUPC.cxx +/// \file fwdMuonsUPC.cxx /// \brief perform some selections on fwd events and saves the results /// executable name o2-analysis-ud-fwd-muon-upc @@ -179,7 +179,7 @@ const float kMaxZDCTime = 2.; const int k2Tracks = 2; const int k4Tracks = 4; -struct FwdMuonsUPC { +struct fwdMuonsUPC { using CandidatesFwd = soa::Join; using ForwardTracks = soa::Join; @@ -759,7 +759,7 @@ struct FwdMuonsUPC { } } - PROCESS_SWITCH(FwdMuonsUPC, processData, "", true); + PROCESS_SWITCH(fwdMuonsUPC, processData, "", true); // process MC Truth void processMcGen(aod::UDMcCollisions const& mccollisions, aod::UDMcParticles const& McParts) @@ -791,7 +791,7 @@ struct FwdMuonsUPC { processMcGenCand(cand, tr1, tr2); } } - PROCESS_SWITCH(FwdMuonsUPC, processMcGen, "", false); + PROCESS_SWITCH(fwdMuonsUPC, processMcGen, "", false); // process reco MC (gen info included) void processMcReco(CandidatesFwd const& eventCandidates, @@ -831,12 +831,12 @@ struct FwdMuonsUPC { processMcRecoCand(cand, tr1, trMc1, tr2, trMc2); } } - PROCESS_SWITCH(FwdMuonsUPC, processMcReco, "", false); + PROCESS_SWITCH(fwdMuonsUPC, processMcReco, "", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; } From 8a14a74e616b9de02ff4c96b06622813ec682b8c Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 21 May 2026 14:32:55 +0000 Subject: [PATCH 12/13] Please consider the following formatting changes --- PWGUD/Tasks/fwdMuonsUPC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGUD/Tasks/fwdMuonsUPC.cxx b/PWGUD/Tasks/fwdMuonsUPC.cxx index 4b12e813393..3430476a386 100644 --- a/PWGUD/Tasks/fwdMuonsUPC.cxx +++ b/PWGUD/Tasks/fwdMuonsUPC.cxx @@ -24,10 +24,10 @@ #include #include -#include #include #include #include +#include #include #include From 90571b97ab79428d8c7f254b2f25022f741adb34 Mon Sep 17 00:00:00 2001 From: ariffero Date: Fri, 22 May 2026 10:06:16 +0200 Subject: [PATCH 13/13] Fix warnings Warnings on: PDG codes, header brackets and header included --- PWGUD/Tasks/fwdMuonsUPC.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/PWGUD/Tasks/fwdMuonsUPC.cxx b/PWGUD/Tasks/fwdMuonsUPC.cxx index 3430476a386..0f1cc7eb6eb 100644 --- a/PWGUD/Tasks/fwdMuonsUPC.cxx +++ b/PWGUD/Tasks/fwdMuonsUPC.cxx @@ -16,9 +16,10 @@ /// \author Andrea Giovanni Riffero -#include +#include "PWGUD/DataModel/UDTables.h" #include +#include #include #include #include @@ -26,7 +27,6 @@ #include #include -#include #include #include @@ -181,6 +181,9 @@ const int k4Tracks = 4; struct fwdMuonsUPC { + // a PDG object + Service pdg; + using CandidatesFwd = soa::Join; using ForwardTracks = soa::Join; using CompleteFwdTracks = soa::Join; @@ -270,7 +273,7 @@ struct fwdMuonsUPC { if (candId < 0) { continue; } - if (std::abs(tr.pdgCode()) != PDG_t::kMuonMinus) { + if (std::abs(tr.pdgCode()) != pdg->GetParticle("mu-")->PdgCode()) { continue; } tracksPerCand[candId].push_back(tr.globalIndex()); @@ -531,7 +534,7 @@ struct fwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != PDG_t::kMuonMinus || std::abs(McPart2.pdgCode()) != PDG_t::kMuonMinus) { + if (std::abs(McPart1.pdgCode()) != pdg->GetParticle("mu-")->PdgCode() || std::abs(McPart2.pdgCode()) != pdg->GetParticle("mu-")->PdgCode()) { LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); return; } @@ -594,7 +597,7 @@ struct fwdMuonsUPC { { // check that all pairs are mu+mu- - if (std::abs(McPart1.pdgCode()) != PDG_t::kMuonMinus || std::abs(McPart2.pdgCode()) != PDG_t::kMuonMinus) + if (std::abs(McPart1.pdgCode()) != pdg->GetParticle("mu-")->PdgCode() || std::abs(McPart2.pdgCode()) != pdg->GetParticle("mu-")->PdgCode()) LOGF(debug, "PDG codes: %d | %d", McPart1.pdgCode(), McPart2.pdgCode()); // V0 selection