From 054984c0c44c842d7a653e37c296165ae657fa6a Mon Sep 17 00:00:00 2001 From: joachimckh Date: Tue, 20 Oct 2026 20:30:08 +0200 Subject: [PATCH 1/3] minimum pT hat feature in jetSpectraEseTask --- PWGJE/Tasks/jetSpectraEseTask.cxx | 38 ++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/PWGJE/Tasks/jetSpectraEseTask.cxx b/PWGJE/Tasks/jetSpectraEseTask.cxx index a170ea714f3..9db52502aba 100644 --- a/PWGJE/Tasks/jetSpectraEseTask.cxx +++ b/PWGJE/Tasks/jetSpectraEseTask.cxx @@ -92,6 +92,7 @@ struct JetSpectraEseTask { Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatAbsoluteMin{"pTHatAbsoluteMin", -99.0f, "minimum value of pTHat"}; Configurable fLeadJetPtCut{"fLeadJetPtCut", false, "Flag for leading jet pT cut"}; Configurable leadJetPtMin{"leadJetPtMin", 20.0, "minimum leading jet pT cut"}; @@ -540,9 +541,13 @@ struct JetSpectraEseTask { registry.add("h3CentdeltapTRndmConePhi_localrhovsphi", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {dPhiAxis}}}); registry.add("h3CentdeltapTRndmConePhi_rhovsphi", "centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho}; #Delta#varphi_{jet}", {HistType::kTH3F, {{100, 0.0, 100.0}, {400, -200.0, 200.0}, {dPhiAxis}}}); } + // Normalize MC spectra with hUsedEventWeights bin 1 content, not GetEntries(). if (doprocessMCParticleLevel) { LOGF(info, "JetSpectraEseTask::init() - MC Particle level"); registry.add("mcp/hEventCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.add("mcp/hUsedEventWeights", "Used MC collisions;Used events;Sum of event weights", {HistType::kTH1D, {{1, 0.0, 1.0}}}); + registry.get(HIST("mcp/hUsedEventWeights"))->Sumw2(); + registry.get(HIST("mcp/hUsedEventWeights"))->GetXaxis()->SetBinLabel(1, "Sum of weights of used events"); registry.add("mcp/hCentralitySel", ";centr;entries", {HistType::kTH1F, {{centAxis}}}); // registry.add("mcp/hJetSparse", ";Centrality;#it{p}_{T,jet part}; #eta; #phi", {HistType::kTHnSparseF, {{centAxis}, {jetPtAxis}, {etaAxis}, {phiAxis}}}); registry.add("mcp/hJetSparse", ";Centrality;#it{p}_{T,jet part}; #eta; #phi", {HistType::kTHnSparseF, {{centAxis}, {jetPtAxis}, {etaAxis}, {phiAxis}}}); @@ -560,6 +565,9 @@ struct JetSpectraEseTask { if (doprocessMCDetectorLevel) { LOGF(info, "JetSpectraEseTask::init() - MC Detector level"); registry.add("mcd/hEventCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.add("mcd/hUsedEventWeights", "Used reconstructed collisions;Used events;Sum of event weights", {HistType::kTH1D, {{1, 0.0, 1.0}}}); + registry.get(HIST("mcd/hUsedEventWeights"))->Sumw2(); + registry.get(HIST("mcd/hUsedEventWeights"))->GetXaxis()->SetBinLabel(1, "Sum of weights of used events"); registry.add("mcd/hCentralitySel", ";centr;entries", {HistType::kTH1F, {{centAxis}}}); // registry.add("mcd/hJetPt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); // registry.add("mcd/hJetSparse", ";Centrality;#it{p}_{T,jet det}; #eta; #phi", {HistType::kTHnSparseF, {{centAxis}, {jetPtAxis}, {etaAxis}, {phiAxis}}}); @@ -582,6 +590,9 @@ struct JetSpectraEseTask { registry.add("mcm/hMCEventCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); registry.add("mcm/hMCDMatchedEventCounter", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.add("mcm/hUsedEventWeights", "Used reconstructed collisions with exactly one reconstructed collision per MC collision;Used events;Sum of event weights", {HistType::kTH1D, {{1, 0.0, 1.0}}}); + registry.get(HIST("mcm/hUsedEventWeights"))->Sumw2(); + registry.get(HIST("mcm/hUsedEventWeights"))->GetXaxis()->SetBinLabel(1, "Sum of weights of used events"); registry.add("mcm/hCentralityAnalyzed", ";Centrality;entries", {HistType::kTH1F, {{centAxis}}}); registry.add("mcm/hMatchedJetsPtDelta", "#it{p}_{T,jet part}; det - part", {HistType::kTH2F, {{jetPtAxis}, {100, -20., 20.0}}}); @@ -1184,6 +1195,9 @@ struct JetSpectraEseTask { registry.fill(HIST("mcp/hCentralitySel"), centrality); const float eventWeight = cfgUseMCEventWeights ? mcCollision.weight() : 1.0f; const float pTHat = getPTHat(eventWeight); + if (!(pTHat < pTHatAbsoluteMin)) { + registry.fill(HIST("mcp/hUsedEventWeights"), 0.5, eventWeight); + } jetLoopMCP(jets, centrality, mcCollision.rho(), eventWeight, pTHat); } PROCESS_SWITCH(JetSpectraEseTask, processMCParticleLevel, "jets on particle level MC", false); @@ -1191,7 +1205,8 @@ struct JetSpectraEseTask { void processMCDetectorLevel(soa::Filtered>::iterator const& collision, ChargedMCDJets const& mcdjets, aod::JetTracks const&, - aod::JetParticles const&) + aod::JetParticles const&, + aod::JetMcCollisions const&) { float counter{0.5f}; registry.fill(HIST("mcd/hEventCounter"), counter++); @@ -1212,6 +1227,15 @@ struct JetSpectraEseTask { auto centrality = cfgisPbPb ? getCentrality(collision) : -1; registry.fill(HIST("mcd/hCentralitySel"), centrality); + float eventWeight = 1.0f; + if (cfgUseMCEventWeights) { + // The jet weight producer uses the same MC weight, stored as zero for collisions without an MC association. + eventWeight = collision.has_mcCollision() ? collision.mcCollision_as().weight() : 0.0f; + } + const float pTHat = getPTHat(eventWeight); + if (!(pTHat < pTHatAbsoluteMin)) { + registry.fill(HIST("mcd/hUsedEventWeights"), 0.5, eventWeight); + } jetLoopMCD(mcdjets, centrality, collision.rho()); } PROCESS_SWITCH(JetSpectraEseTask, processMCDetectorLevel, "jets on detector level", false); @@ -1264,6 +1288,9 @@ struct JetSpectraEseTask { registry.fill(HIST("mcm/hCentralityAnalyzed"), centrality); float eventWeight = cfgUseMCEventWeights ? mcCol.weight() : 1.0; float pTHat = getPTHat(eventWeight); + if (!(pTHat < pTHatAbsoluteMin)) { + registry.fill(HIST("mcm/hUsedEventWeights"), 0.5, eventWeight); + } matchedJetLoop(mcdjets.sliceBy(mcdjetsPerJCollision, collision.globalIndex()), centrality, collision.rho(), mcCol.rho(), eventWeight, pTHat); registry.fill(HIST("mcm/hMCDMatchedEventCounter"), secCount++); @@ -1914,6 +1941,9 @@ struct JetSpectraEseTask { weight = jet.eventWeight(); } const float pTHat = getPTHat(weight); + if (pTHat < pTHatAbsoluteMin) { + continue; + } if (jet.pt() > pTHatMaxMCD * pTHat) { continue; } @@ -1924,6 +1954,9 @@ struct JetSpectraEseTask { template void jetLoopMCP(const Jets& jets, const float& centrality, const float& rho, float weight = 1.0f, float pTHat = 999.0f) { + if (pTHat < pTHatAbsoluteMin) { + return; + } bool mcLevelIsParticleLevel = true; for (const auto& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, cfgJetEta->at(0), cfgJetEta->at(1), trackCuts.trackEtaMin, trackCuts.trackEtaMax)) { @@ -1946,6 +1979,9 @@ struct JetSpectraEseTask { template void matchedJetLoop(const Jets& jets, const float& centrality, const float& rho, const float& rho2, float weight = 1.0, float pTHat = 999.0) { + if (pTHat < pTHatAbsoluteMin) { + return; + } for (const auto& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, cfgJetEta->at(0), cfgJetEta->at(1), trackCuts.trackEtaMin, trackCuts.trackEtaMax)) { continue; From f0ef07311068437bec6b61080744f3f5daf2a99d Mon Sep 17 00:00:00 2001 From: joachimckh Date: Tue, 20 Oct 2026 20:33:12 +0200 Subject: [PATCH 2/3] remove comment --- PWGJE/Tasks/jetSpectraEseTask.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGJE/Tasks/jetSpectraEseTask.cxx b/PWGJE/Tasks/jetSpectraEseTask.cxx index 9db52502aba..b7f2cebb3e7 100644 --- a/PWGJE/Tasks/jetSpectraEseTask.cxx +++ b/PWGJE/Tasks/jetSpectraEseTask.cxx @@ -1229,7 +1229,6 @@ struct JetSpectraEseTask { registry.fill(HIST("mcd/hCentralitySel"), centrality); float eventWeight = 1.0f; if (cfgUseMCEventWeights) { - // The jet weight producer uses the same MC weight, stored as zero for collisions without an MC association. eventWeight = collision.has_mcCollision() ? collision.mcCollision_as().weight() : 0.0f; } const float pTHat = getPTHat(eventWeight); From 9d566d16786524da172121e8097972f73f1c2263 Mon Sep 17 00:00:00 2001 From: joachimckh Date: Wed, 21 Oct 2026 09:51:40 +0200 Subject: [PATCH 3/3] safe against 0/inf weights --- PWGJE/Tasks/jetSpectraEseTask.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGJE/Tasks/jetSpectraEseTask.cxx b/PWGJE/Tasks/jetSpectraEseTask.cxx index b7f2cebb3e7..bdfd26ae586 100644 --- a/PWGJE/Tasks/jetSpectraEseTask.cxx +++ b/PWGJE/Tasks/jetSpectraEseTask.cxx @@ -1229,7 +1229,10 @@ struct JetSpectraEseTask { registry.fill(HIST("mcd/hCentralitySel"), centrality); float eventWeight = 1.0f; if (cfgUseMCEventWeights) { - eventWeight = collision.has_mcCollision() ? collision.mcCollision_as().weight() : 0.0f; + eventWeight = collision.has_mcCollision() ? collision.mcCollision_as().weight() : -1.0f; + } + if (eventWeight <= 0.0f) { + return; } const float pTHat = getPTHat(eventWeight); if (!(pTHat < pTHatAbsoluteMin)) {