From 5f53db118710320755ff71efd881fab14c01577c Mon Sep 17 00:00:00 2001 From: Changhwan Choi Date: Mon, 30 Nov 2026 19:48:58 +0900 Subject: [PATCH] Revise UE subtraction of MCP b-jet analysis; Revise handling single-track jets --- PWGJE/TableProducer/jetGnnDefinition.cxx | 4 +- PWGJE/TableProducer/jetGnnInference.cxx | 12 +- PWGJE/Tasks/bjetTaggingGnn.cxx | 373 ++++++++++++----------- 3 files changed, 196 insertions(+), 193 deletions(-) diff --git a/PWGJE/TableProducer/jetGnnDefinition.cxx b/PWGJE/TableProducer/jetGnnDefinition.cxx index 4b726a09cc4..a2b32f48d72 100644 --- a/PWGJE/TableProducer/jetGnnDefinition.cxx +++ b/PWGJE/TableProducer/jetGnnDefinition.cxx @@ -171,7 +171,7 @@ struct JetGnnDefinitionTask { LOG(fatal) << "GNN definition requires jets ordered by collision with valid collision indices."; } std::vector gnnTrackIds; - if (!acceptedCollision || jet.tracksIds().size() <= 1 || !isAcceptedJet(jet)) { + if (!acceptedCollision || !isAcceptedJet(jet)) { gnnTrackIndicesTable(gnnTrackIds); continue; } @@ -181,7 +181,7 @@ struct JetGnnDefinitionTask { std::vector> trackFeatures; std::vector constituentIndices; jettaggingutilities::analyzeJetTrackInfo4GNN(jet, tracks, trackFeatures, trackPtMin, trackDcaXYMax, trackDcaZMax, nJetConst, &constituentIndices); - if (constituentIndices.size() <= 1) { + if (constituentIndices.empty()) { gnnTrackIndicesTable(gnnTrackIds); continue; } diff --git a/PWGJE/TableProducer/jetGnnInference.cxx b/PWGJE/TableProducer/jetGnnInference.cxx index 654debb7d00..60e647f1417 100644 --- a/PWGJE/TableProducer/jetGnnInference.cxx +++ b/PWGJE/TableProducer/jetGnnInference.cxx @@ -196,7 +196,7 @@ struct JetGnnInferenceTask { template void fillHistograms(Jet const& jet, float db, std::vector const* trackScores = nullptr) { - if (jet.pt() < jetPtMin) { + if (!isAcceptedJet(jet)) { return; } float dbRange; @@ -355,7 +355,7 @@ struct JetGnnInferenceTask { // Do not reapply inference-side cuts or select a different track subset. auto const gnnTracks = jet.template tracksGnn_as(); trackScores->assign(gnnTracks.size(), invalidGnnScore); - if (gnnTracks.size() < nTracksMin) { + if (gnnTracks.size() == 0 || gnnTracks.size() < nTracksMin) { return invalidGnnScore; } if (gnnTracks.size() > static_cast(nJetConst.value)) { @@ -375,12 +375,12 @@ struct JetGnnInferenceTask { LOG(fatal) << "Track-origin inference requires a task with a track prediction output."; } } else { - if (jet.tracksIds().size() <= 1 || !isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return invalidGnnScore; } jettaggingutilities::analyzeJetTrackInfo4GNN(jet, tracks, trkFeat, trackPtMin, trackDcaXYMax, trackDcaZMax, nJetConst); - if (trkFeat.size() <= 1) { - LOGF(debug, "GNN inference, fewer than two selected tracks (%d)", jet.globalIndex()); + if (trkFeat.empty() || trkFeat.size() < nTracksMin) { + LOGF(debug, "GNN inference, no selected tracks or fewer than nTracksMin (%d)", jet.globalIndex()); return invalidGnnScore; } } @@ -433,7 +433,7 @@ struct JetGnnInferenceTask { { bool acceptedCollision = isAcceptedCollision(collision); // Preserve a one-to-one positional join with Jets, including jets rejected - // by collision/jet selection or with fewer than two GNN input tracks. + // by collision/jet selection or with insufficient GNN input tracks. for (auto const& jet : jets) { if (taggingTable.lastIndex() + 1 != jet.globalIndex()) { LOG(fatal) << "GNN inference requires jets ordered by collision with valid collision indices."; diff --git a/PWGJE/Tasks/bjetTaggingGnn.cxx b/PWGJE/Tasks/bjetTaggingGnn.cxx index 8c4ed0efb44..b8822ffbc21 100644 --- a/PWGJE/Tasks/bjetTaggingGnn.cxx +++ b/PWGJE/Tasks/bjetTaggingGnn.cxx @@ -208,6 +208,8 @@ struct BjetTaggingGnn { Configurable leadingConstituentPtMax{"leadingConstituentPtMax", 9999.0, "maximum pT selection on jet constituent"}; Configurable jetAreaFractionMin{"jetAreaFractionMin", -99.0, "used to make a cut on the jet areas"}; + Configurable withSubMcp{"withSubMcp", false, "Flag whether to subtract UE for MCP jets"}; + Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; Configurable dbMin{"dbMin", -15., "minimum GNN Db"}; @@ -335,8 +337,9 @@ struct BjetTaggingGnn { const AxisSpec axisTrackpT{200, 0., 200., "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisTrackpTFine{1000, 0., 10., "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisJetpT{jetPtNbins, jetPtMin, jetPtMax, "#it{p}_{T, ch jet} (GeV/#it{c})"}; - // Used in place of axisJetpT for every "_sub"-suffixed histogram (UE-subtracted jet pT can go negative). const AxisSpec axisJetpTSub{jetPtSubNbins, jetPtSubMin, jetPtSubMax, "#it{p}_{T, ch jet}^{sub} (GeV/#it{c})"}; + // MCP pT follows withSubMcp independently of the histogram suffix selected by withSub. + const AxisSpec& axisMcpJetpT = withSubMcp ? axisJetpTSub : axisJetpT; const AxisSpec axisJetEta{200, -0.8, 0.8, "#it{#eta}_{jet}"}; const AxisSpec axisDb{200, dbMin, dbMax, "#it{D}_{b}"}; const AxisSpec axisDbFine{dbNbins, dbMin, dbMax, "#it{D}_{b}"}; @@ -507,31 +510,30 @@ struct BjetTaggingGnn { setLfMatchStatusAxisLabels(hJetpTLfmatch->GetYaxis()); registry.add("h2_jetpT_Db_lfmatched" + suffix, "lf-jet", HistType::kTH2F, {axisJetpT, axisDb}, callSumw2); registry.add("h2_jetpT_Db_lfnone" + suffix, "lf-jet", HistType::kTH2F, {axisJetpT, axisDb}, callSumw2); - auto hResponse = registry.add("h2_Response_DetjetpT_PartjetpT" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetpT}, callSumw2); - registry.add("h2_Response_DetjetpT_PartjetpT_b" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetpT}, callSumw2); - registry.add("h2_Response_DetjetpT_PartjetpT_c" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetpT}, callSumw2); - registry.add("h2_Response_DetjetpT_PartjetpT_lf" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetpT}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT" + suffix, "", HistType::kTH2F, {axisJetpT, axisMcpJetpT}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_b" + suffix, "", HistType::kTH2F, {axisJetpT, axisMcpJetpT}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_c" + suffix, "", HistType::kTH2F, {axisJetpT, axisMcpJetpT}, callSumw2); + registry.add("h2_Response_DetjetpT_PartjetpT_lf" + suffix, "", HistType::kTH2F, {axisJetpT, axisMcpJetpT}, callSumw2); registry.add("h2_jetpT_Db_npp" + suffix, "NotPhysPrim", HistType::kTH2F, {axisJetpT, axisDb}); registry.add("h2_jetpT_Db_npp_b" + suffix, "NotPhysPrim", HistType::kTH2F, {axisJetpT, axisDb}); registry.add("h2_jetpT_Db_npp_c" + suffix, "NotPhysPrim", HistType::kTH2F, {axisJetpT, axisDb}); registry.add("h2_jetpT_Db_npp_lf" + suffix, "NotPhysPrim", HistType::kTH2F, {axisJetpT, axisDb}); setJetFlavorCatAxisLabels(hJetpTFlavor->GetYaxis()); - (void)hResponse; registry.add("h_jetpT_matched" + suffix, "", HistType::kTH1F, {axisJetpT}, callSumw2); - registry.add("h_jetpT_particle_matched" + suffix, "", HistType::kTH1F, {axisJetpT}, callSumw2); + registry.add("h_jetpT_particle_matched" + suffix, "", HistType::kTH1F, {axisMcpJetpT}, callSumw2); auto hJetpTMatchedFlavor = registry.add("h2_jetpT_matched_flavor" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetFlavorCat}, callSumw2); - auto hJetpTParticleMatchedFlavor = registry.add("h2_jetpT_particle_matched_flavor" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetFlavorCat}, callSumw2); + auto hJetpTParticleMatchedFlavor = registry.add("h2_jetpT_particle_matched_flavor" + suffix, "", HistType::kTH2F, {axisMcpJetpT, axisJetFlavorCat}, callSumw2); setJetFlavorCatAxisLabels(hJetpTMatchedFlavor->GetYaxis()); setJetFlavorCatAxisLabels(hJetpTParticleMatchedFlavor->GetYaxis()); // MCP jets - registry.add("h_jetpT_particle" + suffix, "", HistType::kTH1F, {axisJetpT}, callSumw2); - auto hJetpTParticleFlavor = registry.add("h2_jetpT_particle_flavor" + suffix, "", HistType::kTH2F, {axisJetpT, axisJetFlavorCat}, callSumw2); + registry.add("h_jetpT_particle" + suffix, "", HistType::kTH1F, {axisMcpJetpT}, callSumw2); + auto hJetpTParticleFlavor = registry.add("h2_jetpT_particle_flavor" + suffix, "", HistType::kTH2F, {axisMcpJetpT, axisJetFlavorCat}, callSumw2); setJetFlavorCatAxisLabels(hJetpTParticleFlavor->GetYaxis()); // pTHat study - registry.add("hSparse_pthat_jetpT" + suffix, "", HistType::kTHnSparseF, {{300, 0., 300., "#hat{#it{p}}_{T} (GeV/#it{c})"}, axisJetpT, axisJetpT}, callSumw2); - registry.add("hSparse_pthat_jetpT_b" + suffix, "b-jet", HistType::kTHnSparseF, {{300, 0., 300., "#hat{#it{p}}_{T} (GeV/#it{c})"}, axisJetpT, axisJetpT}, callSumw2); - registry.add("hSparse_pthat_jetpT_c" + suffix, "c-jet", HistType::kTHnSparseF, {{300, 0., 300., "#hat{#it{p}}_{T} (GeV/#it{c})"}, axisJetpT, axisJetpT}, callSumw2); + registry.add("hSparse_pthat_jetpT" + suffix, "", HistType::kTHnSparseF, {{300, 0., 300., "#hat{#it{p}}_{T} (GeV/#it{c})"}, axisJetpT, axisMcpJetpT}, callSumw2); + registry.add("hSparse_pthat_jetpT_b" + suffix, "b-jet", HistType::kTHnSparseF, {{300, 0., 300., "#hat{#it{p}}_{T} (GeV/#it{c})"}, axisJetpT, axisMcpJetpT}, callSumw2); + registry.add("hSparse_pthat_jetpT_c" + suffix, "c-jet", HistType::kTHnSparseF, {{300, 0., 300., "#hat{#it{p}}_{T} (GeV/#it{c})"}, axisJetpT, axisMcpJetpT}, callSumw2); }; if (doprocessMCDJets || doprocessMCDJetsSV) { @@ -554,21 +556,20 @@ struct BjetTaggingGnn { setEvtSelStageAxisLabels(hEvtselCSub->GetYaxis(), kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } - // Used by both processMCPJets ("", axisJetpT) and processMCPJetsSub ("_sub", axisJetpTSub). - auto addMCPEvtSelHistograms = [&](const AxisSpec& axisJetpT, const std::string& suffix) { + auto addMCPEvtSelHistograms = [&](const std::string& suffix) { // All INEL/Coll/TVX/SelMC/Sel8(+Zvtx) variants collapsed onto axisEvtSelStage. - auto hEvtsel = registry.add("h2_jetpT_particle_evtsel" + suffix, "", HistType::kTH2F, {axisJetpT, axisEvtSelStage}, callSumw2); - auto hEvtselB = registry.add("h2_jetpT_particle_evtsel_b" + suffix, "particle b-jet", HistType::kTH2F, {axisJetpT, axisEvtSelStage}, callSumw2); - auto hEvtselC = registry.add("h2_jetpT_particle_evtsel_c" + suffix, "particle c-jet", HistType::kTH2F, {axisJetpT, axisEvtSelStage}, callSumw2); + auto hEvtsel = registry.add("h2_jetpT_particle_evtsel" + suffix, "", HistType::kTH2F, {axisMcpJetpT, axisEvtSelStage}, callSumw2); + auto hEvtselB = registry.add("h2_jetpT_particle_evtsel_b" + suffix, "particle b-jet", HistType::kTH2F, {axisMcpJetpT, axisEvtSelStage}, callSumw2); + auto hEvtselC = registry.add("h2_jetpT_particle_evtsel_c" + suffix, "particle c-jet", HistType::kTH2F, {axisMcpJetpT, axisEvtSelStage}, callSumw2); setEvtSelStageAxisLabels(hEvtsel->GetYaxis()); setEvtSelStageAxisLabels(hEvtselB->GetYaxis()); setEvtSelStageAxisLabels(hEvtselC->GetYaxis()); // Same as above, but the event-selection stage is evaluated on the MC-truth BC directly // (see fillMcCollCounterBC()) instead of via a matched reco collision. - auto hEvtselbc = registry.add("h2_jetpT_particle_evtselbc" + suffix, "", HistType::kTH2F, {axisJetpT, axisEvtSelStage}, callSumw2); - auto hEvtselbcB = registry.add("h2_jetpT_particle_evtselbc_b" + suffix, "particle b-jet", HistType::kTH2F, {axisJetpT, axisEvtSelStage}, callSumw2); - auto hEvtselbcC = registry.add("h2_jetpT_particle_evtselbc_c" + suffix, "particle c-jet", HistType::kTH2F, {axisJetpT, axisEvtSelStage}, callSumw2); + auto hEvtselbc = registry.add("h2_jetpT_particle_evtselbc" + suffix, "", HistType::kTH2F, {axisMcpJetpT, axisEvtSelStage}, callSumw2); + auto hEvtselbcB = registry.add("h2_jetpT_particle_evtselbc_b" + suffix, "particle b-jet", HistType::kTH2F, {axisMcpJetpT, axisEvtSelStage}, callSumw2); + auto hEvtselbcC = registry.add("h2_jetpT_particle_evtselbc_c" + suffix, "particle c-jet", HistType::kTH2F, {axisMcpJetpT, axisEvtSelStage}, callSumw2); setEvtSelStageAxisLabels(hEvtselbc->GetYaxis()); setEvtSelStageAxisLabels(hEvtselbcB->GetYaxis()); setEvtSelStageAxisLabels(hEvtselbcC->GetYaxis()); @@ -584,10 +585,10 @@ struct BjetTaggingGnn { registry.add("h_vertexZ_truth_bctvx", "Vertex Z truth (BC+TVX);#it{Z} (cm)", {HistType::kTH1F, {{100, -20.0, 20.0}}}, callSumw2); } if (doprocessMCPJets) { - addMCPEvtSelHistograms(axisJetpT, ""); + addMCPEvtSelHistograms(""); } if (doprocessMCPJetsSub) { - addMCPEvtSelHistograms(axisJetpTSub, "_sub"); + addMCPEvtSelHistograms("_sub"); } auto addDataDrivenHistograms = [&](const AxisSpec& axisJetpT, const std::string& suffix, bool mcdJetsEnabled) { @@ -675,16 +676,16 @@ struct BjetTaggingGnn { using FilteredMCPJets = soa::Filtered; template - int analyzeJetTrackInfo(AnalysisJet const& analysisJet, AnyTracks const& /*allTracks*/ /*, int8_t jetFlavor = 0, double weight = 1.0*/) + int analyzeJetTrackInfo(AnalysisJet const& jet, AnyTracks const& /*allTracks*/ /*, int8_t jetFlavor = 0, double weight = 1.0*/) { int nTracks = 0; - for (const auto& constituent : analysisJet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() < trackPtMin || !jettaggingutilities::trackAcceptanceWithDca(constituent, maxIPxy, maxIPz)) { continue; } - int sign = jettaggingutilities::getGeoSign(analysisJet, constituent); + int sign = jettaggingutilities::getGeoSign(jet, constituent); // auto origConstit = constituent.template track_as(); registry.fill(HIST("h_gnnfeat_trackpT"), constituent.pt()); @@ -797,9 +798,9 @@ struct BjetTaggingGnn { // selected SV's mass (-1 if the jet has no SV). `jetpT` is passed in already raw-or-UE-subtracted by // the caller (per `withSub`) rather than recomputed here, since this function doesn't otherwise need rho. template - float fillSVHistograms(AnalysisJet const& analysisJet, SecondaryVertices const& /*allSVs*/, float jetpT, double weightEvt = 1.0, int8_t jetFlavor = -1) + float fillSVHistograms(AnalysisJet const& jet, SecondaryVertices const& /*allSVs*/, float jetpT, double weightEvt = 1.0, int8_t jetFlavor = -1) { - auto svs = analysisJet.template secondaryVertices_as(); + auto svs = jet.template secondaryVertices_as(); if (svs.size() == 0) { // Not jet-pT-dependent (no-SV sentinel) - one shared histogram regardless of `withSub`. registry.fill(HIST("h_SVMass"), -1.f, weightEvt); @@ -858,40 +859,40 @@ struct BjetTaggingGnn { // `withSub` selects UE(rho*area)-subtracted jet pT + the "_sub"-suffixed histogram set in the single // `registry` instead of raw pT + the unsuffixed names - used by processDataJets(SV)/processDataJets(SV)Sub. template - int fillDataJetHistograms(AnalysisJet const& analysisJet, AnyTracks const& allTracks, float rho = 0.0) + int fillDataJetHistograms(AnalysisJet const& jet, AnyTracks const& allTracks, float rho = 0.0) { - int nTracks = analyzeJetTrackInfo(analysisJet, allTracks); + int nTracks = analyzeJetTrackInfo(jet, allTracks); - float jetpT = withSub ? (analysisJet.pt() - rho * analysisJet.area()) : analysisJet.pt(); + float jetpT = withSub ? (jet.pt() - rho * jet.area()) : jet.pt(); // h_jetPhi/h_jetEta/h_jetMass/h_Db/h2_nTracks_Db don't use jetpT as a fill value - one shared histogram // regardless of `withSub` (see addCoreJetHistograms()'s init() comment). Only h_jetpT/h2_jetpT_Db/ // hSparse_Incljets actually differ between the raw and Sub call, so only those get the "_sub" name. - registry.fill(HIST("h_jetPhi"), analysisJet.phi()); - registry.fill(HIST("h_jetEta"), analysisJet.eta()); - registry.fill(HIST("h_jetMass"), analysisJet.mass()); - registry.fill(HIST("h_Db"), analysisJet.scoreML()); - registry.fill(HIST("h2_nTracks_Db"), nTracks, analysisJet.scoreML()); + registry.fill(HIST("h_jetPhi"), jet.phi()); + registry.fill(HIST("h_jetEta"), jet.eta()); + registry.fill(HIST("h_jetMass"), jet.mass()); + registry.fill(HIST("h_Db"), jet.scoreML()); + registry.fill(HIST("h2_nTracks_Db"), nTracks, jet.scoreML()); if constexpr (withSub) { registry.fill(HIST("h_jetpT_sub"), jetpT); - registry.fill(HIST("h2_jetpT_Db_sub"), jetpT, analysisJet.scoreML()); + registry.fill(HIST("h2_jetpT_Db_sub"), jetpT, jet.scoreML()); if (doDataDriven && !doDataDrivenSV) { if (doDataDrivenExtra) { - registry.fill(HIST("hSparse_Incljets_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass()); + registry.fill(HIST("hSparse_Incljets_sub"), jetpT, jet.scoreML(), nTracks, jet.mass()); } else { - registry.fill(HIST("hSparse_Incljets_sub"), jetpT, analysisJet.scoreML(), nTracks); + registry.fill(HIST("hSparse_Incljets_sub"), jetpT, jet.scoreML(), nTracks); } } } else { registry.fill(HIST("h_jetpT"), jetpT); - registry.fill(HIST("h2_jetpT_Db"), jetpT, analysisJet.scoreML()); + registry.fill(HIST("h2_jetpT_Db"), jetpT, jet.scoreML()); if (doDataDriven && !doDataDrivenSV) { if (doDataDrivenExtra) { - registry.fill(HIST("hSparse_Incljets"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass()); + registry.fill(HIST("hSparse_Incljets"), jetpT, jet.scoreML(), nTracks, jet.mass()); } else { - registry.fill(HIST("hSparse_Incljets"), jetpT, analysisJet.scoreML(), nTracks); + registry.fill(HIST("hSparse_Incljets"), jetpT, jet.scoreML(), nTracks); } } } @@ -899,17 +900,17 @@ struct BjetTaggingGnn { } template - void fillDataJetHistogramsSV(AnalysisJet const& analysisJet, AnyTracks const& allTracks, AnySVs const& allSVs, float rho = 0.0) + void fillDataJetHistogramsSV(AnalysisJet const& jet, AnyTracks const& allTracks, AnySVs const& allSVs, float rho = 0.0) { - int nTracks = fillDataJetHistograms(analysisJet, allTracks, rho); - float jetpT = withSub ? (analysisJet.pt() - rho * analysisJet.area()) : analysisJet.pt(); - float massSV = fillSVHistograms(analysisJet, allSVs, jetpT); + int nTracks = fillDataJetHistograms(jet, allTracks, rho); + float jetpT = withSub ? (jet.pt() - rho * jet.area()) : jet.pt(); + float massSV = fillSVHistograms(jet, allSVs, jetpT); if (doDataDriven && doDataDrivenSV) { if constexpr (withSub) { - registry.fill(HIST("hSparse_Incljets_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV); + registry.fill(HIST("hSparse_Incljets_sub"), jetpT, jet.scoreML(), nTracks, massSV); } else { - registry.fill(HIST("hSparse_Incljets"), jetpT, analysisJet.scoreML(), nTracks, massSV); + registry.fill(HIST("hSparse_Incljets"), jetpT, jet.scoreML(), nTracks, massSV); } } } @@ -925,11 +926,11 @@ struct BjetTaggingGnn { // don't depend on the jet's own (possibly UE-subtracted) pT, so they always use the unsuffixed names // regardless of `withSub` - no "_sub" duplicates needed. template - std::pair analyzeMCDJetTrackInfo(AnalysisJet const& analysisJet, AnyTracks const& /*allTracks*/, double weightEvt = 1.0) + std::pair analyzeMCDJetTrackInfo(AnalysisJet const& jet, AnyTracks const& /*allTracks*/, double weightEvt = 1.0) { int nTracks = 0; int nNppTracks = 0; - for (const auto& constituent : analysisJet.template tracks_as()) { + for (const auto& constituent : jet.template tracks_as()) { if (constituent.pt() < trackPtMinGnn) { continue; } @@ -937,7 +938,7 @@ struct BjetTaggingGnn { ++nNppTracks; } - int sign = jettaggingutilities::getGeoSign(analysisJet, constituent); + int sign = jettaggingutilities::getGeoSign(jet, constituent); // auto origConstit = constituent.template track_as(); registry.fill(HIST("h_gnnfeat_trackpT"), constituent.pt(), weightEvt); @@ -965,158 +966,158 @@ struct BjetTaggingGnn { // `withSub` selects UE(rho*area)-subtracted jet pT + the "_sub"-suffixed histogram set, same convention as // fillDataJetHistograms(). Histograms whose value doesn't depend on jetpT are shared, unsuffixed. template - JetHistFillResult fillMCDJetHistograms(AnalysisJet const& analysisJet, AnyTracks const& allTracks, float rho = 0.f, double weightEvt = 1.0) + JetHistFillResult fillMCDJetHistograms(AnalysisJet const& jet, AnyTracks const& allTracks, float rho = 0.f, double weightEvt = 1.0) { - int8_t jetFlavor = analysisJet.origin(); - auto [nTracks, nNppTracks] = analyzeMCDJetTrackInfo(analysisJet, allTracks, weightEvt); + int8_t jetFlavor = jet.origin(); + auto [nTracks, nNppTracks] = analyzeMCDJetTrackInfo(jet, allTracks, weightEvt); - float jetpT = withSub ? (analysisJet.pt() - rho * analysisJet.area()) : analysisJet.pt(); + float jetpT = withSub ? (jet.pt() - rho * jet.area()) : jet.pt(); double flavorCat = getJetFlavorCat(jetFlavor); - registry.fill(HIST("h_jetPhi"), analysisJet.phi(), weightEvt); - registry.fill(HIST("h_jetEta"), analysisJet.eta(), weightEvt); - registry.fill(HIST("h_jetMass"), analysisJet.mass(), weightEvt); - registry.fill(HIST("h_Db"), analysisJet.scoreML(), weightEvt); - registry.fill(HIST("h2_nTracks_Db"), nTracks, analysisJet.scoreML(), weightEvt); - registry.fill(HIST("h2_Db_flavor"), analysisJet.scoreML(), flavorCat, weightEvt); + registry.fill(HIST("h_jetPhi"), jet.phi(), weightEvt); + registry.fill(HIST("h_jetEta"), jet.eta(), weightEvt); + registry.fill(HIST("h_jetMass"), jet.mass(), weightEvt); + registry.fill(HIST("h_Db"), jet.scoreML(), weightEvt); + registry.fill(HIST("h2_nTracks_Db"), nTracks, jet.scoreML(), weightEvt); + registry.fill(HIST("h2_Db_flavor"), jet.scoreML(), flavorCat, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("h2_nTracks_Db_b"), nTracks, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_nTracks_Db_b"), nTracks, jet.scoreML(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("h2_nTracks_Db_c"), nTracks, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_nTracks_Db_c"), nTracks, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_nTracks_Db_lf"), nTracks, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_nTracks_Db_lf"), nTracks, jet.scoreML(), weightEvt); } bool isLf = jetFlavor != JetTaggingSpecies::beauty && jetFlavor != JetTaggingSpecies::charm; if (isLf) { - registry.fill(HIST("h2_Db_lfmatch"), analysisJet.scoreML(), getLfMatchStatus(jetFlavor), weightEvt); + registry.fill(HIST("h2_Db_lfmatch"), jet.scoreML(), getLfMatchStatus(jetFlavor), weightEvt); } bool isNpp = static_cast(nNppTracks) / nTracks > trackNppCrit; if (isNpp) { - registry.fill(HIST("h_Db_npp"), analysisJet.scoreML(), weightEvt); - registry.fill(HIST("h2_Db_npp_flavor"), analysisJet.scoreML(), flavorCat, weightEvt); + registry.fill(HIST("h_Db_npp"), jet.scoreML(), weightEvt); + registry.fill(HIST("h2_Db_npp_flavor"), jet.scoreML(), flavorCat, weightEvt); if (isLf) { - registry.fill(HIST("h2_Db_npp_lfmatch"), analysisJet.scoreML(), getLfMatchStatus(jetFlavor), weightEvt); + registry.fill(HIST("h2_Db_npp_lfmatch"), jet.scoreML(), getLfMatchStatus(jetFlavor), weightEvt); } } if constexpr (withSub) { registry.fill(HIST("h_jetpT_sub"), jetpT, weightEvt); - registry.fill(HIST("h2_jetpT_Db_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_sub"), jetpT, jet.scoreML(), weightEvt); registry.fill(HIST("h2_jetpT_flavor_sub"), jetpT, flavorCat, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("h2_jetpT_Db_b_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_b_sub"), jetpT, jet.scoreML(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("h2_jetpT_Db_c_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_c_sub"), jetpT, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_jetpT_Db_lf_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_lf_sub"), jetpT, jet.scoreML(), weightEvt); } if (isLf) { registry.fill(HIST("h2_jetpT_lfmatch_sub"), jetpT, getLfMatchStatus(jetFlavor), weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("h2_jetpT_Db_lfnone_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_lfnone_sub"), jetpT, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_jetpT_Db_lfmatched_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_lfmatched_sub"), jetpT, jet.scoreML(), weightEvt); } } if (isNpp) { - registry.fill(HIST("h2_jetpT_Db_npp_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_sub"), jetpT, jet.scoreML(), weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("h2_jetpT_Db_npp_b_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_b_sub"), jetpT, jet.scoreML(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("h2_jetpT_Db_npp_c_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_c_sub"), jetpT, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_jetpT_Db_npp_lf_sub"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_lf_sub"), jetpT, jet.scoreML(), weightEvt); } } if (doDataDriven && !doDataDrivenSV) { if (doDataDrivenExtra) { - registry.fill(HIST("hSparse_Incljets_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_Incljets_sub"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_bjets_sub"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_cjets_sub"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_lfjets_sub"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_lfjets_none_sub"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_matched_sub"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_lfjets_matched_sub"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } } } else { - registry.fill(HIST("hSparse_Incljets_sub"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_Incljets_sub"), jetpT, jet.scoreML(), nTracks, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets_sub"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_bjets_sub"), jetpT, jet.scoreML(), nTracks, weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets_sub"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_cjets_sub"), jetpT, jet.scoreML(), nTracks, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_sub"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_lfjets_sub"), jetpT, jet.scoreML(), nTracks, weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none_sub"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_lfjets_none_sub"), jetpT, jet.scoreML(), nTracks, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_matched_sub"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_lfjets_matched_sub"), jetpT, jet.scoreML(), nTracks, weightEvt); } } } } } else { registry.fill(HIST("h_jetpT"), jetpT, weightEvt); - registry.fill(HIST("h2_jetpT_Db"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db"), jetpT, jet.scoreML(), weightEvt); registry.fill(HIST("h2_jetpT_flavor"), jetpT, flavorCat, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("h2_jetpT_Db_b"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_b"), jetpT, jet.scoreML(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("h2_jetpT_Db_c"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_c"), jetpT, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_jetpT_Db_lf"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_lf"), jetpT, jet.scoreML(), weightEvt); } if (isLf) { registry.fill(HIST("h2_jetpT_lfmatch"), jetpT, getLfMatchStatus(jetFlavor), weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("h2_jetpT_Db_lfnone"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_lfnone"), jetpT, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_jetpT_Db_lfmatched"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_lfmatched"), jetpT, jet.scoreML(), weightEvt); } } if (isNpp) { - registry.fill(HIST("h2_jetpT_Db_npp"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp"), jetpT, jet.scoreML(), weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("h2_jetpT_Db_npp_b"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_b"), jetpT, jet.scoreML(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("h2_jetpT_Db_npp_c"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_c"), jetpT, jet.scoreML(), weightEvt); } else { - registry.fill(HIST("h2_jetpT_Db_npp_lf"), jetpT, analysisJet.scoreML(), weightEvt); + registry.fill(HIST("h2_jetpT_Db_npp_lf"), jetpT, jet.scoreML(), weightEvt); } } if (doDataDriven && !doDataDrivenSV) { if (doDataDrivenExtra) { - registry.fill(HIST("hSparse_Incljets"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_Incljets"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_bjets"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_cjets"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } else { - registry.fill(HIST("hSparse_lfjets"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_lfjets"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_lfjets_none"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_matched"), jetpT, analysisJet.scoreML(), nTracks, analysisJet.mass(), weightEvt); + registry.fill(HIST("hSparse_lfjets_matched"), jetpT, jet.scoreML(), nTracks, jet.mass(), weightEvt); } } } else { - registry.fill(HIST("hSparse_Incljets"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_Incljets"), jetpT, jet.scoreML(), nTracks, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_bjets"), jetpT, jet.scoreML(), nTracks, weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_cjets"), jetpT, jet.scoreML(), nTracks, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_lfjets"), jetpT, jet.scoreML(), nTracks, weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_lfjets_none"), jetpT, jet.scoreML(), nTracks, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_matched"), jetpT, analysisJet.scoreML(), nTracks, weightEvt); + registry.fill(HIST("hSparse_lfjets_matched"), jetpT, jet.scoreML(), nTracks, weightEvt); } } } @@ -1129,39 +1130,39 @@ struct BjetTaggingGnn { // Same as fillMCDJetHistograms(), plus SV histograms (see fillSVHistograms()) and the SV-mass variant // of hSparse_Incljets (only when doDataDrivenSV is on); used by processMCDJetsSV. template - int8_t fillMCDJetHistogramsSV(AnalysisJet const& analysisJet, AnyTracks const& allTracks, AnySVs const& allSVs, float rho = 0.f, double weightEvt = 1.0) + int8_t fillMCDJetHistogramsSV(AnalysisJet const& jet, AnyTracks const& allTracks, AnySVs const& allSVs, float rho = 0.f, double weightEvt = 1.0) { - auto [jetFlavor, nTracks] = fillMCDJetHistograms(analysisJet, allTracks, rho, weightEvt); - float jetpT = withSub ? (analysisJet.pt() - rho * analysisJet.area()) : analysisJet.pt(); - float massSV = fillSVHistograms(analysisJet, allSVs, jetpT, weightEvt, jetFlavor); + auto [jetFlavor, nTracks] = fillMCDJetHistograms(jet, allTracks, rho, weightEvt); + float jetpT = withSub ? (jet.pt() - rho * jet.area()) : jet.pt(); + float massSV = fillSVHistograms(jet, allSVs, jetpT, weightEvt, jetFlavor); if (doDataDriven && doDataDrivenSV) { if constexpr (withSub) { - registry.fill(HIST("hSparse_Incljets_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_Incljets_sub"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_bjets_sub"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_cjets_sub"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_lfjets_sub"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_lfjets_none_sub"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_matched_sub"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_lfjets_matched_sub"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } } } else { - registry.fill(HIST("hSparse_Incljets"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_Incljets"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_bjets"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_bjets"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_cjets"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_cjets"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_lfjets"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); if (jetFlavor == JetTaggingSpecies::none) { - registry.fill(HIST("hSparse_lfjets_none"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_lfjets_none"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } else { - registry.fill(HIST("hSparse_lfjets_matched"), jetpT, analysisJet.scoreML(), nTracks, massSV, weightEvt); + registry.fill(HIST("hSparse_lfjets_matched"), jetpT, jet.scoreML(), nTracks, massSV, weightEvt); } } } @@ -1353,15 +1354,15 @@ struct BjetTaggingGnn { float rho = collision.rho(); - for (const auto& analysisJet : alljets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : alljets) { + if (!isAcceptedJet(jet)) { continue; } if constexpr (withSV) { - fillDataJetHistogramsSV(analysisJet, allTracks, *allSVs, rho); + fillDataJetHistogramsSV(jet, allTracks, *allSVs, rho); } else { - fillDataJetHistograms(analysisJet, allTracks, rho); + fillDataJetHistograms(jet, allTracks, rho); } } } @@ -1410,12 +1411,12 @@ struct BjetTaggingGnn { float rho = collision.rho(); - for (const auto& analysisJet : alljets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : alljets) { + if (!isAcceptedJet(jet)) { continue; } - fillDataJetHistograms(analysisJet, allTracks, rho); + fillDataJetHistograms(jet, allTracks, rho); } } PROCESS_SWITCH(BjetTaggingGnn, processDataJetsTrig, "jet information in software triggered Data", false); @@ -1440,12 +1441,12 @@ struct BjetTaggingGnn { float rho = collision.rho(); - for (const auto& analysisJet : alljets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : alljets) { + if (!isAcceptedJet(jet)) { continue; } - fillDataJetHistograms(analysisJet, allTracks, rho); + fillDataJetHistograms(jet, allTracks, rho); } } PROCESS_SWITCH(BjetTaggingGnn, processDataJetsTrigSub, "jet information in software triggered Data, UE(rho*area)-subtracted jet pT", false); @@ -1454,12 +1455,12 @@ struct BjetTaggingGnn { { EvtSelFlag evtselCode = fillCollCounter(collision); - for (const auto& analysisJet : alljets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : alljets) { + if (!isAcceptedJet(jet)) { continue; } - fillEvtSelStages(HIST("h2_jetpT_evtsel"), analysisJet.pt(), evtselCode, 1.0, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel"), jet.pt(), evtselCode, 1.0, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } } PROCESS_SWITCH(BjetTaggingGnn, processDataJetsSel, "jet information in Data (event selection)", false); @@ -1470,13 +1471,13 @@ struct BjetTaggingGnn { float rho = collision.rho(); - for (const auto& analysisJet : alljets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : alljets) { + if (!isAcceptedJet(jet)) { continue; } - float jetptSub = analysisJet.pt() - rho * analysisJet.area(); - fillEvtSelStages(HIST("h2_jetpT_evtsel_sub"), jetptSub, evtselCode, 1.0, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + float jetpTSub = jet.pt() - rho * jet.area(); + fillEvtSelStages(HIST("h2_jetpT_evtsel_sub"), jetpTSub, evtselCode, 1.0, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } } PROCESS_SWITCH(BjetTaggingGnn, processDataJetsSelSub, "jet information in Data (event selection), UE(rho*area)-subtracted jet pT", false); @@ -1540,33 +1541,33 @@ struct BjetTaggingGnn { // Store matched particle jet indices to avoid double-counting in mcpjets loop std::unordered_set matchedMcpJetIndices; - for (const auto& analysisJet : MCDjets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : MCDjets) { + if (!isAcceptedJet(jet)) { continue; } int8_t jetFlavor = 0; if constexpr (withSV) { - jetFlavor = fillMCDJetHistogramsSV(analysisJet, allTracks, *allSVs, rho, weightEvt); + jetFlavor = fillMCDJetHistogramsSV(jet, allTracks, *allSVs, rho, weightEvt); } else { - jetFlavor = fillMCDJetHistograms(analysisJet, allTracks, rho, weightEvt).jetFlavor; + jetFlavor = fillMCDJetHistograms(jet, allTracks, rho, weightEvt).jetFlavor; } if (!matchedMcColl) { continue; } - float jetpT = withSub ? (analysisJet.pt() - rho * analysisJet.area()) : analysisJet.pt(); + float jetpT = withSub ? (jet.pt() - rho * jet.area()) : jet.pt(); bool matchedJet = false; // Everything below is jetpT/mcpJetpT-dependent, so the whole block is duplicated once per `withSub` // with the "_sub"-suffixed HIST names. - for (const auto& mcpjet : analysisJet.template matchedJetGeo_as()) { + for (const auto& mcpjet : jet.template matchedJetGeo_as()) { // matchedJetGeo_as is not Filtered. if (mcpjet.pt() < jetPtMin || mcpjet.pt() >= jetPtMax || mcpjet.eta() >= jetEtaMax - mcpjet.r() / 100.f || mcpjet.eta() <= jetEtaMin + mcpjet.r() / 100.f) { continue; } matchedJet = true; matchedMcpJetIndices.insert(mcpjet.globalIndex()); - float mcpJetpT = withSub ? (mcpjet.pt() - rhoMc * mcpjet.area()) : mcpjet.pt(); + float mcpJetpT = withSubMcp ? (mcpjet.pt() - rhoMc * mcpjet.area()) : mcpjet.pt(); if constexpr (withSub) { registry.fill(HIST("h2_Response_DetjetpT_PartjetpT_sub"), jetpT, mcpJetpT, weightEvt); registry.fill(HIST("h_jetpT_matched_sub"), jetpT, weightEvt); @@ -1603,14 +1604,14 @@ struct BjetTaggingGnn { } if (!matchedJet) { if constexpr (withSub) { - registry.fill(HIST("hSparse_pthat_jetpT_sub"), collision.template mcCollision_as().ptHard(), jetpT, -1.f, weightEvt); // Fake jets, overflow-pTpart jets + registry.fill(HIST("hSparse_pthat_jetpT_sub"), collision.template mcCollision_as().ptHard(), jetpT, -999.f, weightEvt); // Fake jets, overflow-pTpart jets if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_pthat_jetpT_b_sub"), collision.template mcCollision_as().ptHard(), jetpT, -1.f, weightEvt); // Overflow-pTpart b-jets + registry.fill(HIST("hSparse_pthat_jetpT_b_sub"), collision.template mcCollision_as().ptHard(), jetpT, -999.f, weightEvt); // Overflow-pTpart b-jets } } else { - registry.fill(HIST("hSparse_pthat_jetpT"), collision.template mcCollision_as().ptHard(), jetpT, -1.f, weightEvt); // Fake jets, overflow-pTpart jets + registry.fill(HIST("hSparse_pthat_jetpT"), collision.template mcCollision_as().ptHard(), jetpT, -999.f, weightEvt); // Fake jets, overflow-pTpart jets if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_pthat_jetpT_b"), collision.template mcCollision_as().ptHard(), jetpT, -1.f, weightEvt); // Overflow-pTpart b-jets + registry.fill(HIST("hSparse_pthat_jetpT_b"), collision.template mcCollision_as().ptHard(), jetpT, -999.f, weightEvt); // Overflow-pTpart b-jets } } } @@ -1623,32 +1624,33 @@ struct BjetTaggingGnn { // Fill histograms for jets matched to the analysis event selection const auto& mcpjetspermcpcollision = MCPjets.sliceBy(mcpjetsPerMCPCollision, collision.mcCollisionId()); for (const auto& mcpjet : mcpjetspermcpcollision) { - float mcpJetpT = withSub ? (mcpjet.pt() - rhoMc * mcpjet.area()) : mcpjet.pt(); + float mcpJetpT = withSubMcp ? (mcpjet.pt() - rhoMc * mcpjet.area()) : mcpjet.pt(); int8_t jetFlavor = mcpjet.origin(); + if constexpr (withSub) { registry.fill(HIST("h_jetpT_particle_sub"), mcpJetpT, weightEvt); - // Fill hSparse_pthat_jetpT only for unmatched particle jets (reco pT = -1) + registry.fill(HIST("h2_jetpT_particle_flavor_sub"), mcpJetpT, getJetFlavorCat(jetFlavor), weightEvt); + // Fill hSparse_pthat_jetpT only for unmatched particle jets (reco pT = -999) if (!matchedMcpJetIndices.contains(mcpjet.globalIndex())) { - registry.fill(HIST("hSparse_pthat_jetpT_sub"), collision.template mcCollision_as().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing jets, overflow-pTreco jets + registry.fill(HIST("hSparse_pthat_jetpT_sub"), collision.template mcCollision_as().ptHard(), -999.f, mcpJetpT, weightEvt); // Missing jets, overflow-pTreco jets if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_pthat_jetpT_b_sub"), collision.template mcCollision_as().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing b-jets, overflow-pTpart b-jets + registry.fill(HIST("hSparse_pthat_jetpT_b_sub"), collision.template mcCollision_as().ptHard(), -999.f, mcpJetpT, weightEvt); // Missing b-jets, overflow-pTpart b-jets } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_pthat_jetpT_c_sub"), collision.template mcCollision_as().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing c-jets, overflow-pTpart c-jets + registry.fill(HIST("hSparse_pthat_jetpT_c_sub"), collision.template mcCollision_as().ptHard(), -999.f, mcpJetpT, weightEvt); // Missing c-jets, overflow-pTpart c-jets } } - registry.fill(HIST("h2_jetpT_particle_flavor_sub"), mcpJetpT, getJetFlavorCat(jetFlavor), weightEvt); } else { registry.fill(HIST("h_jetpT_particle"), mcpJetpT, weightEvt); - // Fill hSparse_pthat_jetpT only for unmatched particle jets (reco pT = -1) + registry.fill(HIST("h2_jetpT_particle_flavor"), mcpJetpT, getJetFlavorCat(jetFlavor), weightEvt); + // Fill hSparse_pthat_jetpT only for unmatched particle jets (reco pT = -999) if (!matchedMcpJetIndices.contains(mcpjet.globalIndex())) { - registry.fill(HIST("hSparse_pthat_jetpT"), collision.template mcCollision_as().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing jets, overflow-pTreco jets + registry.fill(HIST("hSparse_pthat_jetpT"), collision.template mcCollision_as().ptHard(), -999.f, mcpJetpT, weightEvt); // Missing jets, overflow-pTreco jets if (jetFlavor == JetTaggingSpecies::beauty) { - registry.fill(HIST("hSparse_pthat_jetpT_b"), collision.template mcCollision_as().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing b-jets, overflow-pTpart b-jets + registry.fill(HIST("hSparse_pthat_jetpT_b"), collision.template mcCollision_as().ptHard(), -999.f, mcpJetpT, weightEvt); // Missing b-jets, overflow-pTpart b-jets } else if (jetFlavor == JetTaggingSpecies::charm) { - registry.fill(HIST("hSparse_pthat_jetpT_c"), collision.template mcCollision_as().ptHard(), -1.f, mcpJetpT, weightEvt); // Missing c-jets, overflow-pTpart c-jets + registry.fill(HIST("hSparse_pthat_jetpT_c"), collision.template mcCollision_as().ptHard(), -999.f, mcpJetpT, weightEvt); // Missing c-jets, overflow-pTpart c-jets } } - registry.fill(HIST("h2_jetpT_particle_flavor"), mcpJetpT, getJetFlavorCat(jetFlavor), weightEvt); } } } @@ -1690,18 +1692,18 @@ struct BjetTaggingGnn { float weightEvt = useEventWeight ? collision.weight() : 1.f; EvtSelFlag evtselCode = fillCollCounter(collision, weightEvt); - for (const auto& analysisJet : MCDjets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : MCDjets) { + if (!isAcceptedJet(jet)) { continue; } - int8_t jetFlavor = analysisJet.origin(); + int8_t jetFlavor = jet.origin(); - fillEvtSelStages(HIST("h2_jetpT_evtsel"), analysisJet.pt(), evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel"), jet.pt(), evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); if (jetFlavor == JetTaggingSpecies::beauty) { - fillEvtSelStages(HIST("h2_jetpT_evtsel_b"), analysisJet.pt(), evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel_b"), jet.pt(), evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } else if (jetFlavor == JetTaggingSpecies::charm) { - fillEvtSelStages(HIST("h2_jetpT_evtsel_c"), analysisJet.pt(), evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel_c"), jet.pt(), evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } } } @@ -1722,19 +1724,19 @@ struct BjetTaggingGnn { float rho = collision.rho(); - for (const auto& analysisJet : MCDjets) { - if (!isAcceptedJet(analysisJet)) { + for (const auto& jet : MCDjets) { + if (!isAcceptedJet(jet)) { continue; } - int8_t jetFlavor = analysisJet.origin(); - float jetptSub = analysisJet.pt() - rho * analysisJet.area(); + int8_t jetFlavor = jet.origin(); + float jetpTSub = jet.pt() - rho * jet.area(); - fillEvtSelStages(HIST("h2_jetpT_evtsel_sub"), jetptSub, evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel_sub"), jetpTSub, evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); if (jetFlavor == JetTaggingSpecies::beauty) { - fillEvtSelStages(HIST("h2_jetpT_evtsel_b_sub"), jetptSub, evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel_b_sub"), jetpTSub, evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } else if (jetFlavor == JetTaggingSpecies::charm) { - fillEvtSelStages(HIST("h2_jetpT_evtsel_c_sub"), jetptSub, evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); + fillEvtSelStages(HIST("h2_jetpT_evtsel_c_sub"), jetpTSub, evtselCode, weightEvt, kEvtSelStageRecoFirst, kEvtSelStageRecoLast); } } } @@ -1742,9 +1744,9 @@ struct BjetTaggingGnn { PresliceUnsorted collisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; - // `withSub` selects UE(rho*area)-subtracted mcp-jet pT + the "_sub"-suffixed evtsel histogram names below - // instead of raw pT + the unsuffixed names. hMcCollCounter/h_vertexZ_truth*/h_event_counter_mcp aren't - // jet-pT-dependent and always use the plain name. + // `withSub` selects the "_sub"-suffixed evtsel histogram names; `withSubMcp` independently selects + // UE(rho*area)-subtracted MCP jet pT instead of raw pT. hMcCollCounter/h_vertexZ_truth*/h_event_counter_mcp + // aren't jet-pT-dependent and always use the plain name. template void processMCPJetsCommon(AnalysisCollisionsMCP const& mcCollisions, FilteredMCPJets const& mcpjets, AnalysisCollisionsMCD const& collisions, aod::JBCs const&) { @@ -1763,7 +1765,7 @@ struct BjetTaggingGnn { // above (which can be 0, 1, or split into several matchedCollisions) - no slicing/size check needed. const auto& matchedBC = mcCollision.bc_as(); - float rho = mcCollision.rho(); + float rhoMc = mcCollision.rho(); float weightEvt = useEventWeight ? mcCollision.weight() : 1.f; EvtSelFlag evtselCode = EvtSelFlag::INEL; @@ -1845,8 +1847,9 @@ struct BjetTaggingGnn { for (const auto& mcpjet : mcpjetspermcpcollision) { int8_t jetFlavor = mcpjet.origin(); - float mcpJetpT = withSub ? (mcpjet.pt() - rho * mcpjet.area()) : mcpjet.pt(); + float mcpJetpT = withSubMcp ? (mcpjet.pt() - rhoMc * mcpjet.area()) : mcpjet.pt(); + // Histogram names follow withSub; mcpJetpT follows withSubMcp. if constexpr (withSub) { fillEvtSelStages(HIST("h2_jetpT_particle_evtsel_sub"), mcpJetpT, evtselCode, weightEvt, 0, kEvtSelStages.size() - 1); if (jetFlavor == JetTaggingSpecies::beauty) {