diff --git a/PWGJE/Tasks/jetSpectraCharged.cxx b/PWGJE/Tasks/jetSpectraCharged.cxx index 7fd0dd3cd1b..45400c66ab8 100644 --- a/PWGJE/Tasks/jetSpectraCharged.cxx +++ b/PWGJE/Tasks/jetSpectraCharged.cxx @@ -41,7 +41,7 @@ using namespace o2::framework::expressions; struct JetSpectraCharged { - using McParticleCollision = soa::Join; + using JetBkgRhoMcCollisions = soa::Join; using ChargedMCDMatchedJets = soa::Join; using ChargedMCPMatchedJets = soa::Join; using ChargedMCDMatchedJetsWeighted = soa::Join; @@ -83,6 +83,14 @@ struct JetSpectraCharged { std::vector eventSelectionBits; int trackSelection = -1; + float configSwitchLow = -98.0; + float configSwitchHigh = 9998.0; + enum AcceptSplitCollisionsOptions { + NonSplitOnly = 0, + SplitOkCheckAnyAssocColl, // 1 + SplitOkCheckFirstAssocCollOnly // 2 + }; + void init(o2::framework::InitContext&) { eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(eventSelections)); @@ -96,20 +104,54 @@ struct JetSpectraCharged { AxisSpec jetPtAxisRhoAreaSub = {400, -200., 200., "#it{p}_{T} (GeV/#it{c})"}; AxisSpec jetEtaAxis = {nBinsEta, -1.0, 1.0, "#eta"}; - if (doprocessQC || doprocessQCWeighted) { + if (doprocessTracksQC || doprocessTracksQCWeighted) { registry.add("h_track_pt", "track #it{p}_{T} ; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH1F, {trackPtAxis}}); registry.add("h2_track_eta_track_phi", "track eta vs. track phi; #eta; #phi; counts", {HistType::kTH2F, {trackEtaAxis, phiAxis}}); } if (doprocessCollisions || doprocessCollisionsWeighted) { - registry.add("h_collisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); - registry.add("h_centrality_collisions", "event status vs. centrality;entries;centrality", {HistType::kTH2F, {centralityAxis, {4, 0.0, 4.0}}}); - registry.add("h_fakecollisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); - registry.add("h2_centrality_occupancy", "centrality vs occupancy; centrality; occupancy", {HistType::kTH2F, {centralityAxis, {60, 0, 30000}}}); - registry.add("h_collisions_Zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); + registry.add("h_collisions", "number of events;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.get(HIST("h_collisions"))->GetXaxis()->SetBinLabel(1, "allColl"); + registry.get(HIST("h_collisions"))->GetXaxis()->SetBinLabel(2, "qualitySel"); + registry.get(HIST("h_collisions"))->GetXaxis()->SetBinLabel(3, "centralitycut"); + registry.get(HIST("h_collisions"))->GetXaxis()->SetBinLabel(4, "occupancycut"); if (doprocessCollisionsWeighted) { - registry.add("h_collisions_weighted", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.add("h_collisions_weighted", "number of events;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); + registry.get(HIST("h_collisions_weighted"))->GetXaxis()->SetBinLabel(1, "allColl"); + registry.get(HIST("h_collisions_weighted"))->GetXaxis()->SetBinLabel(2, "qualitySel"); + registry.get(HIST("h_collisions_weighted"))->GetXaxis()->SetBinLabel(3, "centralitycut"); + registry.get(HIST("h_collisions_weighted"))->GetXaxis()->SetBinLabel(4, "occupancycut"); + if (doprocessSpectraMCDWeighted) { + registry.add("h_coll_phat", "collision #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_coll_phat_weighted", "collision #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + } + } + registry.add("h_collisions_zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); + registry.add("h_fakecollisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); // is not filled if running on data + registry.add("h2_centrality_collisions", "event status vs. centrality;entries;centrality", {HistType::kTH2F, {centralityAxis, {4, 0.0, 4.0}}}); + registry.add("h2_centrality_occupancy", "centrality vs occupancy; centrality; occupancy", {HistType::kTH2F, {centralityAxis, {60, 0, 30000}}}); + } + if (doprocessMCCollisions || doprocessMCCollisionsWeighted) { + registry.add("h_mccollisions", "number of mc events; event status; entries", {HistType::kTH1F, {{10, 0.0, 10}}}); + registry.get(HIST("h_mccollisions"))->GetXaxis()->SetBinLabel(1, "allMcColl"); + registry.get(HIST("h_mccollisions"))->GetXaxis()->SetBinLabel(2, "noRecoColl"); + registry.get(HIST("h_mccollisions"))->GetXaxis()->SetBinLabel(3, "splitColl"); + registry.get(HIST("h_mccollisions"))->GetXaxis()->SetBinLabel(4, "recoEvtSel"); + registry.get(HIST("h_mccollisions"))->GetXaxis()->SetBinLabel(5, "centralitycut"); + registry.get(HIST("h_mccollisions"))->GetXaxis()->SetBinLabel(6, "occupancycut"); + if (doprocessMCCollisionsWeighted) { + registry.add("h_mccollisions_weighted", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.get(HIST("h_mccollisions_weighted"))->GetXaxis()->SetBinLabel(1, "allMcColl"); + registry.get(HIST("h_mccollisions_weighted"))->GetXaxis()->SetBinLabel(2, "noRecoColl"); + registry.get(HIST("h_mccollisions_weighted"))->GetXaxis()->SetBinLabel(3, "splitColl"); + registry.get(HIST("h_mccollisions_weighted"))->GetXaxis()->SetBinLabel(4, "recoEvtSel"); + registry.get(HIST("h_mccollisions_weighted"))->GetXaxis()->SetBinLabel(5, "centralitycut"); + registry.get(HIST("h_mccollisions_weighted"))->GetXaxis()->SetBinLabel(6, "occupancycut"); + registry.add("h_mccoll_phat", "mc collision #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_mccoll_phat_weighted", "mc collision #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); } + registry.add("h_mccollisions_zvertex", "position of mc collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); + registry.add("h2_centrality_mccollisions", "mc event status vs. centrality;entries;centrality", {HistType::kTH2F, {centralityAxis, {4, 0.0, 4.0}}}); } if (doprocessSpectraData || doprocessSpectraMCD || doprocessSpectraMCDWeighted) { @@ -123,13 +165,9 @@ struct JetSpectraCharged { registry.add("h2_jet_pt_jet_ntracks", "jet #it{p}_{T,jet} vs. N_{jet tracks}; #it{p}_{T,jet} (GeV/#it{c}); N_{jet, tracks}", {HistType::kTH2F, {jetPtAxis, {200, -0.5, 199.5}}}); registry.add("h2_jet_pt_track_pt", "jet #it{p}_{T,jet} vs. #it{p}_{T,track}; #it{p}_{T,jet} (GeV/#it{c}); #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxis, trackPtAxis}}); registry.add("h3_jet_pt_jet_eta_jet_phi", "jet pt vs. eta vs. phi", {HistType::kTH3F, {jetPtAxis, jetEtaAxis, phiAxis}}); - if (doprocessSpectraMCDWeighted) { - registry.add("h_jet_phat", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); - registry.add("h_jet_phat_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); - } } - if (doprocessSpectraAreaSubData || doprocessSpectraAreaSubMCD) { + if (doprocessSpectraAreaSubData || doprocessSpectraAreaSubMCD || doprocessSpectraAreaSubMCDWeighted) { registry.add("h_jet_pt_rhoareasubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); registry.add("h_jet_eta_rhoareasubtracted", "jet eta;#eta; counts", {HistType::kTH1F, {jetEtaAxis}}); registry.add("h_jet_phi_rhoareasubtracted", "jet phi;#phi; counts", {HistType::kTH1F, {phiAxis}}); @@ -144,15 +182,6 @@ struct JetSpectraCharged { } if (doprocessSpectraMCP || doprocessSpectraMCPWeighted) { - registry.add("h_mcColl_counts", " number of mc events; event status; entries", {HistType::kTH1F, {{10, 0, 10}}}); - registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(1, "allMcColl"); - registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(2, "vertexZ"); - registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(3, "noRecoColl"); - registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(4, "recoEvtSel"); - registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(5, "centralitycut"); - registry.get(HIST("h_mcColl_counts"))->GetXaxis()->SetBinLabel(6, "occupancycut"); - - registry.add("h_mc_zvertex", "position of collision ;#it{Z} (cm)", {HistType::kTH1F, {{300, -15.0, 15.0}}}); registry.add("h_jet_pt_part", "partvjet pT;#it{p}_{T,jet}^{part} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxis}}); registry.add("h_jet_eta_part", "part jet #eta;#eta^{part}; counts", {HistType::kTH1F, {jetEtaAxis}}); registry.add("h_jet_phi_part", "part jet #varphi;#phi^{part}; counts", {HistType::kTH1F, {phiAxis}}); @@ -161,29 +190,12 @@ struct JetSpectraCharged { registry.add("h2_jet_pt_part_track_pt_part", "part jet #it{p}_{T,jet} vs. #it{p}_{T,track}; #it{p}_{T,jet}^{part} (GeV/#it{c}); #it{p}_{T,track}^{part} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, trackPtAxis}}); registry.add("h3_jet_pt_jet_eta_jet_phi_part", "part jet pt vs. eta vs. phi", {HistType::kTH3F, {jetPtAxis, jetEtaAxis, phiAxis}}); if (doprocessSpectraMCPWeighted) { - registry.add("h_mcColl_counts_weight", " number of weighted mc events; event status; entries", {HistType::kTH1F, {{10, 0, 10}}}); - registry.get(HIST("h_mcColl_counts_weight"))->GetXaxis()->SetBinLabel(1, "allMcColl"); - registry.get(HIST("h_mcColl_counts_weight"))->GetXaxis()->SetBinLabel(2, "vertexZ"); - registry.get(HIST("h_mcColl_counts_weight"))->GetXaxis()->SetBinLabel(3, "noRecoColl"); - registry.get(HIST("h_mcColl_counts_weight"))->GetXaxis()->SetBinLabel(4, "recoEvtSel"); - registry.get(HIST("h_mcColl_counts_weight"))->GetXaxis()->SetBinLabel(5, "centralitycut"); - registry.get(HIST("h_mcColl_counts_weight"))->GetXaxis()->SetBinLabel(6, "occupancycut"); registry.add("h2_jet_ptcut_part", "p_{T} cut;p_{T,jet}^{part} (GeV/#it{c});N;entries", {HistType::kTH2F, {{300, 0, 300}, {20, 0, 5}}}); - registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); } } - if (doprocessSpectraAreaSubMCP) { - registry.add("h_mcColl_counts_areasub", " number of mc events; event status; entries", {HistType::kTH1F, {{10, 0, 10}}}); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(1, "allMcColl"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(2, "vertexZ"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(3, "noRecoColl"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(4, "splitColl"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(5, "recoEvtSel"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(6, "centralitycut"); - registry.get(HIST("h_mcColl_counts_areasub"))->GetXaxis()->SetBinLabel(7, "occupancycut"); - - registry.add("h_mcColl_rho", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, 0.0, 500.0}}}); + if (doprocessSpectraAreaSubMCP || doprocessSpectraAreaSubMCPWeighted) { + registry.add("h_mccollisions_rho", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, 0.0, 500.0}}}); registry.add("h_jet_pt_part_rhoareasubtracted", "part jet corr pT;#it{p}_{T,jet}^{part} (GeV/#it{c}); counts", {HistType::kTH1F, {jetPtAxisRhoAreaSub}}); registry.add("h_jet_eta_part_rhoareasubtracted", "part jet #eta;#eta^{part}; counts", {HistType::kTH1F, {jetEtaAxis}}); registry.add("h_jet_phi_part_rhoareasubtracted", "part jet #varphi;#varphi^{part}; counts", {HistType::kTH1F, {phiAxis}}); @@ -233,33 +245,34 @@ struct JetSpectraCharged { } } - if (doprocessJetsMatchedSubtracted) { - registry.add("h_mc_collisions_matched", "mc collisions status;event status;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); - registry.add("h_mcd_events_matched", "mcd event status;event status;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); - registry.add("h_mc_rho_matched", "mc collision rho;#rho (GeV/#it{c}); counts", {HistType::kTH1F, {{500, -100.0, 500.0}}}); + if (doprocessJetsMatchedAreaSub || doprocessJetsMatchedAreaSubWeighted) { registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_rhoareasubtracted_mcdetaconstraint", "corr pT mcd vs. corr cpT mcp;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); registry.add("h2_jet_pt_mcd_jet_pt_mcp_matchedgeo_rhoareasubtracted_mcpetaconstraint", "corr pT mcd vs. corr cpT mcp;#it{p}_{T,jet}^{mcd} (GeV/#it{c});#it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, jetPtAxisRhoAreaSub}}); registry.add("h2_jet_pt_mcp_jet_pt_diff_matchedgeo_rhoareasubtracted", "jet mcp corr pT vs. corr delta pT / jet mcp corr pt;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); (#it{p}_{T,jet}^{mcp} (GeV/#it{c}) - #it{p}_{T,jet}^{mcd} (GeV/#it{c})) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); registry.add("h2_jet_pt_mcd_jet_pt_diff_matchedgeo_rhoareasubtracted", "jet mcd corr pT vs. corr delta pT / jet mcd corr pt;#it{p}_{T,jet}^{mcd} (GeV/#it{c}); (#it{p}_{T,jet}^{mcd} (GeV/#it{c}) - #it{p}_{T,jet}^{mcp} (GeV/#it{c})) / #it{p}_{T,jet}^{mcd} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); registry.add("h2_jet_pt_mcp_jet_pt_ratio_matchedgeo_rhoareasubtracted", "jet mcp corr pT vs. jet mcd corr pT / jet mcp corr pt;#it{p}_{T,jet}^{mcp} (GeV/#it{c}); #it{p}_{T,jet}^{mcd} (GeV/#it{c}) / #it{p}_{T,jet}^{mcp} (GeV/#it{c})", {HistType::kTH2F, {jetPtAxisRhoAreaSub, {1000, -5.0, 5.0}}}); } + + if (!(acceptSplitCollisions == NonSplitOnly || acceptSplitCollisions == SplitOkCheckAnyAssocColl || acceptSplitCollisions == SplitOkCheckFirstAssocCollOnly)) { + LOGF(fatal, "Configurable acceptSplitCollisions has wrong input value; stopping workflow"); + } } Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut); - Preslice mcdjetsPerJCollision = o2::aod::jet::collisionId; + Filter mcEventCuts = (nabs(aod::jmccollision::posZ) < vertexZCut); template bool isAcceptedJet(TJets const& jet, bool mcLevelIsParticleLevel = false) { - if (jetAreaFractionMin > -98.0) { + if (jetAreaFractionMin > configSwitchLow) { if (jet.area() < jetAreaFractionMin * o2::constants::math::PI * (jet.r() / 100.0) * (jet.r() / 100.0)) { return false; } } bool checkConstituentPt = true; - bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0); - bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0); + bool checkConstituentMinPt = (leadingConstituentPtMin > configSwitchLow); + bool checkConstituentMaxPt = (leadingConstituentPtMax < configSwitchHigh); if (!checkConstituentMinPt && !checkConstituentMaxPt) { checkConstituentPt = false; } @@ -286,6 +299,149 @@ struct JetSpectraCharged { return true; } + template + bool applyMCCollisionCuts(TMCColl const& mccollision, TCollisions const& collisions, bool fillHistograms = false, bool isWeighted = false, float eventWeight = 1.0) + { + float centrality = -1.0; + checkCentFT0M ? centrality = mccollision.centFT0M() : centrality = mccollision.centFT0C(); + + if (fillHistograms) { + registry.fill(HIST("h_mccollisions"), 0.5); + registry.fill(HIST("h2_centrality_mccollisions"), centrality, 0.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_mccollisions_weighted"), 0.5, eventWeight); + } + + if (collisions.size() < 1) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_mccollisions"), 1.5); + registry.fill(HIST("h2_centrality_mccollisions"), centrality, 1.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_mccollisions_weighted"), 1.5, eventWeight); + } + + if (acceptSplitCollisions == NonSplitOnly && collisions.size() > 1) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_mccollisions"), 2.5); + registry.fill(HIST("h2_centrality_mccollisions"), centrality, 2.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_mccollisions_weighted"), 2.5, eventWeight); + } + + bool hasSel8Coll = false; + bool centralityIsGood = false; + bool occupancyIsGood = false; + if (acceptSplitCollisions == SplitOkCheckFirstAssocCollOnly) { + if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { + hasSel8Coll = true; + } + if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { + occupancyIsGood = true; + } + + if ((centralityMin < centrality) && (centrality < centralityMax)) { + centralityIsGood = true; + } + } else { + for (auto const& collision : collisions) { + if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { + hasSel8Coll = true; + } + if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { + occupancyIsGood = true; + } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + if ((centralityMin < centrality) && (centrality < centralityMax)) { + centralityIsGood = true; + } + } + } + + if (!hasSel8Coll) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_mccollisions"), 3.5); + registry.fill(HIST("h2_centrality_mccollisions"), centrality, 3.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_mccollisions_weighted"), 3.5, eventWeight); + } + + if (!centralityIsGood) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_mccollisions"), 4.5); + registry.fill(HIST("h2_centrality_mccollisions"), centrality, 4.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_mccollisions_weighted"), 4.5, eventWeight); + } + + if (!occupancyIsGood) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_mccollisions"), 5.5); + registry.fill(HIST("h2_centrality_mccollisions"), centrality, 5.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_mccollisions_weighted"), 5.5, eventWeight); + } + + return true; + } + + template + bool applyCollisionCuts(TColl const& collision, bool fillHistograms = false, bool isWeighted = false, float eventWeight = 1.0) + { + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + + if (fillHistograms) { + registry.fill(HIST("h_collisions"), 0.5); + registry.fill(HIST("h2_centrality_collisions"), centrality, 0.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_collisions_weighted"), 0.5, eventWeight); + } + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_collisions"), 1.5); + registry.fill(HIST("h2_centrality_collisions"), centrality, 1.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_collisions_weighted"), 1.5, eventWeight); + } + + if (centrality < centralityMin || centralityMax < centrality) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_collisions"), 2.5); + registry.fill(HIST("h2_centrality_collisions"), centrality, 2.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_collisions_weighted"), 2.5, eventWeight); + } + + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return false; + } + if (fillHistograms) { + registry.fill(HIST("h_collisions"), 3.5); + registry.fill(HIST("h2_centrality_collisions"), centrality, 3.5, eventWeight); + if (isWeighted) + registry.fill(HIST("h_collisions_weighted"), 3.5, eventWeight); + } + + return true; + } + template void fillJetHistograms(TJets const& jet, float centrality, float weight = 1.0) { @@ -496,7 +652,7 @@ struct JetSpectraCharged { } template - void fillGeoMatchedCorrHistograms(TBase const& jetMCD, float rho, float mcrho = 0.0, float weight = 1.0) + void fillGeoMatchedAreaSubHistograms(TBase const& jetMCD, float rho, float mcrho = 0.0, float weight = 1.0) { float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); if (jetMCD.pt() > pTHatMaxMCD * pTHat) { @@ -525,24 +681,13 @@ struct JetSpectraCharged { } } - void processQC(soa::Filtered::iterator const& collision, - soa::Filtered> const& tracks) + void processTracksQC(soa::Filtered::iterator const& collision, + soa::Filtered> const& tracks) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } + for (auto const& track : tracks) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; @@ -550,19 +695,19 @@ struct JetSpectraCharged { fillTrackHistograms(track); } } - PROCESS_SWITCH(JetSpectraCharged, processQC, "collisions and track QC for Data and MCD", false); + PROCESS_SWITCH(JetSpectraCharged, processTracksQC, "collisions and track QC for Data and MCD", false); - void processQCWeighted(soa::Join::iterator const& collision, - aod::JetMcCollisions const&, - soa::Filtered> const& tracks) + void processTracksQCWeighted(soa::Filtered>::iterator const& collision, + aod::JetMcCollisions const&, + soa::Filtered> const& tracks) { + bool fillHistograms = false; + bool isWeighted = true; float eventWeight = collision.weight(); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (std::abs(collision.posZ()) > vertexZCut) { + if (!applyCollisionCuts(collision, fillHistograms, isWeighted, eventWeight)) { return; } + for (auto const& track : tracks) { if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; @@ -570,78 +715,81 @@ struct JetSpectraCharged { fillTrackHistograms(track, eventWeight); } } - PROCESS_SWITCH(JetSpectraCharged, processQCWeighted, "weighted collsions and tracks QC for MC", false); + PROCESS_SWITCH(JetSpectraCharged, processTracksQCWeighted, "weighted collsions and tracks QC for MC", false); void processCollisions(soa::Filtered::iterator const& collision) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h_centrality_collisions"), centrality, 0.5); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h_centrality_collisions"), centrality, 1.5); - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + bool fillHistograms = true; + bool isWeighted = false; + if (!applyCollisionCuts(collision, fillHistograms, isWeighted)) { return; } - registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h_centrality_collisions"), centrality, 2.5); - registry.fill(HIST("h2_centrality_occupancy"), centrality, collision.trackOccupancyInTimeRange()); - registry.fill(HIST("h_collisions_Zvertex"), collision.posZ()); + + registry.fill(HIST("h_collisions_zvertex"), collision.posZ()); } PROCESS_SWITCH(JetSpectraCharged, processCollisions, "collisions Data and MCD", true); - void processCollisionsWeighted(soa::Join::iterator const& collision, + void processCollisionsWeighted(soa::Filtered>::iterator const& collision, aod::JetMcCollisions const&) { if (!collision.has_mcCollision()) { registry.fill(HIST("h_fakecollisions"), 0.5); } + bool fillHistograms = true; + bool isWeighted = true; float eventWeight = collision.weight(); - registry.fill(HIST("h_collisions"), 0.5); - registry.fill(HIST("h_collisions_weighted"), 0.5, eventWeight); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { + if (!applyCollisionCuts(collision, fillHistograms, isWeighted, eventWeight)) { return; } - registry.fill(HIST("h_collisions"), 1.5); - registry.fill(HIST("h_collisions_weighted"), 1.5, eventWeight); - if (std::abs(collision.posZ()) > vertexZCut) { + + registry.fill(HIST("h_collisions_zvertex"), collision.posZ(), eventWeight); + + float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); + registry.fill(HIST("h_coll_phat"), pTHat); + registry.fill(HIST("h_coll_phat_weighted"), pTHat, eventWeight); + } + PROCESS_SWITCH(JetSpectraCharged, processCollisionsWeighted, "weighted collisions for MCD", false); + + void processMCCollisions(soa::Filtered::iterator const& mccollision, soa::SmallGroups const& collisions) + { + bool fillHistograms = true; + bool isWeighted = false; + if (!applyMCCollisionCuts(mccollision, collisions, fillHistograms, isWeighted)) { return; } - registry.fill(HIST("h_collisions"), 2.5); - registry.fill(HIST("h_collisions_weighted"), 2.5, eventWeight); - registry.fill(HIST("h_collisions_Zvertex"), collision.posZ(), eventWeight); + + registry.fill(HIST("h_mccollisions_zvertex"), mccollision.posZ()); } - PROCESS_SWITCH(JetSpectraCharged, processCollisionsWeighted, "weighted collsions for MCD", false); + PROCESS_SWITCH(JetSpectraCharged, processMCCollisions, "collisions MCP", false); + + void processMCCollisionsWeighted(soa::Filtered::iterator const& mccollision, soa::SmallGroups const& collisions) + { + bool fillHistograms = true; + bool isWeighted = true; + float eventWeight = mccollision.weight(); + if (!applyMCCollisionCuts(mccollision, collisions, fillHistograms, isWeighted, eventWeight)) { + return; + } + + registry.fill(HIST("h_mccollisions_zvertex"), mccollision.posZ(), eventWeight); + + float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); + registry.fill(HIST("h_mccoll_phat"), pTHat); + registry.fill(HIST("h_mccoll_phat_weighted"), pTHat, eventWeight); + } + PROCESS_SWITCH(JetSpectraCharged, processMCCollisionsWeighted, "weighted collisions for MCP", false); void processSpectraData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracks const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -658,21 +806,13 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -689,21 +829,13 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -720,21 +852,13 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -751,12 +875,16 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracks const&) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + bool fillHistograms = false; + bool isWeighted = true; + float eventWeight = collision.weight(); + if (!applyCollisionCuts(collision, fillHistograms, isWeighted, eventWeight)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -765,141 +893,73 @@ struct JetSpectraCharged { continue; } float jetweight = jet.eventWeight(); - float pTHat = 10. / (std::pow(jetweight, 1.0 / pTHatExponent)); - if (jet.pt() > pTHatMaxMCD * pTHat) { - return; - } - registry.fill(HIST("h_jet_phat"), pTHat); - registry.fill(HIST("h_jet_phat_weighted"), pTHat, jetweight); - fillJetHistograms(jet, collision.centFT0C(), jetweight); + fillJetHistograms(jet, centrality, jetweight); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraMCDWeighted, "jet finder QA mcd with weighted events", false); - void processSpectraAreaSubMCP(McParticleCollision::iterator const& mccollision, - soa::SmallGroups const& collisions, - soa::Join const& jets, - aod::JetParticles const&) + void processSpectraAreaSubMCDWeighted(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + aod::JetTracks const&) { - bool mcLevelIsParticleLevel = true; - - registry.fill(HIST("h_mcColl_counts_areasub"), 0.5); - if (std::abs(mccollision.posZ()) > vertexZCut) { - return; - } - registry.fill(HIST("h_mcColl_counts_areasub"), 1.5); - if (collisions.size() < 1) { - return; - } - registry.fill(HIST("h_mcColl_counts_areasub"), 2.5); - if (acceptSplitCollisions == 0 && collisions.size() > 1) { - return; - } - registry.fill(HIST("h_mcColl_counts_areasub"), 3.5); - - bool hasSel8Coll = false; - bool centralityIsGood = false; - bool occupancyIsGood = false; - if (acceptSplitCollisions == 2) { - if (jetderiveddatautilities::selectCollision(collisions.begin(), eventSelectionBits, skipMBGapEvents)) { - hasSel8Coll = true; - } - if ((centralityMin < collisions.begin().centFT0C()) && (collisions.begin().centFT0C() < centralityMax)) { - centralityIsGood = true; - } - if ((trackOccupancyInTimeRangeMin < collisions.begin().trackOccupancyInTimeRange()) && (collisions.begin().trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { - occupancyIsGood = true; - } - } else { - for (auto const& collision : collisions) { - if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - hasSel8Coll = true; - } - if ((centralityMin < collision.centFT0C()) && (collision.centFT0C() < centralityMax)) { - centralityIsGood = true; - } - if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { - occupancyIsGood = true; - } - } - } - if (!hasSel8Coll) { + bool fillHistograms = false; + bool isWeighted = true; + float eventWeight = collision.weight(); + if (!applyCollisionCuts(collision, fillHistograms, isWeighted, eventWeight)) { return; } - registry.fill(HIST("h_mcColl_counts_areasub"), 4.5); - if (!centralityIsGood) { - return; - } - registry.fill(HIST("h_mcColl_counts_areasub"), 5.5); + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); - if (!occupancyIsGood) { - return; - } - registry.fill(HIST("h_mcColl_counts_areasub"), 6.5); - registry.fill(HIST("h_mcColl_rho"), mccollision.rho()); for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + if (!isAcceptedJet(jet)) { continue; } - fillMCPAreaSubHistograms(jet, mccollision.rho()); + float jetweight = jet.eventWeight(); + fillJetAreaSubHistograms(jet, centrality, collision.rho(), jetweight); } } - PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubMCP, "jet spectra with area-based subtraction for MC particle level", false); + PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubMCDWeighted, "jet spectra with rho-area subtraction for MCD", false); - void processSpectraMCP(aod::JetMcCollision const& mccollision, + void processSpectraMCP(soa::Filtered::iterator const& mccollision, soa::SmallGroups const& collisions, soa::Join const& jets, aod::JetParticles const&) { bool mcLevelIsParticleLevel = true; - registry.fill(HIST("h_mcColl_counts"), 0.5); - if (std::abs(mccollision.posZ()) > vertexZCut) { - return; - } - registry.fill(HIST("h_mcColl_counts"), 1.5); - if (collisions.size() < 1) { + if (!applyMCCollisionCuts(mccollision, collisions)) { return; } - registry.fill(HIST("h_mcColl_counts"), 2.5); + registry.fill(HIST("h_mccollisions_zvertex"), mccollision.posZ()); - bool hasSel8Coll = false; - bool centralityIsGood = false; - bool occupancyIsGood = false; - for (auto const& collision : collisions) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - hasSel8Coll = true; - } - if ((centralityMin < centrality) && (centralityMax > centrality)) { - centralityIsGood = true; + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; } - if ((trackOccupancyInTimeRangeMin < collision.trackOccupancyInTimeRange()) && (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMax)) { - occupancyIsGood = true; + if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + continue; } + fillMCPHistograms(jet); } - if (!hasSel8Coll) { - return; - } - registry.fill(HIST("h_mcColl_counts"), 3.5); - if (!centralityIsGood) { - return; - } - registry.fill(HIST("h_mcColl_counts"), 4.5); - if (!occupancyIsGood) { + } + PROCESS_SWITCH(JetSpectraCharged, processSpectraMCP, "jet spectra for MC particle level", false); + + void processSpectraAreaSubMCP(soa::Filtered::iterator const& mccollision, + soa::SmallGroups const& collisions, + soa::Join const& jets, + aod::JetParticles const&) + { + bool mcLevelIsParticleLevel = true; + + if (!applyMCCollisionCuts(mccollision, collisions)) { return; } - registry.fill(HIST("h_mcColl_counts"), 5.5); - registry.fill(HIST("h_mc_zvertex"), mccollision.posZ()); + registry.fill(HIST("h_mccollisions_rho"), mccollision.rho()); for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -908,44 +968,24 @@ struct JetSpectraCharged { if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { continue; } - fillMCPHistograms(jet); + fillMCPAreaSubHistograms(jet, mccollision.rho()); } } - PROCESS_SWITCH(JetSpectraCharged, processSpectraMCP, "jet spectra for MC particle level", false); + PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubMCP, "jet spectra with area-based subtraction for MC particle level", false); - void processSpectraMCPWeighted(aod::JetMcCollision const& mccollision, + void processSpectraMCPWeighted(soa::Filtered::iterator const& mccollision, soa::SmallGroups const& collisions, soa::Join const& jets, aod::JetParticles const&) { bool mcLevelIsParticleLevel = true; - float eventWeight = mccollision.weight(); - registry.fill(HIST("h_mcColl_counts"), 0.5); - registry.fill(HIST("h_mcColl_counts_weight"), 0.5, eventWeight); - if (std::abs(mccollision.posZ()) > vertexZCut) { - return; - } - registry.fill(HIST("h_mcColl_counts"), 1.5); - registry.fill(HIST("h_mcColl_counts_weight"), 1.5, eventWeight); - if (collisions.size() < 1) { - return; - } - registry.fill(HIST("h_mcColl_counts"), 2.5); - registry.fill(HIST("h_mcColl_counts_weight"), 2.5, eventWeight); - registry.fill(HIST("h_mc_zvertex"), mccollision.posZ(), eventWeight); - - bool hasSel8Coll = false; - for (auto const& collision : collisions) { - if (jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - hasSel8Coll = true; - } - } - if (!hasSel8Coll) { + bool fillHistograms = false; + bool isWeighted = true; + float eventWeight = mccollision.weight(); + if (!applyMCCollisionCuts(mccollision, collisions, fillHistograms, isWeighted, eventWeight)) { return; } - registry.fill(HIST("h_mcColl_counts"), 3.5); - registry.fill(HIST("h_mcColl_counts_weight"), 3.5, eventWeight); for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -956,36 +996,56 @@ struct JetSpectraCharged { } float jetweight = jet.eventWeight(); double pTHat = 10. / (std::pow(jetweight, 1.0 / pTHatExponent)); - for (int N = 1; N < 21; N++) { + int Nmax = 21; + for (int N = 1; N < Nmax; N++) { if (jet.pt() < N * 0.25 * pTHat && jet.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h2_jet_ptcut_part"), jet.pt(), N * 0.25, jetweight); } } - registry.fill(HIST("h_jet_phat_part_weighted"), pTHat, jetweight); fillMCPHistograms(jet, jetweight); } } PROCESS_SWITCH(JetSpectraCharged, processSpectraMCPWeighted, "jet spectra for MC particle level weighted", false); - void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, - soa::Join const& jets, - aod::JetTracksSub const&) + void processSpectraAreaSubMCPWeighted(soa::Filtered::iterator const& mccollision, + soa::SmallGroups const& collisions, + soa::Join const& jets, + aod::JetParticles const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { + bool mcLevelIsParticleLevel = true; + + bool fillHistograms = false; + bool isWeighted = true; + float eventWeight = mccollision.weight(); + if (!applyMCCollisionCuts(mccollision, collisions, fillHistograms, isWeighted, eventWeight)) { return; } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; + registry.fill(HIST("h_mccollisions_rho"), mccollision.rho(), eventWeight); + + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet, mcLevelIsParticleLevel)) { + continue; + } + float jetweight = jet.eventWeight(); + fillMCPAreaSubHistograms(jet, mccollision.rho(), jetweight); } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + } + PROCESS_SWITCH(JetSpectraCharged, processSpectraAreaSubMCPWeighted, "jet spectra with area-based subtraction for MC particle level", false); + + void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, + soa::Join const& jets, + aod::JetTracksSub const&) + { + if (!applyCollisionCuts(collision)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -1002,21 +1062,13 @@ struct JetSpectraCharged { soa::Join const& jets, aod::JetTracksSub const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } + + float centrality = -1.0; + checkCentFT0M ? centrality = collision.centFT0M() : centrality = collision.centFT0C(); + for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; @@ -1034,19 +1086,7 @@ struct JetSpectraCharged { ChargedMCPMatchedJets const&, aod::JetTracks const&, aod::JetParticles const&) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - if (centrality < centralityMin || centrality > centralityMax) { - return; - } - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + if (!applyCollisionCuts(collision)) { return; } @@ -1064,12 +1104,13 @@ struct JetSpectraCharged { ChargedMCPMatchedJetsWeighted const&, aod::JetTracks const&, aod::JetParticles const&) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents)) { - return; - } - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + bool fillHistograms = false; + bool isWeighted = true; + float eventWeight = collision.weight(); + if (!applyCollisionCuts(collision, fillHistograms, isWeighted, eventWeight)) { return; } + for (const auto& mcdjet : mcdjets) { if (!isAcceptedJet(mcdjet)) { continue; @@ -1079,54 +1120,50 @@ struct JetSpectraCharged { } PROCESS_SWITCH(JetSpectraCharged, processJetsMatchedWeighted, "matched mcp and mcd jets with weighted events", false); - void processJetsMatchedSubtracted(McParticleCollision::iterator const& mccollision, - soa::SmallGroups> const& collisions, - ChargedMCDMatchedJets const& mcdjets, - ChargedMCPMatchedJets const&, - aod::JetTracks const&, aod::JetParticles const&) + void processJetsMatchedAreaSub(soa::Filtered>::iterator const& collision, + JetBkgRhoMcCollisions const&, + ChargedMCDMatchedJets const& mcdjets, + ChargedMCPMatchedJets const&, + aod::JetTracks const&, aod::JetParticles const&) { - registry.fill(HIST("h_mc_collisions_matched"), 0.5); - if (mccollision.size() < 1) { - return; - } - registry.fill(HIST("h_mc_collisions_matched"), 1.5); - if (!(std::abs(mccollision.posZ()) < vertexZCut)) { + if (!applyCollisionCuts(collision)) { return; } - registry.fill(HIST("h_mc_collisions_matched"), 2.5); - double mcrho = mccollision.rho(); - registry.fill(HIST("h_mc_rho_matched"), mcrho); - for (const auto& collision : collisions) { - float centrality = 0.0; - if (checkCentFT0M) { - centrality = collision.centFT0M(); - } else { - centrality = collision.centFT0C(); - } - registry.fill(HIST("h_mcd_events_matched"), 0.5); - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits, skipMBGapEvents) || !(std::abs(collision.posZ()) < vertexZCut)) { - continue; - } - registry.fill(HIST("h_mcd_events_matched"), 1.5); - if (centrality < centralityMin || centrality > centralityMax) { + + double mcrho = collision.has_mcCollision() ? collision.mcCollision_as().rho() : -1; + + for (const auto& mcdjet : mcdjets) { + if (!isAcceptedJet(mcdjet)) { continue; } - registry.fill(HIST("h_mcd_events_matched"), 2.5); - if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { - return; - } - registry.fill(HIST("h_mcd_events_matched"), 3.5); + fillGeoMatchedAreaSubHistograms(mcdjet, collision.rho(), mcrho); + } + } + PROCESS_SWITCH(JetSpectraCharged, processJetsMatchedAreaSub, "matched mcp and mcd jets after area-based pt subtraction", false); - auto collmcdjets = mcdjets.sliceBy(mcdjetsPerJCollision, collision.globalIndex()); - for (const auto& mcdjet : collmcdjets) { - if (!isAcceptedJet(mcdjet)) { - continue; - } - fillGeoMatchedCorrHistograms(mcdjet, collision.rho(), mcrho); + void processJetsMatchedAreaSubWeighted(soa::Filtered>::iterator const& collision, + JetBkgRhoMcCollisions const&, + ChargedMCDMatchedJetsWeighted const& mcdjets, + ChargedMCPMatchedJetsWeighted const&, + aod::JetTracks const&, aod::JetParticles const&) + { + bool fillHistograms = false; + bool isWeighted = true; + float eventWeight = collision.weight(); + if (!applyCollisionCuts(collision, fillHistograms, isWeighted, eventWeight)) { + return; + } + + double mcrho = collision.has_mcCollision() ? collision.mcCollision_as().rho() : -1; + + for (const auto& mcdjet : mcdjets) { + if (!isAcceptedJet(mcdjet)) { + continue; } + fillGeoMatchedAreaSubHistograms(mcdjet, collision.rho(), mcrho, eventWeight); } } - PROCESS_SWITCH(JetSpectraCharged, processJetsMatchedSubtracted, "matched mcp and mcd jets after subtraction", false); + PROCESS_SWITCH(JetSpectraCharged, processJetsMatchedAreaSubWeighted, "matched mcp and mcd jets after area-based pt subtraction with weighted events", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)