From ad8552de9b7826f7b7203f9d51fb20eb7e150b1f Mon Sep 17 00:00:00 2001 From: KotliarovAr Date: Tue, 29 Jul 2025 15:31:29 +0200 Subject: [PATCH 1/3] [PWGJE] Add multiplicity selection --- PWGJE/Tasks/recoilJets.cxx | 774 ++++++++++++++++++++++++------------- 1 file changed, 509 insertions(+), 265 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 1a7b3c785ff..e5878179df4 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -1,6 +1,6 @@ // Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright +// holders. All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". @@ -19,6 +19,7 @@ #include "PWGJE/DataModel/JetSubtraction.h" #include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Multiplicity.h" #include "CommonConstants/MathConstants.h" #include "Framework/ASoA.h" @@ -29,6 +30,7 @@ #include #include #include +#include #include #include "TRandom3.h" @@ -47,72 +49,110 @@ using namespace o2::framework; using namespace o2::framework::expressions; // Shorthand notations -using FilteredColl = soa::Filtered>::iterator; -using FilteredCollPartLevel = soa::Filtered>::iterator; -using FilteredCollDetLevelGetWeight = soa::Filtered>::iterator; - -using FilteredJets = soa::Filtered>; -using FilteredJetsDetLevel = soa::Filtered>; -using FilteredJetsPartLevel = soa::Filtered>; - -using FilteredMatchedJetsDetLevel = soa::Filtered>; -using FilteredMatchedJetsPartLevel = soa::Filtered>; +using FilteredColl = + soa::Filtered>::iterator; +using FilteredCollPartLevel = + soa::Filtered>::iterator; +using FilteredCollDetLevelGetWeight = + soa::Filtered>::iterator; +using FilteredEventMultiplicity = + soa::Filtered>::iterator; + +using FilteredJets = + soa::Filtered>; +using FilteredJetsDetLevel = + soa::Filtered>; +using FilteredJetsPartLevel = + soa::Filtered>; + +using FilteredMatchedJetsDetLevel = soa::Filtered>; +using FilteredMatchedJetsPartLevel = soa::Filtered>; using FilteredTracks = soa::Filtered; +using FilteredParticles = soa::Filtered; struct RecoilJets { // List of configurable parameters Configurable evSel{"evSel", "sel8", "Choose event selection"}; - Configurable trkSel{"trkSel", "globalTracks", "Set track selection"}; + Configurable trkSel{"trkSel", "globalTracks", + "Set track selection"}; Configurable vertexZCut{"vertexZCut", 10., "Accepted z-vertex range"}; - Configurable fracSig{"fracSig", 0.9, "Fraction of events to use for signal TT"}; - Configurable bGetMissJets{"bGetMissJets", false, "Flag to get miss histo for particle level jets"}; + Configurable fracSig{"fracSig", 0.9, + "Fraction of events to use for signal TT"}; - Configurable trkPtMin{"trkPtMin", 0.15, "Minimum pT of acceptanced tracks"}; - Configurable trkPtMax{"trkPtMax", 100., "Maximum pT of acceptanced tracks"}; + Configurable trkPtMin{"trkPtMin", 0.15, + "Minimum pT of acceptanced tracks"}; + Configurable trkPtMax{"trkPtMax", 100., + "Maximum pT of acceptanced tracks"}; Configurable trkEtaCut{"trkEtaCut", 0.9, "Eta acceptance of TPC"}; Configurable jetR{"jetR", 0.4, "Jet cone radius"}; - Configurable triggerMasks{"triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; - Configurable skipMBGapEvents{"skipMBGapEvents", false, "flag to choose to reject min. bias gap events; jet-level rejection applied at the jet finder level, here rejection is applied for collision and track process functions"}; + Configurable triggerMasks{ + "triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; + Configurable skipMBGapEvents{ + "skipMBGapEvents", false, + "flag to choose to reject min. bias gap events; jet-level rejection " + "applied at the jet finder level, here rejection is applied for " + "collision and track process functions"}; // List of configurable parameters for MC - Configurable pTHatExponent{"pTHatExponent", 4.0, "Exponent of the event weight for the calculation of pTHat"}; - Configurable pTHatMax{"pTHatMax", 999.0, "Maximum fraction of hard scattering for jet acceptance in MC"}; + Configurable pTHatExponent{ + "pTHatExponent", 4.0, + "Exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatMax{ + "pTHatMax", 999.0, + "Maximum fraction of hard scattering for jet acceptance in MC"}; // Parameters for recoil jet selection - Configurable ptTTrefMin{"ptTTrefMin", 5., "Minimum pT of reference TT"}; - Configurable ptTTrefMax{"ptTTrefMax", 7., "Maximum pT of reference TT"}; + Configurable ptTTrefMin{"ptTTrefMin", 5., + "Minimum pT of reference TT"}; + Configurable ptTTrefMax{"ptTTrefMax", 7., + "Maximum pT of reference TT"}; Configurable ptTTsigMin{"ptTTsigMin", 20., "Minimum pT of signal TT"}; Configurable ptTTsigMax{"ptTTsigMax", 50., "Maximum pT of signal TT"}; - Configurable recoilRegion{"recoilRegion", 0.6, "Width of recoil acceptance"}; + Configurable recoilRegion{"recoilRegion", 0.6, + "Width of recoil acceptance"}; // List of configurable parameters for histograms - Configurable histJetPt{"histJetPt", 100, "Maximum value of jet pT shown in histograms"}; + Configurable histJetPt{ + "histJetPt", 100, "Maximum value of jet pT shown in histograms"}; // Axes specification AxisSpec pT{histJetPt, 0.0, histJetPt * 1.0, "#it{p}_{T} (GeV/#it{c})"}; - AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; + AxisSpec jetPTcorr{histJetPt + 20, -20., histJetPt * 1.0, + "#it{p}_{T, jet}^{ch, corr} (GeV/#it{c})"}; AxisSpec phiAngle{40, 0.0, constants::math::TwoPI, "#it{#varphi} (rad)"}; - AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, "#Delta#it{#varphi} (rad)"}; + AxisSpec deltaPhiAngle{52, 0.0, constants::math::PI, + "#Delta#it{#varphi} (rad)"}; AxisSpec pseudorap{40, -1., 1., "#it{#eta}"}; AxisSpec pseudorapJets{20, -0.5, 0.5, "#it{#eta}_{jet}"}; AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; AxisSpec rhoArea{60, 0.0, 60., "#it{#rho} #times Area_{jet}"}; AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; - Preslice partJetsPerCollision = aod::jet::mcCollisionId; + Preslice partJetsPerCollision = + aod::jet::mcCollisionId; - TRandom3* rand = new TRandom3(0); + TRandom3 *rand = new TRandom3(0); // Declare filter on collision Z vertex Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; Filter collisionFilterMC = nabs(aod::jmccollision::posZ) < vertexZCut; - // Declare filters on accepted tracks and MC particles (settings for jet reco are provided in the jet finder wagon) - Filter trackFilter = aod::jtrack::pt > trkPtMin&& aod::jtrack::pt < trkPtMax&& nabs(aod::jtrack::eta) < trkEtaCut; + // Declare filters on accepted tracks and MC particles (settings for jet reco + // are provided in the jet finder wagon) + Filter trackFilter = aod::jtrack::pt > trkPtMin &&aod::jtrack::pt < + trkPtMax &&nabs(aod::jtrack::eta) < trkEtaCut; Filter partFilter = nabs(aod::jmcparticle::eta) < trkEtaCut; // Declare filter on jets @@ -126,120 +166,268 @@ struct RecoilJets { Service pdg; - void init(InitContext const&) - { + void init(InitContext const &) { std::string evSelToString = static_cast(evSel); std::string trkSelToString = static_cast(trkSel); - eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); - trackSelection = jetderiveddatautilities::initialiseTrackSelection(trkSelToString); - triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); + eventSelectionBits = + jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); + trackSelection = + jetderiveddatautilities::initialiseTrackSelection(trkSelToString); + triggerMaskBits = + jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); // List of raw and MC det. distributions if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) { - spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{3, 0.0, 3.}}); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of events"); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of events after sel. %s", evSelToString.data())); - spectra.get(HIST("hEventSelectionCount"))->GetXaxis()->SetBinLabel(3, "# of events w. outlier"); - - spectra.add("vertexZ", "Z vertex of collisions", kTH1F, {{60, -12., 12.}}); - spectra.add("hHasAssocMcCollision", "Has det. level coll. associat. MC coll.", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(1, "Yes"); - spectra.get(HIST("hHasAssocMcCollision"))->GetXaxis()->SetBinLabel(2, "No"); - - spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(1, "Total # of tracks"); - spectra.get(HIST("hTrackSelectionCount"))->GetXaxis()->SetBinLabel(2, Form("# of tracks after sel. %s", trkSelToString.data())); - - spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle}); - - spectra.add("hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, {{40, 10., 50.}}); // needed to distinguish merged data from diff. wagons - - spectra.add("hNtrig", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); + spectra.add("hEventSelectionCount", "Count # of events in the analysis", + kTH1F, {{3, 0.0, 3.}}); + spectra.get(HIST("hEventSelectionCount")) + ->GetXaxis() + ->SetBinLabel(1, "Total # of events"); + spectra.get(HIST("hEventSelectionCount")) + ->GetXaxis() + ->SetBinLabel( + 2, Form("# of events after sel. %s", evSelToString.data())); + spectra.get(HIST("hEventSelectionCount")) + ->GetXaxis() + ->SetBinLabel(3, "# of events w. outlier"); + + spectra.add("vertexZ", "Z vertex of collisions", kTH1F, + {{60, -12., 12.}}); + spectra.add("hHasAssocMcCollision", + "Has det. level coll. associat. MC coll.", kTH1F, + {{2, 0.0, 2.}}); + spectra.get(HIST("hHasAssocMcCollision")) + ->GetXaxis() + ->SetBinLabel(1, "Yes"); + spectra.get(HIST("hHasAssocMcCollision")) + ->GetXaxis() + ->SetBinLabel(2, "No"); + + spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", + kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hTrackSelectionCount")) + ->GetXaxis() + ->SetBinLabel(1, "Total # of tracks"); + spectra.get(HIST("hTrackSelectionCount")) + ->GetXaxis() + ->SetBinLabel( + 2, Form("# of tracks after sel. %s", trkSelToString.data())); + + spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, + {pT, pseudorap, phiAngle}); + + spectra.add( + "hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, + {{40, 10., + 50.}}); // needed to distinguish merged data from diff. wagons + + spectra.add("hNtrig", "Total number of selected triggers per class", + kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hNtrig"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); spectra.get(HIST("hNtrig"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - spectra.add("hTTRef_per_event", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event", "Number of TT_{Sig} per event", kTH1F, {{10, 0.5, 10.5}}); - - spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - - spectra.add("hDPhi_JetPt_Corr_TTRef", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - - spectra.add("hRecoil_JetPt_Corr_TTRef", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - - spectra.add("hJetArea_JetPt_Rho_TTRef", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hJetArea_JetPt_Rho_TTSig", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + spectra.add("hTTRef_per_event", "Number of TT_{Ref} per event", kTH1F, + {{15, 0.5, 15.5}}); + spectra.add("hTTSig_per_event", "Number of TT_{Sig} per event", kTH1F, + {{10, 0.5, 10.5}}); + + spectra.add("hJetPtEtaPhiRhoArea", "Charact. of inclusive jets", + kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); + + spectra.add("hDPhi_JetPt_Corr_TTRef", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_Corr_TTSig", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_TTRef", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + spectra.add("hDPhi_JetPt_TTSig", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + + spectra.add("hRecoil_JetPt_Corr_TTRef", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_Corr_TTSig", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_TTRef", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + spectra.add("hRecoil_JetPt_TTSig", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + + spectra.add("hJetArea_JetPt_Rho_TTRef", + "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); + spectra.add("hJetArea_JetPt_Rho_TTSig", + "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); } // List of MC particle level distributions if (doprocessMCPartLevel || doprocessMCPartLevelWeighted) { - spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, {{60, -12., 12.}}); + spectra.add("vertexZMC", "Z vertex of jmccollision", kTH1F, + {{60, -12., 12.}}); spectra.add("ptHat", "Distribution of pT hat", kTH1F, {{500, 0.0, 100.}}); - spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, {pT, pseudorap, phiAngle}); - spectra.add("hNtrig_Part", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); - spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(1, "TT_{ref}"); - spectra.get(HIST("hNtrig_Part"))->GetXaxis()->SetBinLabel(2, "TT_{sig}"); - - spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); - spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", kTH1F, {{10, 0.5, 10.5}}); - - spectra.add("hJetPtEtaPhiRhoArea_Part", "Charact. of inclusive part. level jets", kTHnSparseF, {pT, pseudorapJets, phiAngle, rho, jetArea}); - - spectra.add("hDPhi_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, jetPTcorr}); - spectra.add("hDPhi_JetPt_TTRef_Part", "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - spectra.add("hDPhi_JetPt_TTSig_Part", "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", kTH2F, {deltaPhiAngle, pT}); - - spectra.add("hRecoil_JetPt_Corr_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_Corr_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {jetPTcorr}); - spectra.add("hRecoil_JetPt_TTRef_Part", "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - spectra.add("hRecoil_JetPt_TTSig_Part", "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); - - spectra.add("hJetArea_JetPt_Rho_TTRef_Part", "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); - spectra.add("hJetArea_JetPt_Rho_TTSig_Part", "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, {jetArea, pT, rho}); + spectra.add("hEventSelectionCountPartLevel", + "Count # of events in the part. level analysis", kTH1F, + {{2, 0.0, 2.}}); + spectra.get(HIST("hEventSelectionCountPartLevel")) + ->GetXaxis() + ->SetBinLabel(1, "Total # of events"); + spectra.get(HIST("hEventSelectionCountPartLevel")) + ->GetXaxis() + ->SetBinLabel(2, "# of events w. outlier"); + + spectra.add("hCountNumberOutliersFrameWork", + "Count # of outlier events based on flag from JE fw", kTH1F, + {{1, 0.0, 1.}}); + spectra.get(HIST("hCountNumberOutliersFrameWork")) + ->GetXaxis() + ->SetBinLabel(1, "Oulier flag true"); + + spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, + {pT, pseudorap, phiAngle}); + spectra.add("hNtrig_Part", "Total number of selected triggers per class", + kTH1F, {{2, 0.0, 2.}}); + spectra.get(HIST("hNtrig_Part")) + ->GetXaxis() + ->SetBinLabel(1, "TT_{ref}"); + spectra.get(HIST("hNtrig_Part")) + ->GetXaxis() + ->SetBinLabel(2, "TT_{sig}"); + + spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", + kTH1F, {{15, 0.5, 15.5}}); + spectra.add("hTTSig_per_event_Part", "Number of TT_{Sig} per event", + kTH1F, {{10, 0.5, 10.5}}); + + spectra.add("hJetPtEtaPhiRhoArea_Part", + "Charact. of inclusive part. level jets", kTHnSparseF, + {pT, pseudorapJets, phiAngle, rho, jetArea}); + + spectra.add("hDPhi_JetPt_Corr_TTRef_Part", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_Corr_TTSig_Part", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, jetPTcorr}); + spectra.add("hDPhi_JetPt_TTRef_Part", + "Events w. TT_{Ref}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + spectra.add("hDPhi_JetPt_TTSig_Part", + "Events w. TT_{Sig}: #Delta#varphi & #it{p}_{T, jet}^{ch}", + kTH2F, {deltaPhiAngle, pT}); + + spectra.add("hRecoil_JetPt_Corr_TTRef_Part", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_Corr_TTSig_Part", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, + {jetPTcorr}); + spectra.add("hRecoil_JetPt_TTRef_Part", + "Events w. TT_{Ref}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + spectra.add("hRecoil_JetPt_TTSig_Part", + "Events w. TT_{Sig}: #it{p}_{T} of recoil jets", kTH1F, {pT}); + + spectra.add("hJetArea_JetPt_Rho_TTRef_Part", + "Events w. TT_{Ref}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); + spectra.add("hJetArea_JetPt_Rho_TTSig_Part", + "Events w. TT_{Sig}: A_{jet} & jet pT & #rho", kTH3F, + {jetArea, pT, rho}); + + spectra.add("hDiffInOutlierRemove", + "Difference between pT hat from code and fw", kTH1F, + {{502, -0.2, 50.}}); } // Jet matching: part. vs. det. if (doprocessJetsMatched || doprocessJetsMatchedWeighted) { - spectra.add("hJetPt_DetLevel_vs_PartLevel", "Correlation jet pT at det. vs. part. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); - // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel", "Correlation jet pT at part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); - spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {{200, 0.0, 200.}, {200, 0.0, 200.}}); - // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", "Correlation recoil jet pT at part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); - - if (bGetMissJets) { - spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", kTH1F, {jetPTcorr}); - spectra.add("hMissedJets_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o matched pair", kTH1F, {jetPTcorr}); - } else { - spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", kTH1F, {jetPTcorr}); - spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {{200, 0.0, 200.}}); - // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o matched pair", kTH1F, {jetPTcorr}); - } - - spectra.add("hJetPt_resolution", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); - spectra.add("hJetPt_resolution_RecoilJets", "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{100, -5., 5.}, pT}); - - spectra.add("hJetPhi_resolution", "#varphi resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{40, -1., 1.}, pT}); - spectra.add("hJetPhi_resolution_RecoilJets", "#varphi resolution as a func. of jet #it{p}_{T, part}", kTH2F, {{40, -1., 1.}, pT}); + spectra.add("hJetPt_DetLevel_vs_PartLevel", + "Correlation jet pT at det. vs. part. levels", kTH2F, + {{200, 0.0, 200.}, {200, 0.0, 200.}}); + // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel", "Correlation jet pT at + // part. vs. det. levels", kTH2F, {jetPTcorr, jetPTcorr}); + spectra.add("hJetPt_DetLevel_vs_PartLevel_RecoilJets", + "Correlation recoil jet pT at part. vs. det. levels", kTH2F, + {{200, 0.0, 200.}, {200, 0.0, 200.}}); + // spectra.add("hJetPt_Corr_PartLevel_vs_DetLevel_RecoilJets", + // "Correlation recoil jet pT at part. vs. det. levels", kTH2F, + // {jetPTcorr, jetPTcorr}); + + spectra.add("hMissedJets_pT", "Part. level jets w/o matched pair", kTH1F, + {{200, 0.0, 200.}}); + // spectra.add("hMissedJets_Corr_pT", "Part. level jets w/o matched pair", + // kTH1F, {jetPTcorr}); + spectra.add("hMissedJets_pT_RecoilJets", + "Part. level jets w/o matched pair", kTH1F, + {{200, 0.0, 200.}}); + // spectra.add("hMissedJets_Corr_pT_RecoilJets", "Part. level jets w/o + // matched pair", kTH1F, {jetPTcorr}); + spectra.add("hFakeJets_pT", "Det. level jets w/o matched pair", kTH1F, + {{200, 0.0, 200.}}); + // spectra.add("hFakeJets_Corr_pT", "Det. level jets w/o matched pair", + // kTH1F, {jetPTcorr}); + spectra.add("hFakeJets_pT_RecoilJets", "Det. level jets w/o matched pair", + kTH1F, {{200, 0.0, 200.}}); + // spectra.add("hFakeJets_Corr_pT_RecoilJets", "Det. level jets w/o + // matched pair", kTH1F, {jetPTcorr}); + + spectra.add( + "hJetPt_resolution", + "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{100, -5., 5.}, pT}); + spectra.add( + "hJetPt_resolution_RecoilJets", + "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{100, -5., 5.}, pT}); + + spectra.add("hJetPhi_resolution", + "#varphi resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{40, -1., 1.}, pT}); + spectra.add("hJetPhi_resolution_RecoilJets", + "#varphi resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{40, -1., 1.}, pT}); + + spectra.add("hNumberMatchedJetsPerOneBaseJet", + "# of taged jets per 1 base jet vs. jet pT", kTH2F, + {{10, 0.5, 10.5}, {100, 0.0, 100.}}); + } - spectra.add("hNumberMatchedJetsPerOneBaseJet", "# of taged jets per 1 base jet vs. jet pT", kTH2F, {{10, 0.5, 10.5}, {100, 0.0, 100.}}); + if (doprocessMultiplicity) { + spectra.add("hMultFT0A", "Mult. signal from FTOA", kTH1F, + {{1500, 0.0, 30000.}}); + spectra.add("hMultFT0C", "Mult. signal from FTOC", kTH1F, + {{1500, 0.0, 30000.}}); + spectra.add("hMultFT0M", "Total mult. signal from FT0A & FTOC", kTH1F, + {{3000, 0.0, 60000.}}); + + spectra.add("hMultZNA", "Mult. signal from ZDC A-side", kTH1F, + {{500, 0.0, 10000.}}); + spectra.add("hMultZNC", "Mult. signal from ZDC C-side", kTH1F, + {{500, 0.0, 10000.}}); + spectra.add("hMultZNM", "Total mult. signal from ZDCs", kTH1F, + {{1000, 0.0, 20000.}}); + + // Correlations + spectra.add("hMultFT0A_vs_ZNA", "Correlation of signals FTOA vs ZNA", + kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); + spectra.add("hMultFT0C_vs_ZNC", "Correlation of signals FTOC vs ZNC", + kTH2F, {{1500, 0.0, 30000.}, {500, 0.0, 10000.}}); + spectra.add("hMultFT0M_vs_ZNM", "Correlation of signals FTOM vs ZNM", + kTH2F, {{3000, 0.0, 60000.}, {1000, 0.0, 20000.}}); } } // Fill histograms with raw or MC det. level data template - void fillHistograms(Collision const& collision, Jets const& jets, Tracks const& tracks, float weight = 1.) - { + void fillHistograms(Collision const &collision, Jets const &jets, + Tracks const &tracks, float weight = 1.) { bool bSigEv = false; std::vector vPhiOfTT; double phiTT = 0.; @@ -251,21 +439,22 @@ struct RecoilJets { bSigEv = true; // Remove whole event if jet passes the outlier removal condition - for (const auto& jet : jets) { + for (const auto &jet : jets) { if (jet.pt() > pTHatMax * pTHat) { spectra.fill(HIST("hEventSelectionCount"), 2.5); return; } } - for (const auto& track : tracks) { + for (const auto &track : tracks) { spectra.fill(HIST("hTrackSelectionCount"), 0.5); if (skipTrack(track)) continue; spectra.fill(HIST("hTrackSelectionCount"), 1.5); - spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), weight); + spectra.fill(HIST("hTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), + weight); // Search for TT candidate if (bSigEv && (track.pt() > ptTTsigMin && track.pt() < ptTTsigMax)) { @@ -293,30 +482,37 @@ struct RecoilJets { } } - for (const auto& jet : jets) { - spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); + for (const auto &jet : jets) { + spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), + collision.rho(), jet.area(), weight); if (nTT > 0) { auto [dphi, bRecoilJet] = isRecoilJet(jet, phiTT); if (bSigEv) { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTSig"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig"), jet.area(), jet.pt(), + collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTSig"), jet.pt(), weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTRef"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef"), jet.area(), jet.pt(), + collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTRef"), jet.pt(), weight); } } @@ -325,8 +521,8 @@ struct RecoilJets { } template - void fillMCPHistograms(Collision const& collision, Jets const& jets, Particles const& particles, float weight = 1.) - { + void fillMCPHistograms(Collision const &collision, Jets const &jets, + Particles const &particles, float weight = 1.) { bool bSigEv = false; std::vector vPhiOfTT; double phiTT = 0.; @@ -338,12 +534,14 @@ struct RecoilJets { if (dice < fracSig) bSigEv = true; - for (const auto& jet : jets) { - if (jet.pt() > pTHatMax * pTHat) + for (const auto &jet : jets) { + if (jet.pt() > pTHatMax * pTHat) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 1.5); return; + } } - for (const auto& particle : particles) { + for (const auto &particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle) continue; @@ -353,14 +551,17 @@ struct RecoilJets { if (bParticleNeutral || !particle.isPhysicalPrimary()) continue; - spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), particle.phi(), weight); + spectra.fill(HIST("hPartPtEtaPhi"), particle.pt(), particle.eta(), + particle.phi(), weight); - if (bSigEv && (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) { + if (bSigEv && + (particle.pt() > ptTTsigMin && particle.pt() < ptTTsigMax)) { vPhiOfTT.push_back(particle.phi()); ++nTT; } - if (!bSigEv && (particle.pt() > ptTTrefMin && particle.pt() < ptTTrefMax)) { + if (!bSigEv && + (particle.pt() > ptTTrefMin && particle.pt() < ptTTrefMax)) { vPhiOfTT.push_back(particle.phi()); ++nTT; } @@ -379,8 +580,9 @@ struct RecoilJets { } } - for (const auto& jet : jets) { - spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); + for (const auto &jet : jets) { + spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), + jet.phi(), collision.rho(), jet.area(), weight); if (nTT > 0) { @@ -388,23 +590,29 @@ struct RecoilJets { if (bSigEv) { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTSig_Part"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTSig_Part"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTSig_Part"), jet.area(), + jet.pt(), collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTSig_Part"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTSig_Part"), jet.pt(), weight); } } else { - spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hDPhi_JetPt_Corr_TTRef_Part"), dphi, + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hDPhi_JetPt_TTRef_Part"), dphi, jet.pt(), weight); - spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jet.area(), jet.pt(), collision.rho(), weight); + spectra.fill(HIST("hJetArea_JetPt_Rho_TTRef_Part"), jet.area(), + jet.pt(), collision.rho(), weight); if (bRecoilJet) { - spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), jet.pt() - collision.rho() * jet.area(), weight); + spectra.fill(HIST("hRecoil_JetPt_Corr_TTRef_Part"), + jet.pt() - collision.rho() * jet.area(), weight); spectra.fill(HIST("hRecoil_JetPt_TTRef_Part"), jet.pt(), weight); } } @@ -413,18 +621,19 @@ struct RecoilJets { } template - void fillMatchedHistograms(TracksTable const& tracks, JetsBase const& jetsBase, JetsTag const& jetsTag, float weight = 1.) - { + void fillMatchedHistograms(TracksTable const &tracks, + JetsBase const &jetsBase, JetsTag const &jetsTag, + float weight = 1.) { std::vector vPhiOfTT; double phiTTSig = 0.; float pTHat = getPtHat(weight); - for (const auto& jetBase : jetsBase) { + for (const auto &jetBase : jetsBase) { if (jetBase.pt() > pTHatMax * pTHat) return; } - for (const auto& track : tracks) { + for (const auto &track : tracks) { if (skipTrack(track)) continue; @@ -438,16 +647,39 @@ struct RecoilJets { if (bIsThereTTSig) phiTTSig = getPhiTT(vPhiOfTT); - for (const auto& jetBase : jetsBase) { - bool bIsBaseJetRecoil = get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; + for (const auto &jetBase : jetsBase) { + bool bIsBaseJetRecoil = + get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight); } } - void processData(FilteredColl const& collision, - FilteredTracks const& tracks, - FilteredJets const& jets) - { + template + void fillMultiplicityHistograms(Collision const &collision, + float weight = 1.0) { + + spectra.fill(HIST("hMultFT0A"), collision.multFT0A(), weight); + spectra.fill(HIST("hMultFT0C"), collision.multFT0C(), weight); + spectra.fill(HIST("hMultFT0M"), collision.multFT0M(), weight); + + spectra.fill(HIST("hMultZNA"), collision.multZNA(), weight); + spectra.fill(HIST("hMultZNC"), collision.multZNC(), weight); + spectra.fill(HIST("hMultZNM"), collision.multZNA() + collision.multZNC(), + weight); + + // Correlations + spectra.fill(HIST("hMultFT0A_vs_ZNA"), collision.multFT0A(), + collision.multZNA(), weight); + spectra.fill(HIST("hMultFT0C_vs_ZNC"), collision.multFT0C(), + collision.multZNC(), weight); + spectra.fill(HIST("hMultFT0M_vs_ZNM"), collision.multFT0M(), + collision.multZNA() + collision.multZNC(), weight); + } + + //------------------------------------------------------------------------------ + // Process functions + void processData(FilteredColl const &collision, FilteredTracks const &tracks, + FilteredJets const &jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision)) @@ -460,10 +692,9 @@ struct RecoilJets { } PROCESS_SWITCH(RecoilJets, processData, "process data", true); - void processMCDetLevel(FilteredColl const& collision, - FilteredTracks const& tracks, - FilteredJetsDetLevel const& jets) - { + void processMCDetLevel(FilteredColl const &collision, + FilteredTracks const &tracks, + FilteredJetsDetLevel const &jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -473,13 +704,13 @@ struct RecoilJets { spectra.fill(HIST("vertexZ"), collision.posZ()); fillHistograms(collision, jets, tracks); } - PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", false); + PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", + false); - void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const& collision, - aod::JetMcCollisions const&, - FilteredTracks const& tracks, - FilteredJetsDetLevel const& jets) - { + void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const &collision, + aod::JetMcCollisions const &, + FilteredTracks const &tracks, + FilteredJetsDetLevel const &jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -497,160 +728,173 @@ struct RecoilJets { fillHistograms(collision, jets, tracks, weight); } - PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, "process MC detector level with event weight", false); + PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, + "process MC detector level with event weight", false); - void processMCPartLevel(FilteredCollPartLevel const& collision, - aod::JetParticles const& particles, - FilteredJetsPartLevel const& jets) - { + void processMCPartLevel(FilteredCollPartLevel const &collision, + FilteredParticles const &particles, + FilteredJetsPartLevel const &jets) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; spectra.fill(HIST("vertexZMC"), collision.posZ()); fillMCPHistograms(collision, jets, particles); } - PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level", false); + PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level", + false); - void processMCPartLevelWeighted(FilteredCollPartLevel const& collision, - aod::JetParticles const& particles, - FilteredJetsPartLevel const& jets) - { + void processMCPartLevelWeighted(FilteredCollPartLevel const &collision, + FilteredParticles const &particles, + FilteredJetsPartLevel const &jets) { + spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; auto weight = collision.weight(); + + auto calcPtHat = getPtHat(weight); + auto pThatFromFW = collision.ptHard(); + spectra.fill(HIST("hDiffInOutlierRemove"), calcPtHat - pThatFromFW); + if (collision.isOutlier()) + spectra.fill(HIST("hCountNumberOutliersFrameWork"), 0.5); + + // LOG(debug) << "Difference between pT hat: " << calcPtHat - pThatFromFW; + spectra.fill(HIST("vertexZMC"), collision.posZ(), weight); fillMCPHistograms(collision, jets, particles, weight); } - PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, "process MC particle level with event weight", false); - - void processJetsMatched(FilteredCollDetLevelGetWeight const& collision, - aod::JetMcCollisions const&, - FilteredTracks const& tracks, - FilteredMatchedJetsDetLevel const& mcdjets, - FilteredMatchedJetsPartLevel const& mcpjets) - { + PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, + "process MC particle level with event weight", false); + + void processJetsMatched(FilteredCollDetLevelGetWeight const &collision, + aod::JetMcCollisions const &, + FilteredTracks const &tracks, + FilteredMatchedJetsDetLevel const &mcdjets, + FilteredMatchedJetsPartLevel const &mcpjets) { if (skipEvent(collision) || skipMBGapEvent(collision)) return; - auto mcpjetsPerMCCollision = mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + auto mcpjetsPerMCCollision = + mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); - if (bGetMissJets) { - fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets); - } else { - fillMatchedHistograms(tracks, mcdjets, mcpjetsPerMCCollision); - } + fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets); } - PROCESS_SWITCH(RecoilJets, processJetsMatched, "process matching of MC jets (no weight)", false); - - void processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, - aod::JetMcCollisions const&, - FilteredTracks const& tracks, - FilteredMatchedJetsDetLevel const& mcdjets, - FilteredMatchedJetsPartLevel const& mcpjets) - { + PROCESS_SWITCH(RecoilJets, processJetsMatched, + "process matching of MC jets (no weight)", false); + + void + processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const &collision, + aod::JetMcCollisions const &, + FilteredTracks const &tracks, + FilteredMatchedJetsDetLevel const &mcdjets, + FilteredMatchedJetsPartLevel const &mcpjets) { if (skipEvent(collision) || skipMBGapEvent(collision)) return; - auto mcpjetsPerMCCollision = mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + auto mcpjetsPerMCCollision = + mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); auto weight = collision.mcCollision().weight(); - if (bGetMissJets) { - fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets, weight); - } else { - fillMatchedHistograms(tracks, mcdjets, mcpjetsPerMCCollision, weight); - } + fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets, weight); + } + PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, + "process matching of MC jets (weighted)", false); + + void processMultiplicity(FilteredEventMultiplicity const &collision) { + if (skipEvent(collision)) + return; + + fillMultiplicityHistograms(collision); } - PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, "process matching of MC jets (weighted)", false); + PROCESS_SWITCH(RecoilJets, processMultiplicity, "process multiplicity", + false); //------------------------------------------------------------------------------ // Auxiliary functions - template - bool skipEvent(const Collision& coll) - { + template bool skipEvent(const Collision &coll) { /// \brief: trigger cut is needed for pp data - return !jetderiveddatautilities::selectCollision(coll, eventSelectionBits) || !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); + return !jetderiveddatautilities::selectCollision(coll, + eventSelectionBits) || + !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); } - template - bool skipMBGapEvent(const Collision& coll) - { - return skipMBGapEvents && coll.subGeneratorId() == jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; + template bool skipMBGapEvent(const Collision &coll) { + return skipMBGapEvents && + coll.subGeneratorId() == + jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; } - template - bool skipTrack(const Track& track) - { + template bool skipTrack(const Track &track) { return !jetderiveddatautilities::selectTrack(track, trackSelection); } template - std::tuple isRecoilJet(const Jet& jet, - double phiTT) - { - double dphi = std::fabs(RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); + std::tuple isRecoilJet(const Jet &jet, double phiTT) { + double dphi = std::fabs( + RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); return {dphi, (constants::math::PI - recoilRegion) < dphi}; } - double getPhiTT(const std::vector& vPhiOfTT) - { + double getPhiTT(const std::vector &vPhiOfTT) { auto iTrig = rand->Integer(vPhiOfTT.size()); return vPhiOfTT[iTrig]; } - float getPtHat(float weight) - { + float getPtHat(float weight) { return 10. / (std::pow(weight, 1.0 / pTHatExponent)); } - template - void dataForUnfolding(JetBase const& jetBase, JetsTag const&, bool bIsBaseJetRecoil, float weight = 1.0) - { - - bool bIsThereMatchedJet = jetBase.has_matchedJetGeo(); - if (bIsThereMatchedJet) { - const auto& jetsMatched = jetBase.template matchedJetGeo_as>(); + template + void dataForUnfolding(PartJet const &partJet, DetJet const &detJets, + bool bIsBaseJetRecoil, float weight = 1.0) { - for (const auto& jetMatched : jetsMatched) { - spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), jetsMatched.size(), jetMatched.pt(), weight); + bool bIsThereMatchedJet = partJet.has_matchedJetGeo(); - if (bGetMissJets) { - // Mean that base jet is particle level jet - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPt_resolution"), (jetBase.pt() - jetMatched.pt()) / jetBase.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution"), jetBase.phi() - jetMatched.phi(), jetBase.pt(), weight); - - if (bIsBaseJetRecoil) { - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), jetMatched.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPt_resolution_RecoilJets"), (jetBase.pt() - jetMatched.pt()) / jetBase.pt(), jetBase.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), jetBase.phi() - jetMatched.phi(), jetBase.pt(), weight); - } - } else { - // Mean that base jet is detector level jet - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetBase.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPt_resolution"), (jetMatched.pt() - jetBase.pt()) / jetMatched.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution"), jetMatched.phi() - jetBase.phi(), jetMatched.phi(), weight); - - if (bIsBaseJetRecoil) { - spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), jetBase.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPt_resolution_RecoilJets"), (jetMatched.pt() - jetBase.pt()) / jetMatched.pt(), jetMatched.pt(), weight); - spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), jetMatched.phi() - jetBase.phi(), jetMatched.phi(), weight); - } + if (bIsThereMatchedJet) { + const auto &jetsMatched = + partJet.template matchedJetGeo_as>(); + + for (const auto &jetMatched : jetsMatched) { + spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), + jetsMatched.size(), jetMatched.pt(), weight); + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPt_resolution"), + (partJet.pt() - jetMatched.pt()) / partJet.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPhi_resolution"), + partJet.phi() - jetMatched.phi(), partJet.pt(), weight); + + if (bIsBaseJetRecoil) { + spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel_RecoilJets"), + jetMatched.pt(), partJet.pt(), weight); + spectra.fill(HIST("hJetPt_resolution_RecoilJets"), + (partJet.pt() - jetMatched.pt()) / partJet.pt(), + partJet.pt(), weight); + spectra.fill(HIST("hJetPhi_resolution_RecoilJets"), + partJet.phi() - jetMatched.phi(), partJet.pt(), weight); } } } else { - // No closest jet - if (bGetMissJets) { - spectra.fill(HIST("hMissedJets_pT"), jetBase.pt(), weight); - if (bIsBaseJetRecoil) - spectra.fill(HIST("hMissedJets_pT_RecoilJets"), jetBase.pt(), weight); - } else { - spectra.fill(HIST("hFakeJets_pT"), jetBase.pt(), weight); + // Miss jets + spectra.fill(HIST("hMissedJets_pT"), partJet.pt(), weight); + if (bIsBaseJetRecoil) + spectra.fill(HIST("hMissedJets_pT_RecoilJets"), partJet.pt(), weight); + } + + // Fake jets + for (const auto &detJet : detJets) { + bIsThereMatchedJet = detJet.has_matchedJetGeo(); + if (!bIsThereMatchedJet) { + spectra.fill(HIST("hFakeJets_pT"), detJet.pt(), weight); if (bIsBaseJetRecoil) - spectra.fill(HIST("hFakeJets_pT_RecoilJets"), jetBase.pt(), weight); + spectra.fill(HIST("hFakeJets_pT_RecoilJets"), detJet.pt(), weight); } } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) { + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 543d53cbd784c9d1b4fdfb6eea0b6681fcb4d401 Mon Sep 17 00:00:00 2001 From: KotliarovAr Date: Wed, 30 Jul 2025 11:15:50 +0200 Subject: [PATCH 2/3] PWGJE: fix linter errors --- PWGJE/Tasks/recoilJets.cxx | 113 ++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index e5878179df4..ac9ddc1a4c1 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -1,6 +1,6 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright -// holders. All rights not expressly granted are reserved. +// Copyright 2020-2022 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". @@ -97,21 +97,18 @@ struct RecoilJets { Configurable trkEtaCut{"trkEtaCut", 0.9, "Eta acceptance of TPC"}; Configurable jetR{"jetR", 0.4, "Jet cone radius"}; - Configurable triggerMasks{ - "triggerMasks", "", "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; - Configurable skipMBGapEvents{ - "skipMBGapEvents", false, - "flag to choose to reject min. bias gap events; jet-level rejection " - "applied at the jet finder level, here rejection is applied for " - "collision and track process functions"}; + Configurable triggerMasks{"triggerMasks", "", + "Relevant trigger masks: fTrackLowPt,fTrackHighPt"}; + Configurable skipMBGapEvents{"skipMBGapEvents", false, + "flag to choose to reject min. bias gap events; jet-level rejection " + "applied at the jet finder level, here rejection is applied for " + "collision and track process functions"}; // List of configurable parameters for MC - Configurable pTHatExponent{ - "pTHatExponent", 4.0, - "Exponent of the event weight for the calculation of pTHat"}; - Configurable pTHatMax{ - "pTHatMax", 999.0, - "Maximum fraction of hard scattering for jet acceptance in MC"}; + Configurable pTHatExponent{"pTHatExponent", 4.0, + "Exponent of the event weight for the calculation of pTHat"}; + Configurable pTHatMax{"pTHatMax", 999.0, + "Maximum fraction of hard scattering for jet acceptance in MC"}; // Parameters for recoil jet selection Configurable ptTTrefMin{"ptTTrefMin", 5., @@ -124,8 +121,8 @@ struct RecoilJets { "Width of recoil acceptance"}; // List of configurable parameters for histograms - Configurable histJetPt{ - "histJetPt", 100, "Maximum value of jet pT shown in histograms"}; + Configurable histJetPt{"histJetPt", 100, + "Maximum value of jet pT shown in histograms"}; // Axes specification AxisSpec pT{histJetPt, 0.0, histJetPt * 1.0, "#it{p}_{T} (GeV/#it{c})"}; @@ -426,8 +423,8 @@ struct RecoilJets { // Fill histograms with raw or MC det. level data template - void fillHistograms(Collision const &collision, Jets const &jets, - Tracks const &tracks, float weight = 1.) { + void fillHistograms(Collision const& collision, Jets const& jets, + Tracks const& tracks, float weight = 1.) { bool bSigEv = false; std::vector vPhiOfTT; double phiTT = 0.; @@ -439,14 +436,14 @@ struct RecoilJets { bSigEv = true; // Remove whole event if jet passes the outlier removal condition - for (const auto &jet : jets) { + for (const auto& jet : jets) { if (jet.pt() > pTHatMax * pTHat) { spectra.fill(HIST("hEventSelectionCount"), 2.5); return; } } - for (const auto &track : tracks) { + for (const auto& track : tracks) { spectra.fill(HIST("hTrackSelectionCount"), 0.5); if (skipTrack(track)) @@ -482,7 +479,7 @@ struct RecoilJets { } } - for (const auto &jet : jets) { + for (const auto& jet : jets) { spectra.fill(HIST("hJetPtEtaPhiRhoArea"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); @@ -534,14 +531,14 @@ struct RecoilJets { if (dice < fracSig) bSigEv = true; - for (const auto &jet : jets) { + for (const auto& jet : jets) { if (jet.pt() > pTHatMax * pTHat) { spectra.fill(HIST("hEventSelectionCountPartLevel"), 1.5); return; } } - for (const auto &particle : particles) { + for (const auto& particle : particles) { auto pdgParticle = pdg->GetParticle(particle.pdgCode()); if (!pdgParticle) continue; @@ -580,7 +577,7 @@ struct RecoilJets { } } - for (const auto &jet : jets) { + for (const auto& jet : jets) { spectra.fill(HIST("hJetPtEtaPhiRhoArea_Part"), jet.pt(), jet.eta(), jet.phi(), collision.rho(), jet.area(), weight); @@ -628,12 +625,12 @@ struct RecoilJets { double phiTTSig = 0.; float pTHat = getPtHat(weight); - for (const auto &jetBase : jetsBase) { + for (const auto& jetBase : jetsBase) { if (jetBase.pt() > pTHatMax * pTHat) return; } - for (const auto &track : tracks) { + for (const auto& track : tracks) { if (skipTrack(track)) continue; @@ -647,7 +644,7 @@ struct RecoilJets { if (bIsThereTTSig) phiTTSig = getPhiTT(vPhiOfTT); - for (const auto &jetBase : jetsBase) { + for (const auto& jetBase : jetsBase) { bool bIsBaseJetRecoil = get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight); @@ -678,8 +675,8 @@ struct RecoilJets { //------------------------------------------------------------------------------ // Process functions - void processData(FilteredColl const &collision, FilteredTracks const &tracks, - FilteredJets const &jets) { + void processData(FilteredColl const& collision, FilteredTracks const& tracks, + FilteredJets const& jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision)) @@ -692,9 +689,9 @@ struct RecoilJets { } PROCESS_SWITCH(RecoilJets, processData, "process data", true); - void processMCDetLevel(FilteredColl const &collision, - FilteredTracks const &tracks, - FilteredJetsDetLevel const &jets) { + void processMCDetLevel(FilteredColl const& collision, + FilteredTracks const& tracks, + FilteredJetsDetLevel const& jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -707,10 +704,10 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processMCDetLevel, "process MC detector level", false); - void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const &collision, - aod::JetMcCollisions const &, - FilteredTracks const &tracks, - FilteredJetsDetLevel const &jets) { + void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const& collision, + aod::JetMcCollisions const&, + FilteredTracks const& tracks, + FilteredJetsDetLevel const& jets) { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -731,9 +728,9 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processMCDetLevelWeighted, "process MC detector level with event weight", false); - void processMCPartLevel(FilteredCollPartLevel const &collision, - FilteredParticles const &particles, - FilteredJetsPartLevel const &jets) { + void processMCPartLevel(FilteredCollPartLevel const& collision, + FilteredParticles const& particles, + FilteredJetsPartLevel const& jets) { spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; @@ -744,9 +741,9 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processMCPartLevel, "process MC particle level", false); - void processMCPartLevelWeighted(FilteredCollPartLevel const &collision, - FilteredParticles const &particles, - FilteredJetsPartLevel const &jets) { + void processMCPartLevelWeighted(FilteredCollPartLevel const& collision, + FilteredParticles const& particles, + FilteredJetsPartLevel const& jets) { spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; @@ -767,11 +764,11 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processMCPartLevelWeighted, "process MC particle level with event weight", false); - void processJetsMatched(FilteredCollDetLevelGetWeight const &collision, - aod::JetMcCollisions const &, - FilteredTracks const &tracks, - FilteredMatchedJetsDetLevel const &mcdjets, - FilteredMatchedJetsPartLevel const &mcpjets) { + void processJetsMatched(FilteredCollDetLevelGetWeight const& collision, + aod::JetMcCollisions const&, + FilteredTracks const& tracks, + FilteredMatchedJetsDetLevel const& mcdjets, + FilteredMatchedJetsPartLevel const& mcpjets) { if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -784,11 +781,11 @@ struct RecoilJets { "process matching of MC jets (no weight)", false); void - processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const &collision, - aod::JetMcCollisions const &, - FilteredTracks const &tracks, - FilteredMatchedJetsDetLevel const &mcdjets, - FilteredMatchedJetsPartLevel const &mcpjets) { + processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, + aod::JetMcCollisions const&, + FilteredTracks const& tracks, + FilteredMatchedJetsDetLevel const& mcdjets, + FilteredMatchedJetsPartLevel const& mcpjets) { if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -801,7 +798,7 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, "process matching of MC jets (weighted)", false); - void processMultiplicity(FilteredEventMultiplicity const &collision) { + void processMultiplicity(FilteredEventMultiplicity const& collision) { if (skipEvent(collision)) return; @@ -852,10 +849,10 @@ struct RecoilJets { bool bIsThereMatchedJet = partJet.has_matchedJetGeo(); if (bIsThereMatchedJet) { - const auto &jetsMatched = + const auto& jetsMatched = partJet.template matchedJetGeo_as>(); - for (const auto &jetMatched : jetsMatched) { + for (const auto& jetMatched : jetsMatched) { spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), jetsMatched.size(), jetMatched.pt(), weight); spectra.fill(HIST("hJetPt_DetLevel_vs_PartLevel"), jetMatched.pt(), @@ -884,7 +881,7 @@ struct RecoilJets { } // Fake jets - for (const auto &detJet : detJets) { + for (const auto& detJet : detJets) { bIsThereMatchedJet = detJet.has_matchedJetGeo(); if (!bIsThereMatchedJet) { spectra.fill(HIST("hFakeJets_pT"), detJet.pt(), weight); From 975a51b988d462b5f6a4fcce4896c7744e228422 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 30 Jul 2025 09:16:19 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- PWGJE/Tasks/recoilJets.cxx | 210 +++++++++++++++++++++---------------- 1 file changed, 117 insertions(+), 93 deletions(-) diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index ac9ddc1a4c1..8b6d2b952ea 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -50,31 +50,31 @@ using namespace o2::framework::expressions; // Shorthand notations using FilteredColl = - soa::Filtered>::iterator; + soa::Filtered>::iterator; using FilteredCollPartLevel = - soa::Filtered>::iterator; + soa::Filtered>::iterator; using FilteredCollDetLevelGetWeight = - soa::Filtered>::iterator; + soa::Filtered>::iterator; using FilteredEventMultiplicity = - soa::Filtered>::iterator; + soa::Filtered>::iterator; using FilteredJets = - soa::Filtered>; + soa::Filtered>; using FilteredJetsDetLevel = - soa::Filtered>; + soa::Filtered>; using FilteredJetsPartLevel = - soa::Filtered>; + soa::Filtered>; using FilteredMatchedJetsDetLevel = soa::Filtered>; + aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets>>; using FilteredMatchedJetsPartLevel = soa::Filtered>; + aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents, + aod::ChargedMCParticleLevelJetsMatchedToChargedMCDetectorLevelJets>>; using FilteredTracks = soa::Filtered; using FilteredParticles = soa::Filtered; @@ -138,9 +138,9 @@ struct RecoilJets { AxisSpec rho{50, 0.0, 50., "#it{#rho}"}; Preslice partJetsPerCollision = - aod::jet::mcCollisionId; + aod::jet::mcCollisionId; - TRandom3 *rand = new TRandom3(0); + TRandom3* rand = new TRandom3(0); // Declare filter on collision Z vertex Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; @@ -148,8 +148,8 @@ struct RecoilJets { // Declare filters on accepted tracks and MC particles (settings for jet reco // are provided in the jet finder wagon) - Filter trackFilter = aod::jtrack::pt > trkPtMin &&aod::jtrack::pt < - trkPtMax &&nabs(aod::jtrack::eta) < trkEtaCut; + Filter trackFilter = aod::jtrack::pt > trkPtMin&& aod::jtrack::pt < + trkPtMax&& nabs(aod::jtrack::eta) < trkEtaCut; Filter partFilter = nabs(aod::jmcparticle::eta) < trkEtaCut; // Declare filter on jets @@ -163,31 +163,32 @@ struct RecoilJets { Service pdg; - void init(InitContext const &) { + void init(InitContext const&) + { std::string evSelToString = static_cast(evSel); std::string trkSelToString = static_cast(trkSel); eventSelectionBits = - jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); + jetderiveddatautilities::initialiseEventSelectionBits(evSelToString); trackSelection = - jetderiveddatautilities::initialiseTrackSelection(trkSelToString); + jetderiveddatautilities::initialiseTrackSelection(trkSelToString); triggerMaskBits = - jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); + jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); // List of raw and MC det. distributions if (doprocessData || doprocessMCDetLevel || doprocessMCDetLevelWeighted) { spectra.add("hEventSelectionCount", "Count # of events in the analysis", kTH1F, {{3, 0.0, 3.}}); spectra.get(HIST("hEventSelectionCount")) - ->GetXaxis() - ->SetBinLabel(1, "Total # of events"); + ->GetXaxis() + ->SetBinLabel(1, "Total # of events"); spectra.get(HIST("hEventSelectionCount")) - ->GetXaxis() - ->SetBinLabel( - 2, Form("# of events after sel. %s", evSelToString.data())); + ->GetXaxis() + ->SetBinLabel( + 2, Form("# of events after sel. %s", evSelToString.data())); spectra.get(HIST("hEventSelectionCount")) - ->GetXaxis() - ->SetBinLabel(3, "# of events w. outlier"); + ->GetXaxis() + ->SetBinLabel(3, "# of events w. outlier"); spectra.add("vertexZ", "Z vertex of collisions", kTH1F, {{60, -12., 12.}}); @@ -195,29 +196,29 @@ struct RecoilJets { "Has det. level coll. associat. MC coll.", kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hHasAssocMcCollision")) - ->GetXaxis() - ->SetBinLabel(1, "Yes"); + ->GetXaxis() + ->SetBinLabel(1, "Yes"); spectra.get(HIST("hHasAssocMcCollision")) - ->GetXaxis() - ->SetBinLabel(2, "No"); + ->GetXaxis() + ->SetBinLabel(2, "No"); spectra.add("hTrackSelectionCount", "Count # of tracks in the analysis", kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hTrackSelectionCount")) - ->GetXaxis() - ->SetBinLabel(1, "Total # of tracks"); + ->GetXaxis() + ->SetBinLabel(1, "Total # of tracks"); spectra.get(HIST("hTrackSelectionCount")) - ->GetXaxis() - ->SetBinLabel( - 2, Form("# of tracks after sel. %s", trkSelToString.data())); + ->GetXaxis() + ->SetBinLabel( + 2, Form("# of tracks after sel. %s", trkSelToString.data())); spectra.add("hTrackPtEtaPhi", "Charact. of tracks", kTH3F, {pT, pseudorap, phiAngle}); spectra.add( - "hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, - {{40, 10., - 50.}}); // needed to distinguish merged data from diff. wagons + "hTTSig_pT", "pT spectrum of all found TT_{Sig} cand.", kTH1F, + {{40, 10., + 50.}}); // needed to distinguish merged data from diff. wagons spectra.add("hNtrig", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); @@ -274,29 +275,29 @@ struct RecoilJets { "Count # of events in the part. level analysis", kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hEventSelectionCountPartLevel")) - ->GetXaxis() - ->SetBinLabel(1, "Total # of events"); + ->GetXaxis() + ->SetBinLabel(1, "Total # of events"); spectra.get(HIST("hEventSelectionCountPartLevel")) - ->GetXaxis() - ->SetBinLabel(2, "# of events w. outlier"); + ->GetXaxis() + ->SetBinLabel(2, "# of events w. outlier"); spectra.add("hCountNumberOutliersFrameWork", "Count # of outlier events based on flag from JE fw", kTH1F, {{1, 0.0, 1.}}); spectra.get(HIST("hCountNumberOutliersFrameWork")) - ->GetXaxis() - ->SetBinLabel(1, "Oulier flag true"); + ->GetXaxis() + ->SetBinLabel(1, "Oulier flag true"); spectra.add("hPartPtEtaPhi", "Charact. of particles", kTH3F, {pT, pseudorap, phiAngle}); spectra.add("hNtrig_Part", "Total number of selected triggers per class", kTH1F, {{2, 0.0, 2.}}); spectra.get(HIST("hNtrig_Part")) - ->GetXaxis() - ->SetBinLabel(1, "TT_{ref}"); + ->GetXaxis() + ->SetBinLabel(1, "TT_{ref}"); spectra.get(HIST("hNtrig_Part")) - ->GetXaxis() - ->SetBinLabel(2, "TT_{sig}"); + ->GetXaxis() + ->SetBinLabel(2, "TT_{sig}"); spectra.add("hTTRef_per_event_Part", "Number of TT_{Ref} per event", kTH1F, {{15, 0.5, 15.5}}); @@ -376,13 +377,13 @@ struct RecoilJets { // matched pair", kTH1F, {jetPTcorr}); spectra.add( - "hJetPt_resolution", - "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", - kTH2F, {{100, -5., 5.}, pT}); + "hJetPt_resolution", + "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{100, -5., 5.}, pT}); spectra.add( - "hJetPt_resolution_RecoilJets", - "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", - kTH2F, {{100, -5., 5.}, pT}); + "hJetPt_resolution_RecoilJets", + "Jet p_{T} relative resolution as a func. of jet #it{p}_{T, part}", + kTH2F, {{100, -5., 5.}, pT}); spectra.add("hJetPhi_resolution", "#varphi resolution as a func. of jet #it{p}_{T, part}", @@ -424,7 +425,8 @@ struct RecoilJets { // Fill histograms with raw or MC det. level data template void fillHistograms(Collision const& collision, Jets const& jets, - Tracks const& tracks, float weight = 1.) { + Tracks const& tracks, float weight = 1.) + { bool bSigEv = false; std::vector vPhiOfTT; double phiTT = 0.; @@ -518,8 +520,9 @@ struct RecoilJets { } template - void fillMCPHistograms(Collision const &collision, Jets const &jets, - Particles const &particles, float weight = 1.) { + void fillMCPHistograms(Collision const& collision, Jets const& jets, + Particles const& particles, float weight = 1.) + { bool bSigEv = false; std::vector vPhiOfTT; double phiTT = 0.; @@ -618,9 +621,10 @@ struct RecoilJets { } template - void fillMatchedHistograms(TracksTable const &tracks, - JetsBase const &jetsBase, JetsTag const &jetsTag, - float weight = 1.) { + void fillMatchedHistograms(TracksTable const& tracks, + JetsBase const& jetsBase, JetsTag const& jetsTag, + float weight = 1.) + { std::vector vPhiOfTT; double phiTTSig = 0.; float pTHat = getPtHat(weight); @@ -646,14 +650,15 @@ struct RecoilJets { for (const auto& jetBase : jetsBase) { bool bIsBaseJetRecoil = - get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; + get<1>(isRecoilJet(jetBase, phiTTSig)) && bIsThereTTSig; dataForUnfolding(jetBase, jetsTag, bIsBaseJetRecoil, weight); } } template - void fillMultiplicityHistograms(Collision const &collision, - float weight = 1.0) { + void fillMultiplicityHistograms(Collision const& collision, + float weight = 1.0) + { spectra.fill(HIST("hMultFT0A"), collision.multFT0A(), weight); spectra.fill(HIST("hMultFT0C"), collision.multFT0C(), weight); @@ -676,7 +681,8 @@ struct RecoilJets { //------------------------------------------------------------------------------ // Process functions void processData(FilteredColl const& collision, FilteredTracks const& tracks, - FilteredJets const& jets) { + FilteredJets const& jets) + { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision)) @@ -691,7 +697,8 @@ struct RecoilJets { void processMCDetLevel(FilteredColl const& collision, FilteredTracks const& tracks, - FilteredJetsDetLevel const& jets) { + FilteredJetsDetLevel const& jets) + { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -707,7 +714,8 @@ struct RecoilJets { void processMCDetLevelWeighted(FilteredCollDetLevelGetWeight const& collision, aod::JetMcCollisions const&, FilteredTracks const& tracks, - FilteredJetsDetLevel const& jets) { + FilteredJetsDetLevel const& jets) + { spectra.fill(HIST("hEventSelectionCount"), 0.5); if (skipEvent(collision) || skipMBGapEvent(collision)) return; @@ -730,7 +738,8 @@ struct RecoilJets { void processMCPartLevel(FilteredCollPartLevel const& collision, FilteredParticles const& particles, - FilteredJetsPartLevel const& jets) { + FilteredJetsPartLevel const& jets) + { spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; @@ -743,7 +752,8 @@ struct RecoilJets { void processMCPartLevelWeighted(FilteredCollPartLevel const& collision, FilteredParticles const& particles, - FilteredJetsPartLevel const& jets) { + FilteredJetsPartLevel const& jets) + { spectra.fill(HIST("hEventSelectionCountPartLevel"), 0.5); if (skipMBGapEvent(collision)) return; @@ -768,12 +778,13 @@ struct RecoilJets { aod::JetMcCollisions const&, FilteredTracks const& tracks, FilteredMatchedJetsDetLevel const& mcdjets, - FilteredMatchedJetsPartLevel const& mcpjets) { + FilteredMatchedJetsPartLevel const& mcpjets) + { if (skipEvent(collision) || skipMBGapEvent(collision)) return; auto mcpjetsPerMCCollision = - mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets); } @@ -781,16 +792,17 @@ struct RecoilJets { "process matching of MC jets (no weight)", false); void - processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, - aod::JetMcCollisions const&, - FilteredTracks const& tracks, - FilteredMatchedJetsDetLevel const& mcdjets, - FilteredMatchedJetsPartLevel const& mcpjets) { + processJetsMatchedWeighted(FilteredCollDetLevelGetWeight const& collision, + aod::JetMcCollisions const&, + FilteredTracks const& tracks, + FilteredMatchedJetsDetLevel const& mcdjets, + FilteredMatchedJetsPartLevel const& mcpjets) + { if (skipEvent(collision) || skipMBGapEvent(collision)) return; auto mcpjetsPerMCCollision = - mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); + mcpjets.sliceBy(partJetsPerCollision, collision.mcCollisionId()); auto weight = collision.mcCollision().weight(); fillMatchedHistograms(tracks, mcpjetsPerMCCollision, mcdjets, weight); @@ -798,7 +810,8 @@ struct RecoilJets { PROCESS_SWITCH(RecoilJets, processJetsMatchedWeighted, "process matching of MC jets (weighted)", false); - void processMultiplicity(FilteredEventMultiplicity const& collision) { + void processMultiplicity(FilteredEventMultiplicity const& collision) + { if (skipEvent(collision)) return; @@ -809,48 +822,58 @@ struct RecoilJets { //------------------------------------------------------------------------------ // Auxiliary functions - template bool skipEvent(const Collision &coll) { + template + bool skipEvent(const Collision& coll) + { /// \brief: trigger cut is needed for pp data return !jetderiveddatautilities::selectCollision(coll, eventSelectionBits) || !jetderiveddatautilities::selectTrigger(coll, triggerMaskBits); } - template bool skipMBGapEvent(const Collision &coll) { + template + bool skipMBGapEvent(const Collision& coll) + { return skipMBGapEvents && coll.subGeneratorId() == - jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; + jetderiveddatautilities::JCollisionSubGeneratorId::mbGap; } - template bool skipTrack(const Track &track) { + template + bool skipTrack(const Track& track) + { return !jetderiveddatautilities::selectTrack(track, trackSelection); } template - std::tuple isRecoilJet(const Jet &jet, double phiTT) { + std::tuple isRecoilJet(const Jet& jet, double phiTT) + { double dphi = std::fabs( - RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); + RecoDecay::constrainAngle(jet.phi() - phiTT, -constants::math::PI)); return {dphi, (constants::math::PI - recoilRegion) < dphi}; } - double getPhiTT(const std::vector &vPhiOfTT) { + double getPhiTT(const std::vector& vPhiOfTT) + { auto iTrig = rand->Integer(vPhiOfTT.size()); return vPhiOfTT[iTrig]; } - float getPtHat(float weight) { + float getPtHat(float weight) + { return 10. / (std::pow(weight, 1.0 / pTHatExponent)); } template - void dataForUnfolding(PartJet const &partJet, DetJet const &detJets, - bool bIsBaseJetRecoil, float weight = 1.0) { + void dataForUnfolding(PartJet const& partJet, DetJet const& detJets, + bool bIsBaseJetRecoil, float weight = 1.0) + { bool bIsThereMatchedJet = partJet.has_matchedJetGeo(); if (bIsThereMatchedJet) { const auto& jetsMatched = - partJet.template matchedJetGeo_as>(); + partJet.template matchedJetGeo_as>(); for (const auto& jetMatched : jetsMatched) { spectra.fill(HIST("hNumberMatchedJetsPerOneBaseJet"), @@ -892,6 +915,7 @@ struct RecoilJets { } }; -WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) { +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ return WorkflowSpec{adaptAnalysisTask(cfgc)}; }