From 557a0f0fd458a49bc0870d2e3ea703206923a03f Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Wed, 7 Feb 2024 17:51:29 +0900 Subject: [PATCH 1/6] Extensive overhauls of code, now added MC functionality --- PWGJE/Tasks/phiInJets.cxx | 602 ++++++++++++++++++++++++++++++++------ 1 file changed, 509 insertions(+), 93 deletions(-) diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index 16e42aa8fe4..1c7dc9d4c51 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -32,7 +32,6 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Multiplicity.h" -// #include "Common/DataModel/Centrality.h" #include "Common/DataModel/PIDResponse.h" #include "CommonConstants/PhysicsConstants.h" @@ -48,10 +47,22 @@ using namespace o2::framework::expressions; struct phiInJets { SliceCache cache; - // Preslice perCollision = aod::track::collisionId; HistogramRegistry JEhistos{"JEhistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry LFhistos{"LFhistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - + + HistogramRegistry registry{"registry", + {{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, + {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, + {"h_matched_REC_jet_pt", "matched_REC level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.},{400, -20., 20.}}}}, + {"h_matched_REC_jet_eta", "matched_REC level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0},{400, -20., 20.}}}}, + {"h_matched_REC_jet_phi", "matched_REC level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.},{400, -20., 20.}}}}, + {"h_matched_GEN_jet_pt", "matched_GEN level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.},{400, -20., 20.}}}}, + {"h_matched_GEN_jet_eta", "matched_GEN level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0},{400, -20., 20.}}}}, + {"h_matched_GEN_jet_phi", "matched_GEN level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.},{400, -20., 20.}}}}, + {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, + {"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}}}; + Configurable cfgeventSelections{"cfgeventSelections", "sel8", "choose event selection"}; Configurable cfgtrackSelections{"cfgtrackSelections", "globalTracks", "set track selections"}; @@ -85,14 +96,39 @@ struct phiInJets { const AxisSpec MinvAxis = {400, 0.95, 1.35}; const AxisSpec PtAxis = {200, 0, 20.0}; const AxisSpec MultAxis = {100, 0, 100}; + const AxisSpec dRAxis = {100, 0, 3.6}; + + JEhistos.add("ptJEHistogramPion", "ptJEHistogramPion", kTH1F, {PtAxis}); + JEhistos.add("ptJEHistogramKaon", "ptJEHistogramKaon", kTH1F, {PtAxis}); + JEhistos.add("ptJEHistogramProton", "ptJEHistogramProton", kTH1F, {PtAxis}); + JEhistos.add("ptJEHistogramPhi", "ptJEHistogramPhi", kTH1F, {PtAxis}); + JEhistos.add("minvJEHistogramPhi", "minvJEHistogramPhi", kTH1F, {MinvAxis}); + + JEhistos.add("ptGeneratedPion", "ptGeneratedPion", kTH1F, {PtAxis}); + JEhistos.add("ptGeneratedKaon", "ptGeneratedKaon", kTH1F, {PtAxis}); + JEhistos.add("ptGeneratedProton", "ptGeneratedProton", kTH1F, {PtAxis}); + JEhistos.add("ptGeneratedPhi", "ptGeneratedPhi", kTH1F, {PtAxis}); + JEhistos.add("mGeneratedPhi", "mGeneratedPhi", kTH1F, {MinvAxis}); JEhistos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); JEhistos.add("phiHistogram", "phiHistogram", kTH1F, {axisPhi}); JEhistos.add("FJetaHistogram", "FJetaHistogram", kTH1F, {axisEta}); JEhistos.add("FJphiHistogram", "FJphiHistogram", kTH1F, {axisPhi}); JEhistos.add("FJptHistogram", "FJptHistogram", kTH1F, {axisPt}); - + JEhistos.add("FJetaHistogram_MCRec", "FJetaHistogram_MCRec", kTH1F, {axisEta}); + JEhistos.add("FJphiHistogram_MCRec", "FJphiHistogram_MCRec", kTH1F, {axisPhi}); + JEhistos.add("FJptHistogram_MCRec", "FJptHistogram_MCRec", kTH1F, {axisPt}); + JEhistos.add("FJetaHistogram_MCTrue", "FJetaHistogram_MCTrue", kTH1F, {axisEta}); + JEhistos.add("FJphiHistogram_MCTrue", "FJphiHistogram_MCTrue", kTH1F, {axisPhi}); + JEhistos.add("FJptHistogram_MCTrue", "FJptHistogram_MCTrue", kTH1F, {axisPt}); + + JEhistos.add("FJnchHistogram", "FJnchHistogram", kTH1F, {MultAxis}); JEhistos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); + JEhistos.add("nEvents_MCRec", "nEvents_MCRec", kTH1F, {{4, 0.0, 4.0}}); + JEhistos.add("nEvents_MCGen", "nEvents_MCGen", kTH1F, {{4, 0.0, 4.0}}); + + JEhistos.add("nJetsPerEvent", "nJetsPerEvent", kTH1F, {{10, 0.0, 10.0}}); + JEhistos.add("hDCArToPv", "DCArToPv", kTH1F, {{300, 0.0, 3.0}}); JEhistos.add("hDCAzToPv", "DCAzToPv", kTH1F, {{300, 0.0, 3.0}}); JEhistos.add("rawpT", "rawpT", kTH1F, {{1000, 0.0, 10.0}}); @@ -106,57 +142,41 @@ struct phiInJets { JEhistos.add("hTPCChi2", "hTPCChi2", kTH1F, {{200, 0, 100}}); JEhistos.add("hITSChi2", "hITSChi2", kTH1F, {{200, 0, 100}}); - JEhistos.add("hUSS", "hUSS", kTH3F, {MultAxis, PtAxis, MinvAxis}); + JEhistos.add("hUSS", "hUSS", kTH3F, {dRAxis, PtAxis, MinvAxis}); JEhistos.add("hUSS_1D", "hUSS_1D", kTH1F, {MinvAxis}); JEhistos.add("hUSS_1D_2_3", "hUSS_1D_2_3", kTH1F, {MinvAxis}); - - JEhistos.add("hLSS", "hLSS", kTH3F, {MultAxis, PtAxis, MinvAxis}); + JEhistos.add("hLSS", "hLSS", kTH3F, {dRAxis, PtAxis, MinvAxis}); JEhistos.add("hLSS_1D", "hLSS_1D", kTH1F, {MinvAxis}); JEhistos.add("hLSS_1D_2_3", "hLSS_1D_2_3", kTH1F, {MinvAxis}); - - JEhistos.add("hUSS_INSIDE", "hUSS_INSIDE", kTH3F, {MultAxis, PtAxis, MinvAxis}); + JEhistos.add("hUSS_INSIDE", "hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); JEhistos.add("hUSS_INSIDE_1D", "hUSS_INSIDE_1D", kTH1F, {MinvAxis}); JEhistos.add("hUSS_INSIDE_1D_2_3", "hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis}); - - JEhistos.add("hLSS_INSIDE", "hLSS_INSIDE", kTH3F, {MultAxis, PtAxis, MinvAxis}); + JEhistos.add("hLSS_INSIDE", "hLSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); JEhistos.add("hLSS_INSIDE_1D", "hLSS_INSIDE_1D", kTH1F, {MinvAxis}); JEhistos.add("hLSS_INSIDE_1D_2_3", "hLSS_INSIDE_1D_2_3", kTH1F, {MinvAxis}); - - JEhistos.add("hUSS_OUTSIDE", "hUSS_OUTSIDE", kTH3F, {MultAxis, PtAxis, MinvAxis}); + JEhistos.add("hUSS_OUTSIDE", "hUSS_OUTSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); JEhistos.add("hUSS_OUTSIDE_1D", "hUSS_OUTSIDE_1D", kTH1F, {MinvAxis}); JEhistos.add("hUSS_OUTSIDE_1D_2_3", "hUSS_OUTSIDE_1D_2_3", kTH1F, {MinvAxis}); - - JEhistos.add("hLSS_OUTSIDE", "hLSS_OUTSIDE", kTH3F, {MultAxis, PtAxis, MinvAxis}); + JEhistos.add("hLSS_OUTSIDE", "hLSS_OUTSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); JEhistos.add("hLSS_OUTSIDE_1D", "hLSS_OUTSIDE_1D", kTH1F, {MinvAxis}); JEhistos.add("hLSS_OUTSIDE_1D_2_3", "hLSS_OUTSIDE_1D_2_3", kTH1F, {MinvAxis}); - JEhistos.add("hMultFT0M", "hMultFT0M", kTH1F, {MultAxis}); - - LFhistos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); - LFhistos.add("phiHistogram", "phiHistogram", kTH1F, {axisPhi}); - LFhistos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); - LFhistos.add("hDCArToPv", "DCArToPv", kTH1F, {{300, 0.0, 3.0}}); - LFhistos.add("hDCAzToPv", "DCAzToPv", kTH1F, {{300, 0.0, 3.0}}); - LFhistos.add("rawpT", "rawpT", kTH1F, {{1000, 0.0, 10.0}}); - LFhistos.add("rawDpT", "rawDpT", kTH2F, {{1000, 0.0, 10.0}, {300, -1.5, 1.5}}); - LFhistos.add("hIsPrim", "hIsPrim", kTH1F, {{2, -0.5, +1.5}}); - LFhistos.add("hIsGood", "hIsGood", kTH1F, {{2, -0.5, +1.5}}); - LFhistos.add("hIsPrimCont", "hIsPrimCont", kTH1F, {{2, -0.5, +1.5}}); - LFhistos.add("hFindableTPCClusters", "hFindableTPCClusters", kTH1F, {{200, 0, 200}}); - LFhistos.add("hFindableTPCRows", "hFindableTPCRows", kTH1F, {{200, 0, 200}}); - LFhistos.add("hClustersVsRows", "hClustersVsRows", kTH1F, {{200, 0, 2}}); - LFhistos.add("hTPCChi2", "hTPCChi2", kTH1F, {{200, 0, 100}}); - LFhistos.add("hITSChi2", "hITSChi2", kTH1F, {{200, 0, 100}}); - - LFhistos.add("hUSS", "hUSS", kTH3F, {MultAxis, PtAxis, MinvAxis}); - LFhistos.add("hUSS_1D", "hUSS_1D", kTH1F, {MinvAxis}); - LFhistos.add("hUSS_1D_2_3", "hUSS_1D_2_3", kTH1F, {MinvAxis}); - - LFhistos.add("hLSS", "hLSS", kTH3F, {MultAxis, PtAxis, MinvAxis}); - LFhistos.add("hLSS_1D", "hLSS_1D", kTH1F, {MinvAxis}); - LFhistos.add("hLSS_1D_2_3", "hLSS_1D_2_3", kTH1F, {MinvAxis}); - - LFhistos.add("hMultFT0M", "hMultFT0M", kTH1F, {MultAxis}); + JEhistos.add("hMCTrue_hUSS_INSIDE", "hMCTrue_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); + JEhistos.add("hMCTrue_hUSS_INSIDE_1D", "hMCTrue_hUSS_INSIDE_1D", kTH1F, {MinvAxis}); + JEhistos.add("hMCTrue_hUSS_INSIDE_1D_2_3", "hMCTrue_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis}); + JEhistos.add("hMCTrue_hUSS_OUTSIDE", "hMCTrue_hUSS_OUTSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); + JEhistos.add("hMCTrue_hUSS_OUTSIDE_1D", "hMCTrue_hUSS_OUTSIDE_1D", kTH1F, {MinvAxis}); + JEhistos.add("hMCTrue_hUSS_OUTSIDE_1D_2_3", "hMCTrue_hUSS_OUTSIDE_1D_2_3", kTH1F, {MinvAxis}); + + JEhistos.add("hMCRec_hUSS", "hMCRec_hUSS", kTH3F, {dRAxis, PtAxis, MinvAxis}); + JEhistos.add("hMCRec_hUSS_1D", "hMCRec_hUSS_1D", kTH1F, {MinvAxis}); + JEhistos.add("hMCRec_hUSS_1D_2_3", "hMCRec_hUSS_1D_2_3", kTH1F, {MinvAxis}); + JEhistos.add("hMCRec_hUSS_INSIDE", "hMCRec_hUSS_INSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); + JEhistos.add("hMCRec_hUSS_INSIDE_1D", "hMCRec_hUSS_INSIDE_1D", kTH1F, {MinvAxis}); + JEhistos.add("hMCRec_hUSS_INSIDE_1D_2_3", "hMCRec_hUSS_INSIDE_1D_2_3", kTH1F, {MinvAxis}); + JEhistos.add("hMCRec_hUSS_OUTSIDE", "hMCRec_hUSS_OUTSIDE", kTH3F, {dRAxis, PtAxis, MinvAxis}); + JEhistos.add("hMCRec_hUSS_OUTSIDE_1D", "hMCRec_hUSS_OUTSIDE_1D", kTH1F, {MinvAxis}); + JEhistos.add("hMCRec_hUSS_OUTSIDE_1D_2_3", "hMCRec_hUSS_OUTSIDE_1D_2_3", kTH1F, {MinvAxis}); // EVENT SELECTION eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(cfgeventSelections)); @@ -164,12 +184,15 @@ struct phiInJets { } // end of init double massKa = o2::constants::physics::MassKPlus; + using EventCandidates = soa::Join; // , aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs using TrackCandidates = soa::Join; Filter jetCuts = aod::jet::pt > cfgjetPtMin&& aod::jet::r == nround(cfgjetR.node() * 100.0f); // Function for track quality cuts + ///////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// template bool trackSelection(const TrackType track) { @@ -195,17 +218,19 @@ struct phiInJets { if (std::abs(track.tpcCrossedRowsOverFindableCls()) > cfgnRowsOverFindable) return false; - if (std::abs(track.tpcChi2NCl() > cfgnTPCChi2)) + if (std::abs(track.tpcChi2NCl()) > cfgnTPCChi2) return false; - if (std::abs(track.itsChi2NCl() > cfgnITSChi2)) + if (std::abs(track.itsChi2NCl()) > cfgnITSChi2) return false; if (cfgConnectedToPV && !track.isPVContributor()) return false; return true; }; - + ///////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// + template bool trackPID(const T& candidate) { @@ -225,19 +250,22 @@ struct phiInJets { } return false; } - + ///////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// + template void minvReconstruction(double mult, const TracksType& trk1, const TracksType& trk2, const JetType& jets) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + if (!trackSelection(trk1) || !trackSelection(trk2)) return; if (!trackPID(trk1) || !trackPID(trk2)) return; - if (trk1.index() == trk2.index()) + if (trk1.index() >= trk2.index()) return; // We need to run (0,1), (1,0) pairs as well. but same id pairs are not needed. lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); @@ -247,21 +275,31 @@ struct phiInJets { if (std::abs(lResonance.Rapidity()) > 0.5) return; + ///////////////////////////////////////////////////////////////////////////// + //Fill Global Event Minv if (trk1.sign() * trk2.sign() < 0) { - JEhistos.fill(HIST("hUSS_1D"), lResonance.M()); + if(!IsMC){ + JEhistos.fill(HIST("hUSS_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS"), mult, lResonance.Pt(), lResonance.M()); + } - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_1D_2_3"), lResonance.M()); + if(IsMC){ + JEhistos.fill(HIST("hMCRec_hUSS_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS"), mult, lResonance.Pt(), lResonance.M()); + } - JEhistos.fill(HIST("hUSS"), mult, lResonance.Pt(), lResonance.M()); } else if (trk1.sign() * trk2.sign() > 0) { JEhistos.fill(HIST("hLSS_1D"), lResonance.M()); if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) JEhistos.fill(HIST("hLSS_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hLSS"), mult, lResonance.Pt(), lResonance.M()); } + ///////////////////////////////////////////////////////////////////////////// bool jetFlag = false; for (auto const& jet : jets) { @@ -272,44 +310,70 @@ struct phiInJets { if (R < cfgjetR) jetFlag = true; } + + ///////////////////////////////////////////////////////////////////////////// + //Fill inside Jet if (jetFlag) { if (trk1.sign() * trk2.sign() < 0) { - JEhistos.fill(HIST("hUSS_INSIDE_1D"), lResonance.M()); - - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_INSIDE_1D_2_3"), lResonance.M()); - - JEhistos.fill(HIST("hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + if(!IsMC){ + JEhistos.fill(HIST("hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + + if(IsMC){ + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + } else if (trk1.sign() * trk2.sign() > 0) { JEhistos.fill(HIST("hLSS_INSIDE_1D"), lResonance.M()); if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) JEhistos.fill(HIST("hLSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hLSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); } } // jetflag + ///////////////////////////////////////////////////////////////////////////// + + + ///////////////////////////////////////////////////////////////////////////// + //Fill outside Jet if (!jetFlag) { if (trk1.sign() * trk2.sign() < 0) { - JEhistos.fill(HIST("hUSS_OUTSIDE_1D"), lResonance.M()); - - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + if(!IsMC){ + JEhistos.fill(HIST("hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + + if(IsMC){ + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); + } - JEhistos.fill(HIST("hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); } else if (trk1.sign() * trk2.sign() > 0) { JEhistos.fill(HIST("hLSS_OUTSIDE_1D"), lResonance.M()); if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) JEhistos.fill(HIST("hLSS_OUTSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hLSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); } } //! jetflag + ///////////////////////////////////////////////////////////////////////////// } // MinvReconstruction + ///////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// + int nEvents = 0; - void processJetTracks(aod::JCollision const& collision, soa::Filtered const& chargedjets, soa::Join const& tracks, TrackCandidates const&) + void processJetTracks(aod::JCollision const& collision, soa::Filtered> const& chargedjets, soa::Join const& tracks, TrackCandidates const&) { if (cDebugLevel > 0) { nEvents++; @@ -320,19 +384,27 @@ struct phiInJets { if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) return; - + if(fabs(collision.posZ())>10) + return; + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { auto trk1 = track1.track_as>(); auto trk2 = track2.track_as>(); minvReconstruction(1.0, trk1, trk2, chargedjets); } + int nJets = 0; for (auto chargedjet : chargedjets) { JEhistos.fill(HIST("FJetaHistogram"), chargedjet.eta()); JEhistos.fill(HIST("FJphiHistogram"), chargedjet.phi()); JEhistos.fill(HIST("FJptHistogram"), chargedjet.pt()); + JEhistos.fill(HIST("FJnchHistogram"), chargedjet.tracks().size()); + nJets++; } + JEhistos.fill(HIST("nJetsPerEvent"), nJets); + JEhistos.fill(HIST("nEvents"), 1.5); + for (auto const& track : tracks) { auto originalTrack = track.track_as>(); JEhistos.fill(HIST("hDCArToPv"), originalTrack.dcaXY()); @@ -358,37 +430,381 @@ struct phiInJets { }; // Process Switch PROCESS_SWITCH(phiInJets, processJetTracks, "process JE Framework", true); - void processLFTracks(EventCandidates::iterator const& collision, TrackCandidates const& tracks) + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////MC STUFF//////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + using myCompleteTracks = soa::Join; + using myCompleteJetTracks = soa::Join; + int nJEEvents = 0; + void processRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) + { + if (cDebugLevel > 0) { + nJEEvents++; + if ((nJEEvents + 1) % 10000 == 0) + std::cout << "JEvents: "<< nJEEvents << std::endl; + } + + JEhistos.fill(HIST("nEvents_MCRec"), 0.5); + if(fabs(collision.posZ())>10) + return; + if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + return; + JEhistos.fill(HIST("nEvents_MCRec"), 1.5); + + //Track Eff + for (const auto& track : tracks) { + auto originalTrack = track.track_as(); + if (!trackSelection(originalTrack)) + continue; + if(track.has_mcParticle()){ + auto mcParticle = track.mcParticle(); + if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<=0.5){ // do this in the context of the track ! (context matters!!!) + if(abs(mcParticle.pdgCode())==211) JEhistos.fill(HIST("ptJEHistogramPion"), mcParticle.pt()); + if(abs(mcParticle.pdgCode())==321) JEhistos.fill(HIST("ptJEHistogramKaon"), mcParticle.pt()); + if(abs(mcParticle.pdgCode())==2212) JEhistos.fill(HIST("ptJEHistogramProton"), mcParticle.pt()); + } + } + } + + //Jet Eff + for (auto& mcdjet : mcdjets) { + registry.fill(HIST("h_jet_pt"), mcdjet.pt()); + registry.fill(HIST("h_jet_eta"), mcdjet.eta()); + registry.fill(HIST("h_jet_phi"), mcdjet.phi()); + } + //Phi Eff + + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))){ + auto trk1 = track1.track_as(); + auto trk2 = track2.track_as(); + if (trk1.index() >= trk2.index()) + continue; + if(fabs(trk1.eta())>0.8 || fabs(trk2.eta())>0.8) + continue; + + if (!trackSelection(trk1)) + continue; + if (!trackSelection(trk2)) + continue; + if((trk1.sign()*trk2.sign())>0) + continue; //Not K+K- + if(!track1.has_mcParticle()) + continue; + if(!track2.has_mcParticle()) + continue; + + auto part1 = track1.mcParticle(); + auto part2 = track2.mcParticle(); + if(fabs(part1.pdgCode())!= 321) + continue; //Not Kaon + if(fabs(part2.pdgCode())!= 321) + continue; //Not Kaon + if(!part1.has_mothers()) + continue; //Not decaying Kaon + if(!part2.has_mothers()) + continue; //Not decaying Kaon + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for(auto& part1_mom : part1.mothers_as()){ + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); + } + if(mothers1.size() > 1) + continue; //Strange multi-mother decay + + std::vector mothers2{}; + std::vector mothers2PDG{}; + for(auto& part2_mom : part2.mothers_as()){ + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + + if(mothers2.size() > 1) + continue; //Strange multi-mother decay + if(mothers1PDG[0] != 333) + continue; //mother not phi + if(mothers2PDG[0] != 333) + continue; //mother not phi + if(mothers1[0] != mothers2[0]) + continue; //Kaons not from the same phi + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lResonance = lDecayDaughter1 + lDecayDaughter2; + if(lResonance.Rapidity()>0.5) + continue; + JEhistos.fill(HIST("ptJEHistogramPhi"), lResonance.Pt()); + JEhistos.fill(HIST("minvJEHistogramPhi"), lResonance.M()); + + + }//end of phi check + } + PROCESS_SWITCH(phiInJets, processRec, "pikp detector level MC JE", true); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void processSim(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets ) { + JEhistos.fill(HIST("nEvents_MCGen"), 0.5); - LFhistos.fill(HIST("nEvents"), 0.5); - if (!collision.sel8()) + if(fabs(collision.posZ())>10) return; + JEhistos.fill(HIST("nEvents_MCGen"), 1.5); - LFhistos.fill(HIST("hMultFT0M"), collision.multFT0M()); + //Check pikp and phi + for (const auto& mcParticle : mcParticles) { + if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<=0.5){ // watch out for context!!! + if(abs(mcParticle.pdgCode())==211) JEhistos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); + if(abs(mcParticle.pdgCode())==321) JEhistos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); + if(abs(mcParticle.pdgCode())==2212) JEhistos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); + + } + if(fabs(mcParticle.y())<=0.5){ // watch out for context!!! + TLorentzVector lResonance; + lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + if(abs(mcParticle.pdgCode())==333) JEhistos.fill(HIST("ptGeneratedPhi"), mcParticle.pt()); + if(abs(mcParticle.pdgCode())==333) JEhistos.fill(HIST("mGeneratedPhi"), lResonance.M()); + } + } + //Check jets + for (auto& mcpjet : mcpjets) { + registry.fill(HIST("h_part_jet_pt"), mcpjet.pt()); + registry.fill(HIST("h_part_jet_eta"), mcpjet.eta()); + registry.fill(HIST("h_part_jet_phi"), mcpjet.phi()); + } + + + } + PROCESS_SWITCH(phiInJets, processSim, "pikp particle level MC", true); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + using JetMCPTable = soa::Filtered>; + using JetMCDTable = soa::Filtered>; + + // void processMatchedGen(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) + void processMatchedGen(aod::JMcCollision const& collision, + JetMCDTable const& mcdjets, + JetMCPTable const& mcpjets, + aod::JMcParticles const& mcParticles) + + { + // if(fabs(collision.posZ())>10) + // return; + + std::vector mcd_pt{}; + std::vector mcd_phi{}; + std::vector mcd_eta{}; + std::vector mcp_pt{}; + std::vector mcp_phi{}; + std::vector mcp_eta{}; + + for (auto& mcpjet : mcpjets) { + if(!mcpjet.has_matchedJetGeo()) + continue; + + for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { + if(!mcdjet.has_matchedJetGeo()) + continue; + + registry.fill(HIST("h_matched_GEN_jet_pt"), mcpjet.pt(), mcdjet.pt()-mcpjet.pt()); + registry.fill(HIST("h_matched_GEN_jet_phi"), mcpjet.phi(), mcdjet.phi()-mcpjet.phi()); + registry.fill(HIST("h_matched_GEN_jet_eta"), mcpjet.eta(), mcdjet.eta()-mcpjet.eta()); + + mcd_pt.push_back(mcdjet.pt()); + mcd_eta.push_back(mcdjet.eta()); + mcd_phi.push_back(mcdjet.phi()); + mcp_pt.push_back(mcpjet.pt()); + mcp_eta.push_back(mcpjet.eta()); + mcp_phi.push_back(mcpjet.phi()); + } //mcpjets + } //mcdjets + + + + //First we do GEN part + for (const auto& mcParticle : mcParticles) { + if(fabs(mcParticle.y())>0.5) + continue; + if(fabs(mcParticle.eta()>0.8)) + continue; + if(abs(mcParticle.pdgCode())==333){ + + TLorentzVector lResonance; + lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + bool jetFlag = false; + for(int i=0; i 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + }//jetflag + if(!jetFlag){ + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D"), lResonance.M()); + + if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + }//!jetflag + }//chech for phi + }//MC Particles + }//main fcn + PROCESS_SWITCH(phiInJets, processMatchedGen, "phi matched level MC", true); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + // void processMatchedRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) + void processMatchedRec(aod::JCollision const& collision, + JetMCDTable const& mcdjets, + JetMCPTable const& mcpjets, + myCompleteJetTracks const& tracks, + myCompleteTracks const& originalTracks, + aod::McParticles const&) + { + if(fabs(collision.posZ())>10) + return; + if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + return; + + std::vector mcd_pt{}; + std::vector mcd_phi{}; + std::vector mcd_eta{}; + std::vector mcp_pt{}; + std::vector mcp_phi{}; + std::vector mcp_eta{}; + + // std::vector mcp_ID{}; + // std::vector mcp_ID{}; + + for (auto& mcdjet : mcdjets) { + if(!mcdjet.has_matchedJetGeo()) + continue; + for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + if(!mcpjet.has_matchedJetGeo()) + continue; + + registry.fill(HIST("h_matched_REC_jet_pt"), mcpjet.pt(), mcdjet.pt()-mcpjet.pt()); + registry.fill(HIST("h_matched_REC_jet_phi"), mcpjet.phi(), mcdjet.phi()-mcpjet.phi()); + registry.fill(HIST("h_matched_REC_jet_eta"), mcpjet.eta(), mcdjet.eta()-mcpjet.eta()); + + mcd_pt.push_back(mcdjet.pt()); + mcd_eta.push_back(mcdjet.eta()); + mcd_phi.push_back(mcdjet.phi()); + mcp_pt.push_back(mcpjet.pt()); + mcp_eta.push_back(mcpjet.eta()); + mcp_phi.push_back(mcpjet.phi()); + } //mcpjets + } //mcdjets + + //Now we do REC part + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))){ + auto trk1 = track1.track_as(); + auto trk2 = track2.track_as(); + if (trk1.index() >= trk2.index()) + continue; + if(fabs(trk1.eta())>0.8 || fabs(trk2.eta())>0.8) + continue; + if (!trackSelection(trk1)) + continue; + if (!trackSelection(trk2)) + continue; + if((trk1.sign()*trk2.sign())>0) + continue; //Not K+K- + if(!track1.has_mcParticle()) + continue; + if(!track2.has_mcParticle()) + continue; + + auto part1 = track1.mcParticle(); + auto part2 = track2.mcParticle(); + if(fabs(part1.pdgCode())!= 321) + continue; //Not Kaon + if(fabs(part2.pdgCode())!= 321) + continue; //Not Kaon + if(!part1.has_mothers()) + continue; //Not decaying Kaon + if(!part2.has_mothers()) + continue; //Not decaying Kaon + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for(auto& part1_mom : part1.mothers_as()){ + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); + } + if(mothers1.size() > 1) + continue; //Strange multi-mother decay + + std::vector mothers2{}; + std::vector mothers2PDG{}; + for(auto& part2_mom : part2.mothers_as()){ + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + if(mothers2.size() > 1) + continue; //Strange multi-mother decay + if(mothers1PDG[0] != 333) + continue; //mother not phi + if(mothers2PDG[0] != 333) + continue; //mother not phi + if(mothers1[0] != mothers2[0]) + continue; //Kaons not from the same phi + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lResonance = lDecayDaughter1 + lDecayDaughter2; + if(lResonance.Rapidity()>0.5) + continue; + + bool jetFlag = false; + for(int i=0; i 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + }//jetflag + if(!jetFlag){ + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); + + if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + }//!jetflag + }//tracks + }//main fcn + PROCESS_SWITCH(phiInJets, processMatchedRec, "phi matched Rec level MC", true); - LFhistos.fill(HIST("nEvents"), 1.5); - for (auto const& track : tracks) { - LFhistos.fill(HIST("hDCArToPv"), track.dcaXY()); - LFhistos.fill(HIST("hDCAzToPv"), track.dcaZ()); - LFhistos.fill(HIST("rawpT"), track.pt()); - LFhistos.fill(HIST("hIsPrim"), track.isPrimaryTrack()); - LFhistos.fill(HIST("hIsGood"), track.isGlobalTrackWoDCA()); - LFhistos.fill(HIST("hIsPrimCont"), track.isPVContributor()); - LFhistos.fill(HIST("hFindableTPCClusters"), track.tpcNClsFindable()); - LFhistos.fill(HIST("hFindableTPCRows"), track.tpcNClsCrossedRows()); - LFhistos.fill(HIST("hClustersVsRows"), track.tpcCrossedRowsOverFindableCls()); - LFhistos.fill(HIST("hTPCChi2"), track.tpcChi2NCl()); - LFhistos.fill(HIST("hITSChi2"), track.itsChi2NCl()); - - if (!trackSelection(track)) - continue; - LFhistos.fill(HIST("etaHistogram"), track.eta()); - LFhistos.fill(HIST("phiHistogram"), track.phi()); - } // LFTrack Loop - }; - PROCESS_SWITCH(phiInJets, processLFTracks, "Process tracks in resonance framework", true); }; // end of main struct From 7f5d09e872b7e454e390994e2e7b2469ec05914b Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 7 Feb 2024 08:59:17 +0000 Subject: [PATCH 2/6] Please consider the following formatting changes --- PWGJE/Tasks/phiInJets.cxx | 658 +++++++++++++++++++------------------- 1 file changed, 327 insertions(+), 331 deletions(-) diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index 5a78de002e4..08750c7bbcc 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -48,21 +48,21 @@ using namespace o2::framework::expressions; struct phiInJets { SliceCache cache; HistogramRegistry JEhistos{"JEhistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - + HistogramRegistry registry{"registry", {{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_matched_REC_jet_pt", "matched_REC level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.},{400, -20., 20.}}}}, - {"h_matched_REC_jet_eta", "matched_REC level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0},{400, -20., 20.}}}}, - {"h_matched_REC_jet_phi", "matched_REC level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.},{400, -20., 20.}}}}, - {"h_matched_GEN_jet_pt", "matched_GEN level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.},{400, -20., 20.}}}}, - {"h_matched_GEN_jet_eta", "matched_GEN level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0},{400, -20., 20.}}}}, - {"h_matched_GEN_jet_phi", "matched_GEN level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.},{400, -20., 20.}}}}, - {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_matched_REC_jet_pt", "matched_REC level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.}, {400, -20., 20.}}}}, + {"h_matched_REC_jet_eta", "matched_REC level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0}, {400, -20., 20.}}}}, + {"h_matched_REC_jet_phi", "matched_REC level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.}, {400, -20., 20.}}}}, + {"h_matched_GEN_jet_pt", "matched_GEN level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.}, {400, -20., 20.}}}}, + {"h_matched_GEN_jet_eta", "matched_GEN level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0}, {400, -20., 20.}}}}, + {"h_matched_GEN_jet_phi", "matched_GEN level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.}, {400, -20., 20.}}}}, + {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}}}; - + Configurable cfgeventSelections{"cfgeventSelections", "sel8", "choose event selection"}; Configurable cfgtrackSelections{"cfgtrackSelections", "globalTracks", "set track selections"}; @@ -121,7 +121,7 @@ struct phiInJets { JEhistos.add("FJetaHistogram_MCTrue", "FJetaHistogram_MCTrue", kTH1F, {axisEta}); JEhistos.add("FJphiHistogram_MCTrue", "FJphiHistogram_MCTrue", kTH1F, {axisPhi}); JEhistos.add("FJptHistogram_MCTrue", "FJptHistogram_MCTrue", kTH1F, {axisPt}); - + JEhistos.add("FJnchHistogram", "FJnchHistogram", kTH1F, {MultAxis}); JEhistos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); JEhistos.add("nEvents_MCRec", "nEvents_MCRec", kTH1F, {{4, 0.0, 4.0}}); @@ -230,7 +230,7 @@ struct phiInJets { }; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - + template bool trackPID(const T& candidate) { @@ -252,13 +252,12 @@ struct phiInJets { } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - + template void minvReconstruction(double mult, const TracksType& trk1, const TracksType& trk2, const JetType& jets) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!trackSelection(trk1) || !trackSelection(trk2)) return; @@ -276,20 +275,20 @@ struct phiInJets { return; ///////////////////////////////////////////////////////////////////////////// - //Fill Global Event Minv + // Fill Global Event Minv if (trk1.sign() * trk2.sign() < 0) { - if(!IsMC){ - JEhistos.fill(HIST("hUSS_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hUSS"), mult, lResonance.Pt(), lResonance.M()); + if (!IsMC) { + JEhistos.fill(HIST("hUSS_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS"), mult, lResonance.Pt(), lResonance.M()); } - if(IsMC){ - JEhistos.fill(HIST("hMCRec_hUSS_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS"), mult, lResonance.Pt(), lResonance.M()); + if (IsMC) { + JEhistos.fill(HIST("hMCRec_hUSS_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS"), mult, lResonance.Pt(), lResonance.M()); } } else if (trk1.sign() * trk2.sign() > 0) { @@ -312,23 +311,23 @@ struct phiInJets { } ///////////////////////////////////////////////////////////////////////////// - //Fill inside Jet + // Fill inside Jet if (jetFlag) { if (trk1.sign() * trk2.sign() < 0) { - if(!IsMC){ - JEhistos.fill(HIST("hUSS_INSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); - } - - if(IsMC){ - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); - } - + if (!IsMC) { + JEhistos.fill(HIST("hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + + if (IsMC) { + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + } else if (trk1.sign() * trk2.sign() > 0) { JEhistos.fill(HIST("hLSS_INSIDE_1D"), lResonance.M()); @@ -339,24 +338,23 @@ struct phiInJets { } // jetflag ///////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////// - //Fill outside Jet + // Fill outside Jet if (!jetFlag) { if (trk1.sign() * trk2.sign() < 0) { - if(!IsMC){ - JEhistos.fill(HIST("hUSS_OUTSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); - } - - if(IsMC){ - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); - } + if (!IsMC) { + JEhistos.fill(HIST("hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + + if (IsMC) { + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); + } } else if (trk1.sign() * trk2.sign() > 0) { @@ -371,7 +369,7 @@ struct phiInJets { ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - + int nEvents = 0; void processJetTracks(aod::JCollision const& collision, soa::Filtered> const& chargedjets, soa::Join const& tracks, TrackCandidates const&) { @@ -384,9 +382,9 @@ struct phiInJets { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) return; - + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { auto trk1 = track1.track_as>(); auto trk2 = track2.track_as>(); @@ -397,14 +395,13 @@ struct phiInJets { JEhistos.fill(HIST("FJetaHistogram"), chargedjet.eta()); JEhistos.fill(HIST("FJphiHistogram"), chargedjet.phi()); JEhistos.fill(HIST("FJptHistogram"), chargedjet.pt()); - JEhistos.fill(HIST("FJnchHistogram"), chargedjet.tracks().size()); + JEhistos.fill(HIST("FJnchHistogram"), chargedjet.tracks().size()); nJets++; } JEhistos.fill(HIST("nJetsPerEvent"), nJets); - JEhistos.fill(HIST("nEvents"), 1.5); - + for (auto const& track : tracks) { auto originalTrack = track.track_as>(); JEhistos.fill(HIST("hDCArToPv"), originalTrack.dcaXY()); @@ -430,260 +427,261 @@ struct phiInJets { }; // Process Switch PROCESS_SWITCH(phiInJets, processJetTracks, "process JE Framework", true); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////MC STUFF//////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - using myCompleteTracks = soa::Join; + using myCompleteTracks = soa::Join; using myCompleteJetTracks = soa::Join; int nJEEvents = 0; - void processRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) - { + void processRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) + { if (cDebugLevel > 0) { nJEEvents++; if ((nJEEvents + 1) % 10000 == 0) - std::cout << "JEvents: "<< nJEEvents << std::endl; + std::cout << "JEvents: " << nJEEvents << std::endl; } JEhistos.fill(HIST("nEvents_MCRec"), 0.5); - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) + return; + if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) return; - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) - return; JEhistos.fill(HIST("nEvents_MCRec"), 1.5); - //Track Eff + // Track Eff for (const auto& track : tracks) { - auto originalTrack = track.track_as(); + auto originalTrack = track.track_as(); if (!trackSelection(originalTrack)) continue; - if(track.has_mcParticle()){ - auto mcParticle = track.mcParticle(); - if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<=0.5){ // do this in the context of the track ! (context matters!!!) - if(abs(mcParticle.pdgCode())==211) JEhistos.fill(HIST("ptJEHistogramPion"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==321) JEhistos.fill(HIST("ptJEHistogramKaon"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==2212) JEhistos.fill(HIST("ptJEHistogramProton"), mcParticle.pt()); - } + if (track.has_mcParticle()) { + auto mcParticle = track.mcParticle(); + if (mcParticle.isPhysicalPrimary() && fabs(mcParticle.y()) <= 0.5) { // do this in the context of the track ! (context matters!!!) + if (abs(mcParticle.pdgCode()) == 211) + JEhistos.fill(HIST("ptJEHistogramPion"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 321) + JEhistos.fill(HIST("ptJEHistogramKaon"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 2212) + JEhistos.fill(HIST("ptJEHistogramProton"), mcParticle.pt()); + } } } - - //Jet Eff + + // Jet Eff for (auto& mcdjet : mcdjets) { registry.fill(HIST("h_jet_pt"), mcdjet.pt()); registry.fill(HIST("h_jet_eta"), mcdjet.eta()); registry.fill(HIST("h_jet_phi"), mcdjet.phi()); } - //Phi Eff - - for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))){ - auto trk1 = track1.track_as(); - auto trk2 = track2.track_as(); - if (trk1.index() >= trk2.index()) - continue; - if(fabs(trk1.eta())>0.8 || fabs(trk2.eta())>0.8) - continue; - - if (!trackSelection(trk1)) - continue; - if (!trackSelection(trk2)) - continue; - if((trk1.sign()*trk2.sign())>0) - continue; //Not K+K- - if(!track1.has_mcParticle()) - continue; - if(!track2.has_mcParticle()) - continue; - - auto part1 = track1.mcParticle(); - auto part2 = track2.mcParticle(); - if(fabs(part1.pdgCode())!= 321) - continue; //Not Kaon - if(fabs(part2.pdgCode())!= 321) - continue; //Not Kaon - if(!part1.has_mothers()) - continue; //Not decaying Kaon - if(!part2.has_mothers()) - continue; //Not decaying Kaon - - std::vector mothers1{}; - std::vector mothers1PDG{}; - for(auto& part1_mom : part1.mothers_as()){ - mothers1.push_back(part1_mom.globalIndex()); - mothers1PDG.push_back(part1_mom.pdgCode()); - } - if(mothers1.size() > 1) - continue; //Strange multi-mother decay - - std::vector mothers2{}; - std::vector mothers2PDG{}; - for(auto& part2_mom : part2.mothers_as()){ - mothers2.push_back(part2_mom.globalIndex()); - mothers2PDG.push_back(part2_mom.pdgCode()); - } - - if(mothers2.size() > 1) - continue; //Strange multi-mother decay - if(mothers1PDG[0] != 333) - continue; //mother not phi - if(mothers2PDG[0] != 333) - continue; //mother not phi - if(mothers1[0] != mothers2[0]) - continue; //Kaons not from the same phi - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); - lResonance = lDecayDaughter1 + lDecayDaughter2; - if(lResonance.Rapidity()>0.5) - continue; - JEhistos.fill(HIST("ptJEHistogramPhi"), lResonance.Pt()); - JEhistos.fill(HIST("minvJEHistogramPhi"), lResonance.M()); - - - }//end of phi check + // Phi Eff + + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { + auto trk1 = track1.track_as(); + auto trk2 = track2.track_as(); + if (trk1.index() >= trk2.index()) + continue; + if (fabs(trk1.eta()) > 0.8 || fabs(trk2.eta()) > 0.8) + continue; + + if (!trackSelection(trk1)) + continue; + if (!trackSelection(trk2)) + continue; + if ((trk1.sign() * trk2.sign()) > 0) + continue; // Not K+K- + if (!track1.has_mcParticle()) + continue; + if (!track2.has_mcParticle()) + continue; + + auto part1 = track1.mcParticle(); + auto part2 = track2.mcParticle(); + if (fabs(part1.pdgCode()) != 321) + continue; // Not Kaon + if (fabs(part2.pdgCode()) != 321) + continue; // Not Kaon + if (!part1.has_mothers()) + continue; // Not decaying Kaon + if (!part2.has_mothers()) + continue; // Not decaying Kaon + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& part1_mom : part1.mothers_as()) { + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); + } + if (mothers1.size() > 1) + continue; // Strange multi-mother decay + + std::vector mothers2{}; + std::vector mothers2PDG{}; + for (auto& part2_mom : part2.mothers_as()) { + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + + if (mothers2.size() > 1) + continue; // Strange multi-mother decay + if (mothers1PDG[0] != 333) + continue; // mother not phi + if (mothers2PDG[0] != 333) + continue; // mother not phi + if (mothers1[0] != mothers2[0]) + continue; // Kaons not from the same phi + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lResonance = lDecayDaughter1 + lDecayDaughter2; + if (lResonance.Rapidity() > 0.5) + continue; + JEhistos.fill(HIST("ptJEHistogramPhi"), lResonance.Pt()); + JEhistos.fill(HIST("minvJEHistogramPhi"), lResonance.M()); + + } // end of phi check } PROCESS_SWITCH(phiInJets, processRec, "pikp detector level MC JE", true); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void processSim(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets ) + void processSim(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) { JEhistos.fill(HIST("nEvents_MCGen"), 0.5); - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) return; JEhistos.fill(HIST("nEvents_MCGen"), 1.5); - //Check pikp and phi + // Check pikp and phi for (const auto& mcParticle : mcParticles) { - if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<=0.5){ // watch out for context!!! - if(abs(mcParticle.pdgCode())==211) JEhistos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==321) JEhistos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==2212) JEhistos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); - + if (mcParticle.isPhysicalPrimary() && fabs(mcParticle.y()) <= 0.5) { // watch out for context!!! + if (abs(mcParticle.pdgCode()) == 211) + JEhistos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 321) + JEhistos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 2212) + JEhistos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); } - if(fabs(mcParticle.y())<=0.5){ // watch out for context!!! - TLorentzVector lResonance; - lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); - if(abs(mcParticle.pdgCode())==333) JEhistos.fill(HIST("ptGeneratedPhi"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==333) JEhistos.fill(HIST("mGeneratedPhi"), lResonance.M()); + if (fabs(mcParticle.y()) <= 0.5) { // watch out for context!!! + TLorentzVector lResonance; + lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + if (abs(mcParticle.pdgCode()) == 333) + JEhistos.fill(HIST("ptGeneratedPhi"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 333) + JEhistos.fill(HIST("mGeneratedPhi"), lResonance.M()); } } - //Check jets + // Check jets for (auto& mcpjet : mcpjets) { registry.fill(HIST("h_part_jet_pt"), mcpjet.pt()); registry.fill(HIST("h_part_jet_eta"), mcpjet.eta()); registry.fill(HIST("h_part_jet_phi"), mcpjet.phi()); } - - } PROCESS_SWITCH(phiInJets, processSim, "pikp particle level MC", true); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - using JetMCPTable = soa::Filtered>; - using JetMCDTable = soa::Filtered>; - // void processMatchedGen(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) + using JetMCPTable = soa::Filtered>; + using JetMCDTable = soa::Filtered>; + + // void processMatchedGen(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) void processMatchedGen(aod::JMcCollision const& collision, - JetMCDTable const& mcdjets, - JetMCPTable const& mcpjets, - aod::JMcParticles const& mcParticles) - + JetMCDTable const& mcdjets, + JetMCPTable const& mcpjets, + aod::JMcParticles const& mcParticles) + { - // if(fabs(collision.posZ())>10) - // return; - + // if(fabs(collision.posZ())>10) + // return; + std::vector mcd_pt{}; std::vector mcd_phi{}; std::vector mcd_eta{}; std::vector mcp_pt{}; std::vector mcp_phi{}; std::vector mcp_eta{}; - - for (auto& mcpjet : mcpjets) { - if(!mcpjet.has_matchedJetGeo()) - continue; - - for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { - if(!mcdjet.has_matchedJetGeo()) - continue; - - registry.fill(HIST("h_matched_GEN_jet_pt"), mcpjet.pt(), mcdjet.pt()-mcpjet.pt()); - registry.fill(HIST("h_matched_GEN_jet_phi"), mcpjet.phi(), mcdjet.phi()-mcpjet.phi()); - registry.fill(HIST("h_matched_GEN_jet_eta"), mcpjet.eta(), mcdjet.eta()-mcpjet.eta()); - - mcd_pt.push_back(mcdjet.pt()); - mcd_eta.push_back(mcdjet.eta()); - mcd_phi.push_back(mcdjet.phi()); - mcp_pt.push_back(mcpjet.pt()); - mcp_eta.push_back(mcpjet.eta()); - mcp_phi.push_back(mcpjet.phi()); - } //mcpjets - } //mcdjets - - - - //First we do GEN part + + for (auto& mcpjet : mcpjets) { + if (!mcpjet.has_matchedJetGeo()) + continue; + + for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { + if (!mcdjet.has_matchedJetGeo()) + continue; + + registry.fill(HIST("h_matched_GEN_jet_pt"), mcpjet.pt(), mcdjet.pt() - mcpjet.pt()); + registry.fill(HIST("h_matched_GEN_jet_phi"), mcpjet.phi(), mcdjet.phi() - mcpjet.phi()); + registry.fill(HIST("h_matched_GEN_jet_eta"), mcpjet.eta(), mcdjet.eta() - mcpjet.eta()); + + mcd_pt.push_back(mcdjet.pt()); + mcd_eta.push_back(mcdjet.eta()); + mcd_phi.push_back(mcdjet.phi()); + mcp_pt.push_back(mcpjet.pt()); + mcp_eta.push_back(mcpjet.eta()); + mcp_phi.push_back(mcpjet.phi()); + } // mcpjets + } // mcdjets + + // First we do GEN part for (const auto& mcParticle : mcParticles) { - if(fabs(mcParticle.y())>0.5) - continue; - if(fabs(mcParticle.eta()>0.8)) - continue; - if(abs(mcParticle.pdgCode())==333){ - - TLorentzVector lResonance; - lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); - bool jetFlag = false; - for(int i=0; i 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//jetflag - if(!jetFlag){ - JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D"), lResonance.M()); - - if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - - JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//!jetflag - }//chech for phi - }//MC Particles - }//main fcn + if (fabs(mcParticle.y()) > 0.5) + continue; + if (fabs(mcParticle.eta() > 0.8)) + continue; + if (abs(mcParticle.pdgCode()) == 333) { + + TLorentzVector lResonance; + lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + bool jetFlag = false; + for (int i = 0; i < mcp_pt.size(); i++) { + double phidiff = TVector2::Phi_mpi_pi(mcp_pt[i] - lResonance.Phi()); + double etadiff = mcp_eta[i] - lResonance.Eta(); + double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgjetR) + jetFlag = true; + } + + if (jetFlag) { + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } // jetflag + if (!jetFlag) { + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D"), lResonance.M()); + + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } //! jetflag + } // chech for phi + } // MC Particles + } // main fcn PROCESS_SWITCH(phiInJets, processMatchedGen, "phi matched level MC", true); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - + // void processMatchedRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) void processMatchedRec(aod::JCollision const& collision, - JetMCDTable const& mcdjets, - JetMCPTable const& mcpjets, - myCompleteJetTracks const& tracks, - myCompleteTracks const& originalTracks, - aod::McParticles const&) + JetMCDTable const& mcdjets, + JetMCPTable const& mcpjets, + myCompleteJetTracks const& tracks, + myCompleteTracks const& originalTracks, + aod::McParticles const&) { - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) return; - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) return; - + std::vector mcd_pt{}; std::vector mcd_phi{}; std::vector mcd_eta{}; @@ -693,118 +691,116 @@ struct phiInJets { // std::vector mcp_ID{}; // std::vector mcp_ID{}; - + for (auto& mcdjet : mcdjets) { - if(!mcdjet.has_matchedJetGeo()) - continue; + if (!mcdjet.has_matchedJetGeo()) + continue; for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - if(!mcpjet.has_matchedJetGeo()) - continue; - - registry.fill(HIST("h_matched_REC_jet_pt"), mcpjet.pt(), mcdjet.pt()-mcpjet.pt()); - registry.fill(HIST("h_matched_REC_jet_phi"), mcpjet.phi(), mcdjet.phi()-mcpjet.phi()); - registry.fill(HIST("h_matched_REC_jet_eta"), mcpjet.eta(), mcdjet.eta()-mcpjet.eta()); - - mcd_pt.push_back(mcdjet.pt()); - mcd_eta.push_back(mcdjet.eta()); - mcd_phi.push_back(mcdjet.phi()); - mcp_pt.push_back(mcpjet.pt()); - mcp_eta.push_back(mcpjet.eta()); - mcp_phi.push_back(mcpjet.phi()); - } //mcpjets - } //mcdjets - - //Now we do REC part - for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))){ + if (!mcpjet.has_matchedJetGeo()) + continue; + + registry.fill(HIST("h_matched_REC_jet_pt"), mcpjet.pt(), mcdjet.pt() - mcpjet.pt()); + registry.fill(HIST("h_matched_REC_jet_phi"), mcpjet.phi(), mcdjet.phi() - mcpjet.phi()); + registry.fill(HIST("h_matched_REC_jet_eta"), mcpjet.eta(), mcdjet.eta() - mcpjet.eta()); + + mcd_pt.push_back(mcdjet.pt()); + mcd_eta.push_back(mcdjet.eta()); + mcd_phi.push_back(mcdjet.phi()); + mcp_pt.push_back(mcpjet.pt()); + mcp_eta.push_back(mcpjet.eta()); + mcp_phi.push_back(mcpjet.phi()); + } // mcpjets + } // mcdjets + + // Now we do REC part + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { auto trk1 = track1.track_as(); auto trk2 = track2.track_as(); if (trk1.index() >= trk2.index()) - continue; - if(fabs(trk1.eta())>0.8 || fabs(trk2.eta())>0.8) - continue; + continue; + if (fabs(trk1.eta()) > 0.8 || fabs(trk2.eta()) > 0.8) + continue; if (!trackSelection(trk1)) - continue; + continue; if (!trackSelection(trk2)) - continue; - if((trk1.sign()*trk2.sign())>0) - continue; //Not K+K- - if(!track1.has_mcParticle()) - continue; - if(!track2.has_mcParticle()) - continue; + continue; + if ((trk1.sign() * trk2.sign()) > 0) + continue; // Not K+K- + if (!track1.has_mcParticle()) + continue; + if (!track2.has_mcParticle()) + continue; auto part1 = track1.mcParticle(); auto part2 = track2.mcParticle(); - if(fabs(part1.pdgCode())!= 321) - continue; //Not Kaon - if(fabs(part2.pdgCode())!= 321) - continue; //Not Kaon - if(!part1.has_mothers()) - continue; //Not decaying Kaon - if(!part2.has_mothers()) - continue; //Not decaying Kaon + if (fabs(part1.pdgCode()) != 321) + continue; // Not Kaon + if (fabs(part2.pdgCode()) != 321) + continue; // Not Kaon + if (!part1.has_mothers()) + continue; // Not decaying Kaon + if (!part2.has_mothers()) + continue; // Not decaying Kaon std::vector mothers1{}; std::vector mothers1PDG{}; - for(auto& part1_mom : part1.mothers_as()){ - mothers1.push_back(part1_mom.globalIndex()); - mothers1PDG.push_back(part1_mom.pdgCode()); + for (auto& part1_mom : part1.mothers_as()) { + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); } - if(mothers1.size() > 1) - continue; //Strange multi-mother decay - + if (mothers1.size() > 1) + continue; // Strange multi-mother decay + std::vector mothers2{}; std::vector mothers2PDG{}; - for(auto& part2_mom : part2.mothers_as()){ - mothers2.push_back(part2_mom.globalIndex()); - mothers2PDG.push_back(part2_mom.pdgCode()); - } - if(mothers2.size() > 1) - continue; //Strange multi-mother decay - if(mothers1PDG[0] != 333) - continue; //mother not phi - if(mothers2PDG[0] != 333) - continue; //mother not phi - if(mothers1[0] != mothers2[0]) - continue; //Kaons not from the same phi - + for (auto& part2_mom : part2.mothers_as()) { + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + if (mothers2.size() > 1) + continue; // Strange multi-mother decay + if (mothers1PDG[0] != 333) + continue; // mother not phi + if (mothers2PDG[0] != 333) + continue; // mother not phi + if (mothers1[0] != mothers2[0]) + continue; // Kaons not from the same phi + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; - if(lResonance.Rapidity()>0.5) - continue; - - bool jetFlag = false; - for(int i=0; i 0.5) + continue; + + bool jetFlag = false; + for (int i = 0; i < mcd_pt.size(); i++) { + double phidiff = TVector2::Phi_mpi_pi(mcd_pt[i] - lResonance.Phi()); + double etadiff = mcd_eta[i] - lResonance.Eta(); + double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgjetR) + jetFlag = true; } - if(jetFlag){ - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); - if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//jetflag - if(!jetFlag){ - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); - - if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//!jetflag - }//tracks - }//main fcn - PROCESS_SWITCH(phiInJets, processMatchedRec, "phi matched Rec level MC", true); + if (jetFlag) { + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } // jetflag + if (!jetFlag) { + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } //! jetflag + } // tracks + } // main fcn + PROCESS_SWITCH(phiInJets, processMatchedRec, "phi matched Rec level MC", true); }; // end of main struct From 3565225bcf2f0f510e23430497ba6dc1a1b3edac Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 7 Feb 2024 09:02:21 +0000 Subject: [PATCH 3/6] MegaLinter fixes --- PWGJE/Tasks/phiInJets.cxx | 660 +++++++++++++++++++------------------- 1 file changed, 328 insertions(+), 332 deletions(-) diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index 5a78de002e4..a41e94430fe 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -48,21 +48,21 @@ using namespace o2::framework::expressions; struct phiInJets { SliceCache cache; HistogramRegistry JEhistos{"JEhistos", {}, OutputObjHandlingPolicy::AnalysisObject}; - + HistogramRegistry registry{"registry", {{"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_matched_REC_jet_pt", "matched_REC level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.},{400, -20., 20.}}}}, - {"h_matched_REC_jet_eta", "matched_REC level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0},{400, -20., 20.}}}}, - {"h_matched_REC_jet_phi", "matched_REC level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.},{400, -20., 20.}}}}, - {"h_matched_GEN_jet_pt", "matched_GEN level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.},{400, -20., 20.}}}}, - {"h_matched_GEN_jet_eta", "matched_GEN level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0},{400, -20., 20.}}}}, - {"h_matched_GEN_jet_phi", "matched_GEN level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.},{400, -20., 20.}}}}, - {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_matched_REC_jet_pt", "matched_REC level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.}, {400, -20., 20.}}}}, + {"h_matched_REC_jet_eta", "matched_REC level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0}, {400, -20., 20.}}}}, + {"h_matched_REC_jet_phi", "matched_REC level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.}, {400, -20., 20.}}}}, + {"h_matched_GEN_jet_pt", "matched_GEN level jet pT;#it{p}_{T,jet part} (GeV/#it{c});Delta", {HistType::kTH2F, {{200, 0., 200.}, {400, -20., 20.}}}}, + {"h_matched_GEN_jet_eta", "matched_GEN level jet #eta;#eta_{jet part};Delta", {HistType::kTH2F, {{100, -1.0, 1.0}, {400, -20., 20.}}}}, + {"h_matched_GEN_jet_phi", "matched_GEN level jet #phi;#phi_{jet part};Delta", {HistType::kTH2F, {{80, -1.0, 7.}, {400, -20., 20.}}}}, + {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}}}; - + Configurable cfgeventSelections{"cfgeventSelections", "sel8", "choose event selection"}; Configurable cfgtrackSelections{"cfgtrackSelections", "globalTracks", "set track selections"}; @@ -121,7 +121,7 @@ struct phiInJets { JEhistos.add("FJetaHistogram_MCTrue", "FJetaHistogram_MCTrue", kTH1F, {axisEta}); JEhistos.add("FJphiHistogram_MCTrue", "FJphiHistogram_MCTrue", kTH1F, {axisPhi}); JEhistos.add("FJptHistogram_MCTrue", "FJptHistogram_MCTrue", kTH1F, {axisPt}); - + JEhistos.add("FJnchHistogram", "FJnchHistogram", kTH1F, {MultAxis}); JEhistos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.0}}); JEhistos.add("nEvents_MCRec", "nEvents_MCRec", kTH1F, {{4, 0.0, 4.0}}); @@ -230,7 +230,7 @@ struct phiInJets { }; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - + template bool trackPID(const T& candidate) { @@ -252,13 +252,12 @@ struct phiInJets { } ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - + template void minvReconstruction(double mult, const TracksType& trk1, const TracksType& trk2, const JetType& jets) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!trackSelection(trk1) || !trackSelection(trk2)) return; @@ -276,20 +275,20 @@ struct phiInJets { return; ///////////////////////////////////////////////////////////////////////////// - //Fill Global Event Minv + // Fill Global Event Minv if (trk1.sign() * trk2.sign() < 0) { - if(!IsMC){ - JEhistos.fill(HIST("hUSS_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hUSS"), mult, lResonance.Pt(), lResonance.M()); + if (!IsMC) { + JEhistos.fill(HIST("hUSS_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS"), mult, lResonance.Pt(), lResonance.M()); } - if(IsMC){ - JEhistos.fill(HIST("hMCRec_hUSS_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS"), mult, lResonance.Pt(), lResonance.M()); + if (IsMC) { + JEhistos.fill(HIST("hMCRec_hUSS_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS"), mult, lResonance.Pt(), lResonance.M()); } } else if (trk1.sign() * trk2.sign() > 0) { @@ -312,23 +311,23 @@ struct phiInJets { } ///////////////////////////////////////////////////////////////////////////// - //Fill inside Jet + // Fill inside Jet if (jetFlag) { if (trk1.sign() * trk2.sign() < 0) { - if(!IsMC){ - JEhistos.fill(HIST("hUSS_INSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); - } - - if(IsMC){ - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); - } - + if (!IsMC) { + JEhistos.fill(HIST("hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + + if (IsMC) { + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + } else if (trk1.sign() * trk2.sign() > 0) { JEhistos.fill(HIST("hLSS_INSIDE_1D"), lResonance.M()); @@ -339,24 +338,23 @@ struct phiInJets { } // jetflag ///////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////// - //Fill outside Jet + // Fill outside Jet if (!jetFlag) { if (trk1.sign() * trk2.sign() < 0) { - if(!IsMC){ - JEhistos.fill(HIST("hUSS_OUTSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); - } - - if(IsMC){ - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); - if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); - } + if (!IsMC) { + JEhistos.fill(HIST("hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); + } + + if (IsMC) { + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), mult, lResonance.Pt(), lResonance.M()); + } } else if (trk1.sign() * trk2.sign() > 0) { @@ -367,11 +365,11 @@ struct phiInJets { } } //! jetflag ///////////////////////////////////////////////////////////////////////////// - } // MinvReconstruction + } // MinvReconstruction ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// - + int nEvents = 0; void processJetTracks(aod::JCollision const& collision, soa::Filtered> const& chargedjets, soa::Join const& tracks, TrackCandidates const&) { @@ -384,9 +382,9 @@ struct phiInJets { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) return; - + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { auto trk1 = track1.track_as>(); auto trk2 = track2.track_as>(); @@ -397,14 +395,13 @@ struct phiInJets { JEhistos.fill(HIST("FJetaHistogram"), chargedjet.eta()); JEhistos.fill(HIST("FJphiHistogram"), chargedjet.phi()); JEhistos.fill(HIST("FJptHistogram"), chargedjet.pt()); - JEhistos.fill(HIST("FJnchHistogram"), chargedjet.tracks().size()); + JEhistos.fill(HIST("FJnchHistogram"), chargedjet.tracks().size()); nJets++; } JEhistos.fill(HIST("nJetsPerEvent"), nJets); - JEhistos.fill(HIST("nEvents"), 1.5); - + for (auto const& track : tracks) { auto originalTrack = track.track_as>(); JEhistos.fill(HIST("hDCArToPv"), originalTrack.dcaXY()); @@ -430,260 +427,261 @@ struct phiInJets { }; // Process Switch PROCESS_SWITCH(phiInJets, processJetTracks, "process JE Framework", true); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////MC STUFF//////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - using myCompleteTracks = soa::Join; + using myCompleteTracks = soa::Join; using myCompleteJetTracks = soa::Join; int nJEEvents = 0; - void processRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) - { + void processRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) + { if (cDebugLevel > 0) { nJEEvents++; if ((nJEEvents + 1) % 10000 == 0) - std::cout << "JEvents: "<< nJEEvents << std::endl; + std::cout << "JEvents: " << nJEEvents << std::endl; } JEhistos.fill(HIST("nEvents_MCRec"), 0.5); - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) + return; + if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) return; - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) - return; JEhistos.fill(HIST("nEvents_MCRec"), 1.5); - //Track Eff + // Track Eff for (const auto& track : tracks) { - auto originalTrack = track.track_as(); + auto originalTrack = track.track_as(); if (!trackSelection(originalTrack)) continue; - if(track.has_mcParticle()){ - auto mcParticle = track.mcParticle(); - if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<=0.5){ // do this in the context of the track ! (context matters!!!) - if(abs(mcParticle.pdgCode())==211) JEhistos.fill(HIST("ptJEHistogramPion"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==321) JEhistos.fill(HIST("ptJEHistogramKaon"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==2212) JEhistos.fill(HIST("ptJEHistogramProton"), mcParticle.pt()); - } + if (track.has_mcParticle()) { + auto mcParticle = track.mcParticle(); + if (mcParticle.isPhysicalPrimary() && fabs(mcParticle.y()) <= 0.5) { // do this in the context of the track ! (context matters!!!) + if (abs(mcParticle.pdgCode()) == 211) + JEhistos.fill(HIST("ptJEHistogramPion"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 321) + JEhistos.fill(HIST("ptJEHistogramKaon"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 2212) + JEhistos.fill(HIST("ptJEHistogramProton"), mcParticle.pt()); + } } } - - //Jet Eff + + // Jet Eff for (auto& mcdjet : mcdjets) { registry.fill(HIST("h_jet_pt"), mcdjet.pt()); registry.fill(HIST("h_jet_eta"), mcdjet.eta()); registry.fill(HIST("h_jet_phi"), mcdjet.phi()); } - //Phi Eff - - for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))){ - auto trk1 = track1.track_as(); - auto trk2 = track2.track_as(); - if (trk1.index() >= trk2.index()) - continue; - if(fabs(trk1.eta())>0.8 || fabs(trk2.eta())>0.8) - continue; - - if (!trackSelection(trk1)) - continue; - if (!trackSelection(trk2)) - continue; - if((trk1.sign()*trk2.sign())>0) - continue; //Not K+K- - if(!track1.has_mcParticle()) - continue; - if(!track2.has_mcParticle()) - continue; - - auto part1 = track1.mcParticle(); - auto part2 = track2.mcParticle(); - if(fabs(part1.pdgCode())!= 321) - continue; //Not Kaon - if(fabs(part2.pdgCode())!= 321) - continue; //Not Kaon - if(!part1.has_mothers()) - continue; //Not decaying Kaon - if(!part2.has_mothers()) - continue; //Not decaying Kaon - - std::vector mothers1{}; - std::vector mothers1PDG{}; - for(auto& part1_mom : part1.mothers_as()){ - mothers1.push_back(part1_mom.globalIndex()); - mothers1PDG.push_back(part1_mom.pdgCode()); - } - if(mothers1.size() > 1) - continue; //Strange multi-mother decay - - std::vector mothers2{}; - std::vector mothers2PDG{}; - for(auto& part2_mom : part2.mothers_as()){ - mothers2.push_back(part2_mom.globalIndex()); - mothers2PDG.push_back(part2_mom.pdgCode()); - } - - if(mothers2.size() > 1) - continue; //Strange multi-mother decay - if(mothers1PDG[0] != 333) - continue; //mother not phi - if(mothers2PDG[0] != 333) - continue; //mother not phi - if(mothers1[0] != mothers2[0]) - continue; //Kaons not from the same phi - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); - lResonance = lDecayDaughter1 + lDecayDaughter2; - if(lResonance.Rapidity()>0.5) - continue; - JEhistos.fill(HIST("ptJEHistogramPhi"), lResonance.Pt()); - JEhistos.fill(HIST("minvJEHistogramPhi"), lResonance.M()); - - - }//end of phi check + // Phi Eff + + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { + auto trk1 = track1.track_as(); + auto trk2 = track2.track_as(); + if (trk1.index() >= trk2.index()) + continue; + if (fabs(trk1.eta()) > 0.8 || fabs(trk2.eta()) > 0.8) + continue; + + if (!trackSelection(trk1)) + continue; + if (!trackSelection(trk2)) + continue; + if ((trk1.sign() * trk2.sign()) > 0) + continue; // Not K+K- + if (!track1.has_mcParticle()) + continue; + if (!track2.has_mcParticle()) + continue; + + auto part1 = track1.mcParticle(); + auto part2 = track2.mcParticle(); + if (fabs(part1.pdgCode()) != 321) + continue; // Not Kaon + if (fabs(part2.pdgCode()) != 321) + continue; // Not Kaon + if (!part1.has_mothers()) + continue; // Not decaying Kaon + if (!part2.has_mothers()) + continue; // Not decaying Kaon + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& part1_mom : part1.mothers_as()) { + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); + } + if (mothers1.size() > 1) + continue; // Strange multi-mother decay + + std::vector mothers2{}; + std::vector mothers2PDG{}; + for (auto& part2_mom : part2.mothers_as()) { + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + + if (mothers2.size() > 1) + continue; // Strange multi-mother decay + if (mothers1PDG[0] != 333) + continue; // mother not phi + if (mothers2PDG[0] != 333) + continue; // mother not phi + if (mothers1[0] != mothers2[0]) + continue; // Kaons not from the same phi + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lResonance = lDecayDaughter1 + lDecayDaughter2; + if (lResonance.Rapidity() > 0.5) + continue; + JEhistos.fill(HIST("ptJEHistogramPhi"), lResonance.Pt()); + JEhistos.fill(HIST("minvJEHistogramPhi"), lResonance.M()); + + } // end of phi check } PROCESS_SWITCH(phiInJets, processRec, "pikp detector level MC JE", true); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void processSim(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets ) + void processSim(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) { JEhistos.fill(HIST("nEvents_MCGen"), 0.5); - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) return; JEhistos.fill(HIST("nEvents_MCGen"), 1.5); - //Check pikp and phi + // Check pikp and phi for (const auto& mcParticle : mcParticles) { - if(mcParticle.isPhysicalPrimary() && fabs(mcParticle.y())<=0.5){ // watch out for context!!! - if(abs(mcParticle.pdgCode())==211) JEhistos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==321) JEhistos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==2212) JEhistos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); - + if (mcParticle.isPhysicalPrimary() && fabs(mcParticle.y()) <= 0.5) { // watch out for context!!! + if (abs(mcParticle.pdgCode()) == 211) + JEhistos.fill(HIST("ptGeneratedPion"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 321) + JEhistos.fill(HIST("ptGeneratedKaon"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 2212) + JEhistos.fill(HIST("ptGeneratedProton"), mcParticle.pt()); } - if(fabs(mcParticle.y())<=0.5){ // watch out for context!!! - TLorentzVector lResonance; - lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); - if(abs(mcParticle.pdgCode())==333) JEhistos.fill(HIST("ptGeneratedPhi"), mcParticle.pt()); - if(abs(mcParticle.pdgCode())==333) JEhistos.fill(HIST("mGeneratedPhi"), lResonance.M()); + if (fabs(mcParticle.y()) <= 0.5) { // watch out for context!!! + TLorentzVector lResonance; + lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + if (abs(mcParticle.pdgCode()) == 333) + JEhistos.fill(HIST("ptGeneratedPhi"), mcParticle.pt()); + if (abs(mcParticle.pdgCode()) == 333) + JEhistos.fill(HIST("mGeneratedPhi"), lResonance.M()); } } - //Check jets + // Check jets for (auto& mcpjet : mcpjets) { registry.fill(HIST("h_part_jet_pt"), mcpjet.pt()); registry.fill(HIST("h_part_jet_eta"), mcpjet.eta()); registry.fill(HIST("h_part_jet_phi"), mcpjet.phi()); } - - } PROCESS_SWITCH(phiInJets, processSim, "pikp particle level MC", true); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - using JetMCPTable = soa::Filtered>; - using JetMCDTable = soa::Filtered>; - // void processMatchedGen(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) + using JetMCPTable = soa::Filtered>; + using JetMCDTable = soa::Filtered>; + + // void processMatchedGen(o2::aod::JMcCollision const& collision, aod::JMcParticles const& mcParticles, soa::Filtered const& mcpjets) void processMatchedGen(aod::JMcCollision const& collision, - JetMCDTable const& mcdjets, - JetMCPTable const& mcpjets, - aod::JMcParticles const& mcParticles) - + JetMCDTable const& mcdjets, + JetMCPTable const& mcpjets, + aod::JMcParticles const& mcParticles) + { - // if(fabs(collision.posZ())>10) - // return; - + // if(fabs(collision.posZ())>10) + // return; + std::vector mcd_pt{}; std::vector mcd_phi{}; std::vector mcd_eta{}; std::vector mcp_pt{}; std::vector mcp_phi{}; std::vector mcp_eta{}; - - for (auto& mcpjet : mcpjets) { - if(!mcpjet.has_matchedJetGeo()) - continue; - - for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { - if(!mcdjet.has_matchedJetGeo()) - continue; - - registry.fill(HIST("h_matched_GEN_jet_pt"), mcpjet.pt(), mcdjet.pt()-mcpjet.pt()); - registry.fill(HIST("h_matched_GEN_jet_phi"), mcpjet.phi(), mcdjet.phi()-mcpjet.phi()); - registry.fill(HIST("h_matched_GEN_jet_eta"), mcpjet.eta(), mcdjet.eta()-mcpjet.eta()); - - mcd_pt.push_back(mcdjet.pt()); - mcd_eta.push_back(mcdjet.eta()); - mcd_phi.push_back(mcdjet.phi()); - mcp_pt.push_back(mcpjet.pt()); - mcp_eta.push_back(mcpjet.eta()); - mcp_phi.push_back(mcpjet.phi()); - } //mcpjets - } //mcdjets - - - - //First we do GEN part + + for (auto& mcpjet : mcpjets) { + if (!mcpjet.has_matchedJetGeo()) + continue; + + for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { + if (!mcdjet.has_matchedJetGeo()) + continue; + + registry.fill(HIST("h_matched_GEN_jet_pt"), mcpjet.pt(), mcdjet.pt() - mcpjet.pt()); + registry.fill(HIST("h_matched_GEN_jet_phi"), mcpjet.phi(), mcdjet.phi() - mcpjet.phi()); + registry.fill(HIST("h_matched_GEN_jet_eta"), mcpjet.eta(), mcdjet.eta() - mcpjet.eta()); + + mcd_pt.push_back(mcdjet.pt()); + mcd_eta.push_back(mcdjet.eta()); + mcd_phi.push_back(mcdjet.phi()); + mcp_pt.push_back(mcpjet.pt()); + mcp_eta.push_back(mcpjet.eta()); + mcp_phi.push_back(mcpjet.phi()); + } // mcpjets + } // mcdjets + + // First we do GEN part for (const auto& mcParticle : mcParticles) { - if(fabs(mcParticle.y())>0.5) - continue; - if(fabs(mcParticle.eta()>0.8)) - continue; - if(abs(mcParticle.pdgCode())==333){ - - TLorentzVector lResonance; - lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); - bool jetFlag = false; - for(int i=0; i 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//jetflag - if(!jetFlag){ - JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D"), lResonance.M()); - - if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - - JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//!jetflag - }//chech for phi - }//MC Particles - }//main fcn + if (fabs(mcParticle.y()) > 0.5) + continue; + if (fabs(mcParticle.eta() > 0.8)) + continue; + if (abs(mcParticle.pdgCode()) == 333) { + + TLorentzVector lResonance; + lResonance.SetPxPyPzE(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + bool jetFlag = false; + for (int i = 0; i < mcp_pt.size(); i++) { + double phidiff = TVector2::Phi_mpi_pi(mcp_pt[i] - lResonance.Phi()); + double etadiff = mcp_eta[i] - lResonance.Eta(); + double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgjetR) + jetFlag = true; + } + + if (jetFlag) { + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCTrue_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } // jetflag + if (!jetFlag) { + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D"), lResonance.M()); + + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + + JEhistos.fill(HIST("hMCTrue_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } //! jetflag + } // chech for phi + } // MC Particles + } // main fcn PROCESS_SWITCH(phiInJets, processMatchedGen, "phi matched level MC", true); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - + // void processMatchedRec(o2::aod::JCollision const& collision, myCompleteJetTracks const& tracks, soa::Filtered const& mcdjets, aod::McParticles const&, myCompleteTracks const& originalTracks) void processMatchedRec(aod::JCollision const& collision, - JetMCDTable const& mcdjets, - JetMCPTable const& mcpjets, - myCompleteJetTracks const& tracks, - myCompleteTracks const& originalTracks, - aod::McParticles const&) + JetMCDTable const& mcdjets, + JetMCPTable const& mcpjets, + myCompleteJetTracks const& tracks, + myCompleteTracks const& originalTracks, + aod::McParticles const&) { - if(fabs(collision.posZ())>10) + if (fabs(collision.posZ()) > 10) return; - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) return; - + std::vector mcd_pt{}; std::vector mcd_phi{}; std::vector mcd_eta{}; @@ -693,118 +691,116 @@ struct phiInJets { // std::vector mcp_ID{}; // std::vector mcp_ID{}; - + for (auto& mcdjet : mcdjets) { - if(!mcdjet.has_matchedJetGeo()) - continue; + if (!mcdjet.has_matchedJetGeo()) + continue; for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - if(!mcpjet.has_matchedJetGeo()) - continue; - - registry.fill(HIST("h_matched_REC_jet_pt"), mcpjet.pt(), mcdjet.pt()-mcpjet.pt()); - registry.fill(HIST("h_matched_REC_jet_phi"), mcpjet.phi(), mcdjet.phi()-mcpjet.phi()); - registry.fill(HIST("h_matched_REC_jet_eta"), mcpjet.eta(), mcdjet.eta()-mcpjet.eta()); - - mcd_pt.push_back(mcdjet.pt()); - mcd_eta.push_back(mcdjet.eta()); - mcd_phi.push_back(mcdjet.phi()); - mcp_pt.push_back(mcpjet.pt()); - mcp_eta.push_back(mcpjet.eta()); - mcp_phi.push_back(mcpjet.phi()); - } //mcpjets - } //mcdjets - - //Now we do REC part - for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))){ + if (!mcpjet.has_matchedJetGeo()) + continue; + + registry.fill(HIST("h_matched_REC_jet_pt"), mcpjet.pt(), mcdjet.pt() - mcpjet.pt()); + registry.fill(HIST("h_matched_REC_jet_phi"), mcpjet.phi(), mcdjet.phi() - mcpjet.phi()); + registry.fill(HIST("h_matched_REC_jet_eta"), mcpjet.eta(), mcdjet.eta() - mcpjet.eta()); + + mcd_pt.push_back(mcdjet.pt()); + mcd_eta.push_back(mcdjet.eta()); + mcd_phi.push_back(mcdjet.phi()); + mcp_pt.push_back(mcpjet.pt()); + mcp_eta.push_back(mcpjet.eta()); + mcp_phi.push_back(mcpjet.phi()); + } // mcpjets + } // mcdjets + + // Now we do REC part + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { auto trk1 = track1.track_as(); auto trk2 = track2.track_as(); if (trk1.index() >= trk2.index()) - continue; - if(fabs(trk1.eta())>0.8 || fabs(trk2.eta())>0.8) - continue; + continue; + if (fabs(trk1.eta()) > 0.8 || fabs(trk2.eta()) > 0.8) + continue; if (!trackSelection(trk1)) - continue; + continue; if (!trackSelection(trk2)) - continue; - if((trk1.sign()*trk2.sign())>0) - continue; //Not K+K- - if(!track1.has_mcParticle()) - continue; - if(!track2.has_mcParticle()) - continue; + continue; + if ((trk1.sign() * trk2.sign()) > 0) + continue; // Not K+K- + if (!track1.has_mcParticle()) + continue; + if (!track2.has_mcParticle()) + continue; auto part1 = track1.mcParticle(); auto part2 = track2.mcParticle(); - if(fabs(part1.pdgCode())!= 321) - continue; //Not Kaon - if(fabs(part2.pdgCode())!= 321) - continue; //Not Kaon - if(!part1.has_mothers()) - continue; //Not decaying Kaon - if(!part2.has_mothers()) - continue; //Not decaying Kaon + if (fabs(part1.pdgCode()) != 321) + continue; // Not Kaon + if (fabs(part2.pdgCode()) != 321) + continue; // Not Kaon + if (!part1.has_mothers()) + continue; // Not decaying Kaon + if (!part2.has_mothers()) + continue; // Not decaying Kaon std::vector mothers1{}; std::vector mothers1PDG{}; - for(auto& part1_mom : part1.mothers_as()){ - mothers1.push_back(part1_mom.globalIndex()); - mothers1PDG.push_back(part1_mom.pdgCode()); + for (auto& part1_mom : part1.mothers_as()) { + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); } - if(mothers1.size() > 1) - continue; //Strange multi-mother decay - + if (mothers1.size() > 1) + continue; // Strange multi-mother decay + std::vector mothers2{}; std::vector mothers2PDG{}; - for(auto& part2_mom : part2.mothers_as()){ - mothers2.push_back(part2_mom.globalIndex()); - mothers2PDG.push_back(part2_mom.pdgCode()); - } - if(mothers2.size() > 1) - continue; //Strange multi-mother decay - if(mothers1PDG[0] != 333) - continue; //mother not phi - if(mothers2PDG[0] != 333) - continue; //mother not phi - if(mothers1[0] != mothers2[0]) - continue; //Kaons not from the same phi - + for (auto& part2_mom : part2.mothers_as()) { + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + if (mothers2.size() > 1) + continue; // Strange multi-mother decay + if (mothers1PDG[0] != 333) + continue; // mother not phi + if (mothers2PDG[0] != 333) + continue; // mother not phi + if (mothers1[0] != mothers2[0]) + continue; // Kaons not from the same phi + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; - if(lResonance.Rapidity()>0.5) - continue; - - bool jetFlag = false; - for(int i=0; i 0.5) + continue; + + bool jetFlag = false; + for (int i = 0; i < mcd_pt.size(); i++) { + double phidiff = TVector2::Phi_mpi_pi(mcd_pt[i] - lResonance.Phi()); + double etadiff = mcd_eta[i] - lResonance.Eta(); + double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgjetR) + jetFlag = true; } - if(jetFlag){ - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); - if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); - JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//jetflag - if(!jetFlag){ - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); - - if(lResonance.Pt() > 2.0 && lResonance.Pt() < 3) - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); - - JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); - - }//!jetflag - }//tracks - }//main fcn - PROCESS_SWITCH(phiInJets, processMatchedRec, "phi matched Rec level MC", true); + if (jetFlag) { + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_INSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } // jetflag + if (!jetFlag) { + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D"), lResonance.M()); + if (lResonance.Pt() > 2.0 && lResonance.Pt() < 3) + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE_1D_2_3"), lResonance.M()); + JEhistos.fill(HIST("hMCRec_hUSS_OUTSIDE"), 1.0, lResonance.Pt(), lResonance.M()); + + } //! jetflag + } // tracks + } // main fcn + PROCESS_SWITCH(phiInJets, processMatchedRec, "phi matched Rec level MC", true); }; // end of main struct From ed45557504afccd2e70e24146ce3f2a57f33d2fb Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Tue, 13 Feb 2024 13:35:21 +0900 Subject: [PATCH 4/6] Quick bugfix --- PWGJE/Tasks/phiInJets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index 5a78de002e4..747a16f9891 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -451,7 +451,7 @@ struct phiInJets { JEhistos.fill(HIST("nEvents_MCRec"), 0.5); if(fabs(collision.posZ())>10) return; - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; JEhistos.fill(HIST("nEvents_MCRec"), 1.5); @@ -681,7 +681,7 @@ struct phiInJets { { if(fabs(collision.posZ())>10) return; - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; std::vector mcd_pt{}; From 0c6e2685883c1f87ac31c0b30e7827ce6c2b7264 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 13 Feb 2024 04:43:54 +0000 Subject: [PATCH 5/6] Please consider the following formatting changes --- PWGJE/Tasks/phiInJets.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index f1c2d6a154f..51bc578e52c 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -447,8 +447,8 @@ struct phiInJets { JEhistos.fill(HIST("nEvents_MCRec"), 0.5); if (fabs(collision.posZ()) > 10) return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) - return; + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) + return; JEhistos.fill(HIST("nEvents_MCRec"), 1.5); // Track Eff @@ -679,7 +679,7 @@ struct phiInJets { { if (fabs(collision.posZ()) > 10) return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; std::vector mcd_pt{}; From 23811a4c8cc2f0aae2acbb80facc1b2ff939c1db Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 13 Feb 2024 04:46:56 +0000 Subject: [PATCH 6/6] MegaLinter fixes --- PWGJE/Tasks/phiInJets.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index f1c2d6a154f..51bc578e52c 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -447,8 +447,8 @@ struct phiInJets { JEhistos.fill(HIST("nEvents_MCRec"), 0.5); if (fabs(collision.posZ()) > 10) return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) - return; + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) + return; JEhistos.fill(HIST("nEvents_MCRec"), 1.5); // Track Eff @@ -679,7 +679,7 @@ struct phiInJets { { if (fabs(collision.posZ()) > 10) return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; std::vector mcd_pt{};