From 80b77c13e37819a655df5608e8ad750f5c8a56d7 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Sun, 24 May 2026 20:32:13 +0900 Subject: [PATCH 01/11] update of kstarInOO.cxx --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 511 +++++++++++++++++++-------- 1 file changed, 369 insertions(+), 142 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 2b0f71c60e6..74c884e76eb 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -12,11 +12,6 @@ /// \brief the pT spectra of k*0(892) resonance analysis in OO collisions /// \author Jimun Lee -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/JetReducedData.h" - -#include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -24,28 +19,39 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include -#include +#include "CommonConstants/PhysicsConstants.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/Track.h" #include -#include -#include -#include -#include #include -#include -#include #include #include #include #include -#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) -#include -#include +// jet +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/TrackJetQa.h" + +#include + +#include #include -#include +#include +#include #include +#include + +#include +#include #include #include #include @@ -56,7 +62,6 @@ #include #include - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -65,12 +70,12 @@ struct kstarInOO { SliceCache cache; Preslice perCollision = aod::track::collisionId; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + //================================== - //|| - //|| Selection - //|| + //| + //| Selection + //| //================================== - // Event Selection Configurable cfgEventSelections{"cfgEventSelections", "sel8", "Set event selection"}; Configurable cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"}; @@ -83,12 +88,14 @@ struct kstarInOO { // General Configurable cfgTrackMinPt{"cfgTrackMinPt", 0.15, "set track min pT"}; Configurable cfgTrackMaxEta{"cfgTrackMaxEta", 0.8, "set track max Eta"}; + Configurable cfgJetTrackMaxEta{"cfgJetTrackMaxEta", 0.4, "set jet track max Eta"}; Configurable cfgTrackMaxDCArToPVcut{"cfgTrackMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; Configurable cfgTrackGlobalSel{"cfgTrackGlobalSel", true, "Global track selection"}; - Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz - Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor + Configurable cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; + // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) // TPC Configurable cfgTrackFindableTPCClusters{"cfgTrackFindableTPCClusters", 50, "nFindable TPC Clusters"}; Configurable cfgTrackTPCCrossedRows{"cfgTrackTPCCrossedRows", 70, "nCrossed TPC Rows"}; @@ -119,6 +126,7 @@ struct kstarInOO { // MCGen Configurable cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; Configurable cfgReqMcEffPID{"cfgReqMcEffPID", false, "Request McEfficiency PID"}; + Configurable cfgReqMcEffTrackQA{"cfgRecMcEffTrackQA", false, "Enable Jet Cut on Trig"}; // Pair Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; @@ -131,6 +139,7 @@ struct kstarInOO { Configurable cfgEventCutQA{"cfgEventCutsQA", false, "Enable Event QA Hists"}; Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; Configurable cfgJetQAHistos{"cfgJetQAHistos", false, "Enable Jet QA Histos"}; + Configurable cfgWoJetQA{"cfgWoJetQA", false, "Enable Without Jet QA Histos"}; Configurable cfgMCHistos{"cfgMCHistos", false, "Enable MC Hists"}; Configurable cfgMixedHistos{"cfgMixedHistos", false, "Enable Mixed Histos"}; @@ -142,9 +151,9 @@ struct kstarInOO { Configurable cfgJetEvSel{"cfgJetEvSel", false, "Enable Manual JetEvSel"}; //====================== - //|| - //|| JET - //|| + //| + //| JET + //| //====================== Configurable cfgJetpT{"cfgJetpT", 8.0, "Set Jet pT minimum"}; Configurable cfgJetR{"cfgJetR", 0.4, "Set Jet radius parameter"}; @@ -154,13 +163,14 @@ struct kstarInOO { Configurable cfgTriggerMasksTest1{"cfgTriggerMasksTest1", "", "possible JE Trigger masks Test1"}; Configurable cfgTriggerMasksTest2{"cfgTriggerMasksTest2", "", "possible JE Trigger masks Test2"}; Configurable cfgTriggerMasksTest3{"cfgTriggerMasksTest3", "", "possible JE Trigger masks Test3"}; + Configurable cfgForceTrueINELgt{"cfgForceTrueINELgt", true, "Check generated event with True INELgt0"}; std::vector eventSelectionBits; std::vector RealTriggerMaskBits; std::vector triggerMaskBitsTest1; std::vector triggerMaskBitsTest2; std::vector triggerMaskBitsTest3; - // Main + void init(o2::framework::InitContext&) { // HISTOGRAMS @@ -219,9 +229,6 @@ struct kstarInOO { } if (cfgJetQAHistos) { histos.add("nTriggerQA", "nTriggerQA", kTH1F, {{8, 0.0, 8.0}}); - histos.add("nTriggerQA_GoodEv", "nTriggerQA_GoodEv", kTH1F, {{8, 0.0, 8.0}}); - histos.add("nTriggerQA_GoodTrig", "nTriggerQA_GoodTrig", kTH1F, {{8, 0.0, 8.0}}); - histos.add("nTriggerQA_GoodEvTrig", "nTriggerQA_GoodEvTrig", kTH1F, {{8, 0.0, 8.0}}); histos.add("JetpT", "Jet pT (GeV/c)", kTH1F, {{4000, 0., 200.}}); histos.add("JetEta", "Jet Eta", kTH1F, {{100, -1.0, 1.0}}); @@ -231,6 +238,45 @@ struct kstarInOO { histos.add("jetTrackEta", "Jet Track Eta", kTH1F, {{100, -1.0, 1.0}}); histos.add("jetTrackPhi", "Jet Track Phi", kTH1F, {{80, -1.0, 7.0}}); + histos.add("dR_kaon_pion", "dR between kaon and pion1", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_kaon_pion_passed", "dR between kaon and pion w pT cut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + + histos.add("dR_taggedjet_kaon_all", "dR between tagged jet and kaon wo pT cut", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_pion_all", "dR between tagged jet and pion wo pT cut", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_all_all", "dR between tagged jet and kpi", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); + + histos.add("dR_taggedjet_kaon_woJetR", "dR between tagged jet and kaon wo Jet R", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_pion_woJetR", "dR between tagged jet and pion wo Jet R", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + + histos.add("dR_taggedjet_kaon_passed", "dR between tagged jet and kaon w pT cut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_pion_passed", "dR between tagged jet and pion w pT cut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + + histos.add("missed_pion_INJets", "missed pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kaon_INJets", "missed kaon In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + + histos.add("missed_kpi_INJets_6_8", "missed kpi In Jets with 6 < jetPt < 8", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_8_10", "missed kpi In Jets with 8 < jetPt < 10", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_10_12", "missed kpi In Jets with 10 < jetPt < 12", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_12_15", "missed kpi In Jets with 12 < jetPt < 15", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_15_25", "missed kpi In Jets with 15 < jetPt < 25", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_25_infinite", "missed kpi In Jets with 25 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + + histos.add("missed_kpi_INJets_fraction", "missed kaon and pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {120, 0., 1.2}}}); + + histos.add("catched_kpi_INJets", "catched_kpi_INJets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + + histos.add("missed_pion_INJets_passed", "missed pion In Jets w pT cut", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kaon_INJets_passed", "missed kaon In Jets w pT cut", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_passed", "missed kaon and pion In Jets w pT cut", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + + histos.add("particle1_pdg", "particle1 pdg Code", kTH1F, {{2000, -1000., 1000.}}); + histos.add("particle2_pdg", "particle2 pdg Code", kTH1F, {{2000, -1000., 1000.}}); + + histos.add("kstar_pT_all", "kstar_pT_all", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("kstar_pT_passPtCut", "kstar_pT_passPtCut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("jet_all", "jet all", kTH1F, {{4000, 0., 200.}}); + histos.add("jet_passCut", "jet passed pT cut", kTH1F, {{4000, 0., 200.}}); + histos.add("nJetsPerEvent", "nJetsPerEvent", kTH1I, {{4, -0.5, 3.5}}); histos.add("nGoodJets", "nGoodJets", kTH1I, {{4, -0.5, 3.5}}); } @@ -265,8 +311,6 @@ struct kstarInOO { histos.add("hGen_pT_Raw", "Gen_pT_Raw (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hGen_pT_GoodEv", "Gen_pT_GoodTrig (GeV/c)", kTH1F, {{800, 0., 40.}}); - histos.add("hGen_pT_GoodTrig", "Gen_pT_GoodTrig (GeV/c)", kTH1F, {{800, 0., 40.}}); - histos.add("hGen_pT_GoodEvTrig", "Gen_pT_GoodEvTrig (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRec_pT", "EffRec_pT (GeV/c)", kTH1F, {{1600, 0., 80.}}); histos.add("hEffRecTest1_pT", "EffRecTest1_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); @@ -277,8 +321,10 @@ struct kstarInOO { histos.add("hEffRecTest6_pT", "EffRecTest6_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRecTest7_pT", "EffRecTest7_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRecTest8_pT", "EffRecTest8_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); - histos.add("hEffGen_pT", "EffGen_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); + histos.add("hEffRecLowPtKstarDaughter", "EffRecLow Kstar daughter_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); + + histos.add("hEffGen_pT", "EffGen_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hMotherPdg1", "hMotherPdg1", kTH1F, {{5000, 0., 5000.}}); histos.add("hMotherPdg2", "hMotherPdg2", kTH1F, {{5000, 0., 5000.}}); } @@ -308,9 +354,9 @@ struct kstarInOO { triggerMaskBitsTest3 = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasksTest3); } // end of init - //====================== - //|| For LF Analysis - //====================== + //=============== + //| LF Analysis + //=============== using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As using EventCandidatesTrue = aod::McCollisions; using TrackCandidates = soa::Join; - //============== - //|| For jets - //============== + //================= + //|| Jet Analysis + //================= Filter JEPosZFilter = nabs(aod::jcollision::posZ) < cfgEventVtxCut; Filter JEMCPosZFilter = nabs(aod::jmccollision::posZ) < cfgEventVtxCut; Filter jetCuts = aod::jet::pt > cfgJetpT&& aod::jet::r == nround(cfgJetR.node() * 100.0f); @@ -732,10 +778,8 @@ struct kstarInOO { { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {}; - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) return {}; - if (trk1.globalIndex() >= trk2.globalIndex()) return {}; @@ -751,8 +795,9 @@ struct kstarInOO { if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) return {}; + return {lResonance}; - } + } // minvReconstruction template ROOT::Math::PxPyPzMVector TrueReconstruction(const TracksType& trk1, const TracksType& trk2) @@ -767,6 +812,9 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) { return {}; } + if (std::fabs(particle1.eta()) > cfgTrackMaxEta || std::fabs(particle2.eta()) > cfgTrackMaxEta) { + return {}; + } std::vector mothers1{}; std::vector mothers1PDG{}; @@ -786,7 +834,6 @@ struct kstarInOO { return {}; // mother not K*0 if (mothers2PDG[0] != 313) return {}; // mothers not K*0 - if (mothers1[0] != mothers2[0]) return {}; // Kaon and pion not from the same K*0 @@ -813,15 +860,17 @@ struct kstarInOO { } ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso; - lTrueDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), track1_mass); - lTrueDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), track2_mass); + lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), track1_mass); + lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), track2_mass); lTrueReso = lTrueDaughter1 + lTrueDaughter2; if (lTrueReso.M() < 0) return {}; + if (std::fabs(lTrueReso.Eta()) > cfgTrackMaxEta) + return {}; return {lTrueReso}; - } + } // TrueReconstruction template void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA) @@ -894,9 +943,9 @@ struct kstarInOO { template void JetTrackSlicing(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA) { - //============================ - //| MB: Track Reconstruction - //============================ + //============= + //| Inclusive + //============= auto centrality = collision.centFT0C(); for (const auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) { auto trk1 = track1.template track_as(); @@ -909,25 +958,28 @@ struct kstarInOO { fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); - //============================== - //| Jets: Track Reconstruction - //============================== + //======== + //| Jets + //======== bool jetFlag = false; int goodjets = 0; double jetpt = 0; + double R = 0; for (auto const& jet : chargedjets) { double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgJetR) { jetFlag = true; jetpt = jet.pt(); goodjets++; } - } + } // The loop of chargedjets if (cfgJetQAHistos) { histos.fill(HIST("nGoodJets"), goodjets); } + if (!cfgSingleJet) { if (goodjets > 1) { jetpt = DistinguishJets(chargedjets, lResonance); @@ -942,7 +994,7 @@ struct kstarInOO { } // JetTrackSlicing template - void JetTrackSlicingMC(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA) + void JetTrackSlicingMC(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& mcdjets, const bool IsMix, const bool QA) { //============================ //| MB: Track Reconstruction @@ -961,14 +1013,13 @@ struct kstarInOO { continue; fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); - //============================== //| Jets: Track Reconstruction //============================== bool jetFlag = false; int goodjets = 0; double jetpt = 0; - for (auto const& jet : chargedjets) { + for (auto const& jet : mcdjets) { double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); @@ -983,26 +1034,13 @@ struct kstarInOO { } if (!cfgSingleJet) { if (goodjets > 1) { - jetpt = DistinguishJets(chargedjets, lResonance); + jetpt = DistinguishJets(mcdjets, lResonance); } } if (jetFlag) { fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); } // jetFlag - - //=============================== - //| MB: Particle Reconstruction - //=============================== - auto lTrueReso = TrueReconstruction(trk1, trk2); - fillMinv(objectType::MBRecParticle, trk1, trk2, lTrueReso, centrality, -1.0, IsMix, false); - - //================================== - //| Jets: Particle Reconstruction - //================================== - if (jetFlag) { - fillMinv(objectType::JetsRecParticle, trk1, trk2, lTrueReso, centrality, jetpt, IsMix, false); - } // jetFlag } // filp } // Tracks loop } // JetTrackSlicingMC @@ -1124,7 +1162,6 @@ struct kstarInOO { return; JetTrackSlicing(collision, jetTracks, chargedjets, false, true); - } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1134,7 +1171,7 @@ struct kstarInOO { //| //======================================================= int nJetMCEvents = 0; - void processMCJets(o2::aod::JetCollision const& collision, soa::Filtered const& mcdjets, JetTrackCandidatesMC const& jetTracks, TrackCandidatesMC const&, aod::McParticles const&) + void processMCJets(o2::aod::JetCollision const& collision, JetTrackCandidatesMC const& jetTracks, soa::Filtered const& mcdjets, TrackCandidatesMC const&, aod::McParticles const&, aod::JetParticles const&) { if (cDebugLevel > 0) { nJetMCEvents++; @@ -1142,21 +1179,21 @@ struct kstarInOO { std::cout << "Processed Jet MC Events: " << nJetMCEvents << std::endl; } } + histos.fill(HIST("nEvents"), 0.5); // Raw event if (std::abs(collision.posZ()) > cfgEventVtxCut) return; - - if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) return; - } + histos.fill(HIST("nEvents"), 1.5); // Before passing the condition bool INELgt0 = false; for (auto& jetTrack : jetTracks) { - if (std::fabs(jetTrack.eta()) < cfgTrackMaxEta) { + if (std::fabs(jetTrack.eta()) < 0.5) { INELgt0 = true; break; } @@ -1191,7 +1228,7 @@ struct kstarInOO { } //==================== - //|| Has Jets + //| Has Jets //==================== if (cfgReqJets) { if (!HasJets) { @@ -1200,8 +1237,9 @@ struct kstarInOO { } histos.fill(HIST("nEvents"), 3.5); // Has jets - // JetTrackSlicingMC(collision, jetTracks, chargedjets, false, true); + JetTrackSlicingMC(collision, jetTracks, mcdjets, false, true); + // Instead of using "JetTrackSlicingMC", Once we have to test showing the distribution each condition for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) { auto trk1 = track1.track_as(); auto trk2 = track2.track_as(); @@ -1218,13 +1256,20 @@ struct kstarInOO { histos.fill(HIST("hEffRecTest1_pT"), lResonanceTest1.Pt()); } - if (!trackSelection(trk1, true) || !trackSelection(trk2, false)) - continue; + ////////////////////////////// + ////////////////////////////// + if (cfgReqMcEffTrackQA) { // false, true + if (!trackSelection(trk1, true) || !trackSelection(trk2, false)) + continue; + } + ////////////////////////////// + ////////////////////////////// + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest2_pT"), lResonanceTest1.Pt()); } - if (cfgReqMcEffPID) { + if (cfgReqMcEffPID) { // false, true if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) continue; } @@ -1290,6 +1335,10 @@ struct kstarInOO { continue; // mother not K*0 if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt()); + if (lResonanceTest1.Pt() < 0.4) { + histos.fill(HIST("hEffRecLowPtKstarDaughter"), lDecayDaughterTest1.Pt()); + histos.fill(HIST("hEffRecLowPtKstarDaughter"), lDecayDaughterTest2.Pt()); + } } if (std::fabs(mothers2PDG[0]) != 313) @@ -1298,6 +1347,7 @@ struct kstarInOO { if (cfgJetMCHistos) { histos.fill(HIST("hEffRec_pT"), lResonanceTest1.Pt()); } + } // track loop } // process loop PROCESS_SWITCH(kstarInOO, processMCJets, "process MC Jets", false); @@ -1464,7 +1514,7 @@ struct kstarInOO { } } //======================= - //|| Event & Signal loss + //| Event & Signal loss //======================= if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); @@ -1501,7 +1551,7 @@ struct kstarInOO { } // recocolls (=reconstructed collisions) //================= - //|| Efficiency + //| Efficiency //================= for (auto& particle : mcParticles) { if (particle.pdgCode() != 313) @@ -1532,82 +1582,67 @@ struct kstarInOO { } } //======================= - //|| Event & Signal loss + //| Event & Signal loss //======================= + bool isTrueINELgt0 = false; + for (auto& particle : mcParticles) { + if (std::fabs(particle.eta()) > 1.0) + continue; + if (std::fabs(particle.pt()) <= 0.0) + continue; + isTrueINELgt0 = true; + break; + } + + if (cfgForceTrueINELgt) { + if (!isTrueINELgt0) { + return; + } + } if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); } + if (fabs(collision.posZ()) > cfgEventVtxCut) + return; + + if (cfgJetMCHistos) { + histos.fill(HIST("nEvents_Gen"), 1.5); + } + for (auto& particle : mcParticles) { if (particle.pdgCode() != 313) continue; if (std::fabs(particle.eta()) > cfgTrackMaxEta) continue; - if (fabs(collision.posZ()) > cfgEventVtxCut) - break; if (cfgJetMCHistos) { - histos.fill(HIST("hGen_pT_Raw"), particle.pt()); + histos.fill(HIST("hGen_pT_Raw"), particle.pt()); /// numerator for SL } } // Unrecon. collision(=Raw coll) for correction if (recocolls.size() <= 0) { // not reconstructed return; } - - for (auto& recocoll : recocolls) { // poorly reconstructed - if (recocoll.posZ() > cfgEventVtxCut) - continue; - auto goodEv = jetderiveddatautilities::selectCollision(recocoll, eventSelectionBits); - auto goodTrig = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); - for (auto& particle : mcParticles) { - if (particle.pdgCode() != 313) - continue; - if (std::fabs(particle.eta()) > cfgTrackMaxEta) - continue; - if (cfgJetMCHistos) { - // check K* PID - if (goodEv) { - histos.fill(HIST("hGen_pT_GoodEv"), particle.pt()); - - } // goodEv - - if (goodTrig) { - histos.fill(HIST("hGen_pT_GoodTrig"), particle.pt()); - - } // goodTrig - - if (goodEv && goodTrig) { - histos.fill(HIST("hGen_pT_GoodEvTrig"), particle.pt()); - - if (cfgJetQAHistos) { - histos.fill(HIST("nTriggerQA"), 7.5); - } - - } // goodEvTrig - } // cfgJetMCHistos - } // mcParticles - } // recocolls (=reconstructed collisions) - //================= - //|| Efficiency + //| Efficiency //================= - // if (fabs(collision.posZ()) > cfgEventVtxCut) - // return; - for (auto& recocoll : recocolls) { // poorly reconstructed auto goodEv = jetderiveddatautilities::selectCollision(recocoll, eventSelectionBits); if (goodEv) { goodEv = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); } + if (recocoll.posZ() > cfgEventVtxCut) + goodEv = false; + if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 1.5); + histos.fill(HIST("nEvents_Gen"), 2.5); } if (!goodEv) return; - } + } // recocoll if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 2.5); + histos.fill(HIST("nEvents_Gen"), 3.5); } for (auto& particle : mcParticles) { @@ -1640,20 +1675,212 @@ struct kstarInOO { */ if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 3.5); - histos.fill(HIST("hEffGen_pT"), particle.pt()); - } // cfgJetMCHistos + histos.fill(HIST("hEffGen_pT"), particle.pt()); // denomenator for SL and eff + } + } // loop over particles } // end of process PROCESS_SWITCH(kstarInOO, processJetsGen, "Process Generated Particles Inclusive&Jets", false); - void processEventsDummy(EventCandidates::iterator const&, TrackCandidates const&) + int ndRtest = 0; + void processJetQA(o2::aod::JetMcCollision const& collision, soa::Filtered const& mcpjets, aod::JetParticles const& jetParticles, aod::McParticles const& mcParticles) { - return; - } - PROCESS_SWITCH(kstarInOO, processEventsDummy, "dummy", false); -}; // kstarInOO + if (cDebugLevel > 0) { + ++ndRtest; + if (ndRtest % 10000 == 0) { + std::cout << "Processed dR test: " << ndRtest << std::endl; + } + } + + bool isTrueINELgt0 = false; + for (auto& mcpjet : mcpjets) { + if (std::fabs(mcpjet.eta()) > cfgTrackMaxEta) + continue; + if (mcpjet.pt() <= 0.0) + continue; + isTrueINELgt0 = true; + + break; + } // Selection event through particle loop + + if (!isTrueINELgt0) + return; + if (std::fabs(collision.posZ()) > cfgEventVtxCut) + return; + + // Particle Level + for (const auto& [particle1, particle2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetParticles, jetParticles))) { + + if (std::fabs(particle1.eta()) > cfgTrackMaxEta || std::fabs(particle2.eta()) > cfgTrackMaxEta) + continue; + if (!particle1.has_mothers() || !particle2.has_mothers()) + continue; + + std::vector mothers1{}; + std::vector mothers1PDG{}; + + for (auto& idx1 : particle1.mothersIds()) { + auto mom1 = mcParticles.rawIteratorAt(idx1); + mothers1.push_back(idx1); + mothers1PDG.push_back(mom1.pdgCode()); + } + + std::vector mothers2{}; + std::vector mothers2PDG{}; + + for (auto& idx2 : particle2.mothersIds()) { + auto mom2 = mcParticles.rawIteratorAt(idx2); + mothers2.push_back(idx2); + mothers2PDG.push_back(mom2.pdgCode()); + } + + if (mothers1PDG[0] != 313 || mothers2PDG[0] != 313) // 313 is kstar0, 333 is phi(1020) + continue; + + if (mothers1[0] != mothers2[0]) + continue; + + if ((std::fabs(particle1.pdgCode()) != 211) && (std::fabs(particle1.pdgCode()) != 321)) + continue; + if ((std::fabs(particle2.pdgCode()) != 211) && (std::fabs(particle2.pdgCode()) != 321)) + continue; + + double track1_mass, track2_mass; + if (std::fabs(particle1.pdgCode()) == 211) { + track1_mass = massPi; + } else { + track1_mass = massKa; + } + + if (std::fabs(particle2.pdgCode()) == 211) { + track2_mass = massPi; + } else { + track2_mass = massKa; + } + + if (track1_mass == track2_mass) + continue; + + histos.fill(HIST("particle1_pdg"), particle1.pdgCode()); // kaon + histos.fill(HIST("particle2_pdg"), particle2.pdgCode()); // pion + + // bool passPtCut = (particle1.pt() > 0.5 && particle2.pt() > 0.5); + + ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso; + lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), track1_mass); // kaon + lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), track2_mass); // pion + lTrueReso = lTrueDaughter1 + lTrueDaughter2; + + if (lTrueReso.M() < 0) + continue; + if (std::fabs(lTrueReso.Eta()) > cfgTrackMaxEta) + continue; + + double dphi = TVector2::Phi_mpi_pi(particle1.phi() - particle2.phi()); + double deta = particle1.eta() - particle2.eta(); + double dR = TMath::Sqrt((dphi * dphi) + (deta * deta)); + bool INELgt0 = false; + for (auto const& jet : mcpjets) { + + // if (jet.pt() < cfgJetpT) + // continue; + if (jet.pt() < 6.0) // jetpT cut 6 GeV/c minimum //test + continue; + if (std::fabs(jet.eta()) < cfgJetTrackMaxEta) // cfgJetTrackMaxEta = TrackMaxeta - jet_R + INELgt0 = true; + if (!INELgt0) + continue; + + // kaon and pion + double dphi_jet_pion = TVector2::Phi_mpi_pi(jet.phi() - particle2.phi()); + double deta_jet_pion = jet.eta() - particle2.eta(); + double dR_jet_pion = TMath::Sqrt((deta_jet_pion * deta_jet_pion) + (dphi_jet_pion * dphi_jet_pion)); + + double dphi_jet_kaon = TVector2::Phi_mpi_pi(jet.phi() - particle1.phi()); + double deta_jet_kaon = jet.eta() - particle1.eta(); + double dR_jet_kaon = TMath::Sqrt((deta_jet_kaon * deta_jet_kaon) + (dphi_jet_kaon * dphi_jet_kaon)); + + double dphi_kstar_jet = TVector2::Phi_mpi_pi(jet.phi() - lTrueReso.Phi()); + double deta_kstar_jet = jet.eta() - lTrueReso.Eta(); + double dR_kstar_jet = TMath::Sqrt((dphi_kstar_jet * dphi_kstar_jet) + (deta_kstar_jet * deta_kstar_jet)); + + // bool kaon_out = (dR_jet_kaon > cfgJetR); + // bool pion_out = (dR_jet_pion > cfgJetR); + + // double missing_pion_pt = 0; + // double missing_kaon_pt = 0; + + if (dR_kstar_jet > cfgJetR) + continue; + + if (cfgJetQAHistos) { + // without cut + histos.fill(HIST("dR_kaon_pion"), dR, lTrueReso.Pt()); + histos.fill(HIST("kstar_pT_all"), dR_kstar_jet, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_kaon_all"), dR_jet_kaon, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_pion_all"), dR_jet_pion, lTrueReso.Pt()); + + histos.fill(HIST("dR_taggedjet_all_all"), dR_jet_kaon, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_all_all"), dR_jet_pion, lTrueReso.Pt()); + + // if (kaon_out){ + // missing_kaon_pt+=lTrueDaughter1.Pt(); //kaon + // histos.fill(HIST("missed_kaon_INJets"), (jet.pt() - missing_kaon_pt)/jet.pt(), lTrueReso.Pt()); + // } + // if (pion_out){ + // missing_pion_pt+=lTrueDaughter2.Pt(); //pion + // histos.fill(HIST("missed_pion_INJets"), (jet.pt() - missing_pion_pt)/jet.pt(), lTrueReso.Pt()); + // } + // if (kaon_out || pion_out){ // missing kaon + missing pion + both + // if (jet.pt() > 6.0 && jet.pt() < 8.0) + // histos.fill(HIST("missed_kpi_INJets_6_8"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // if (jet.pt() > 8.0 && jet.pt() < 10.0) + // histos.fill(HIST("missed_kpi_INJets_8_10"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // if (jet.pt() > 10.0 && jet.pt() < 12.0) + // histos.fill(HIST("missed_kpi_INJets_10_12"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // if (jet.pt() > 12.0 && jet.pt() < 15.0) + // histos.fill(HIST("missed_kpi_INJets_12_15"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // if (jet.pt() > 15.0 && jet.pt() < 25.0) + // histos.fill(HIST("missed_kpi_INJets_15_25"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // if (jet.pt() > 25.0) + // histos.fill(HIST("missed_kpi_INJets_25_infinite"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + + // // histos.fill(HIST("missed_kpi_INJets_fraction"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()/jet.pt()); + // } + // if (!kaon_out && !pion_out){ + // histos.fill(HIST("catched_kpi_INJets"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // } + + //======================================= + // test for cutting 0.5 GeV/c each track + //======================================= + // if (passPtCut){ + // histos.fill(HIST("dR_kaon_pion_passed"), dR, lTrueReso.Pt()); + // histos.fill(HIST("kstar_pT_passPtCut"), dR_kstar_jet, lTrueReso.Pt()); + // histos.fill(HIST("dR_taggedjet_kaon_passed"), dR_jet_kaon, lTrueReso.Pt()); + // histos.fill(HIST("dR_taggedjet_pion_passed"), dR_jet_pion, lTrueReso.Pt()); + + // if(kaon_out){ + // missing_kaon_pt+=lTrueDaughter1.Pt(); //kaon + // histos.fill(HIST("missed_kaon_INJets_passed"), (jet.pt() - missing_kaon_pt)/jet.pt(), lTrueReso.Pt()); + // } + // if(pion_out){ + // missing_pion_pt+=lTrueDaughter2.Pt(); //pion + // histos.fill(HIST("missed_pion_INJets_passed"), (jet.pt() - missing_pion_pt)/jet.pt(), lTrueReso.Pt()); + // } + // if(kaon_out || pion_out){ + // histos.fill(HIST("missed_kpi_INJets_passed"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + // } + + // } //passedPtCut + } // cfgJetQAHistos + + } // mcpjets + } // particle Loop + }; + PROCESS_SWITCH(kstarInOO, processJetQA, "Process dR of K*0 Inclusive and Inside jet", false); +}; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -}; +} From 40fe7101a1e9e198f731931a72ef8b45a28e65a7 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 2 Jun 2026 12:50:15 +0900 Subject: [PATCH 02/11] update of kstarInOO.cxx --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 434 +++++++++++++++------------ 1 file changed, 235 insertions(+), 199 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 74c884e76eb..b88eb8e1b21 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -21,17 +21,19 @@ #include "CommonConstants/PhysicsConstants.h" #include "DataFormatsParameters/GRPObject.h" + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/Track.h" -#include -#include -#include -#include -#include -#include + +#include "Framework/ASoAHelpers.h" +#include "Framework/Configurable.h" +#include "Framework/HistogramSpec.h" +#include "Framework/InitContext.h" +#include "Framework/OutputObjHeader.h" +#include "Framework/runDataProcessing.h" // jet #include "PWGJE/Core/JetDerivedDataUtilities.h" @@ -88,7 +90,6 @@ struct kstarInOO { // General Configurable cfgTrackMinPt{"cfgTrackMinPt", 0.15, "set track min pT"}; Configurable cfgTrackMaxEta{"cfgTrackMaxEta", 0.8, "set track max Eta"}; - Configurable cfgJetTrackMaxEta{"cfgJetTrackMaxEta", 0.4, "set jet track max Eta"}; Configurable cfgTrackMaxDCArToPVcut{"cfgTrackMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; Configurable cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; Configurable cfgTrackGlobalSel{"cfgTrackGlobalSel", true, "Global track selection"}; @@ -147,8 +148,8 @@ struct kstarInOO { Configurable cfgJetMCHistos{"cfgJetMCHistos", false, "Enable Jet MC Histos"}; Configurable cfgCutonTrig{"cfgCutonTrig", false, "Enable Jet Cut on Trig"}; - Configurable cfgManualEvSel{"cfgManualEvSel", false, "Enable Manual EvSel"}; - Configurable cfgJetEvSel{"cfgJetEvSel", false, "Enable Manual JetEvSel"}; + // Configurable cfgManualEvSel{"cfgManualEvSel", false, "Enable Manual EvSel"}; + // Configurable cfgJetEvSel{"cfgJetEvSel", false, "Enable Manual JetEvSel"}; //====================== //| @@ -189,6 +190,23 @@ struct kstarInOO { histos.add("hPosZ_AC", "hPosZ_AC", kTH1F, {{300, -15.0, 15.0}}); histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{110, 0.0, 110.0}}); histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{110, 0.0, 110.0}}); + + std::shared_ptr hCutFlow = histos.get(HIST("hEvent_Cut")); + std::vector eventCutLabels = { + "All Events", + "sel8", + Form("|Vz| < %.1f", cfgEventVtxCut.value), + "kIsGoodZvtxFT0vsPV", + "kNoSameBunchPileup", + "kNoTimeFrameBorder", + "kNoITSROFrameBorder", + "kNoCollInTimeRangeStandard", + "kIsGoodITSLayersAll", + Form("Occupancy < %.0f", cfgOccupancyMax.value), + "All passed events"}; + for (size_t i = 0; i < eventCutLabels.size(); ++i) { + hCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str()); + } } if (cfgTrackCutQA) { histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {axisDCAxy}); @@ -234,22 +252,24 @@ struct kstarInOO { histos.add("JetEta", "Jet Eta", kTH1F, {{100, -1.0, 1.0}}); histos.add("JetPhi", "Jet Phi", kTH1F, {{80, -1.0, 7.0}}); + histos.add("nGoodJets", "The number of good jets", kTH1F, {{5, -0.5, 5.5}}); + histos.add("nJetsPerEvent", "The number of jet per event", kTH1F, {{5, -0.5, 5.5}}); + histos.add("rawDimpT", "rawDimpT", kTH2F, {{1000, 0.0, 10.0}, {100, -0.5, 0.5}}); + histos.add("jetTrackpT", "Jet Track pT", kTH1F, {{4000, 0., 200.}}); + histos.add("TrackpT", "Track pT", kTH1F, {{4000, 0., 200.}}); + + + histos.add("jetTrackEta", "Jet Track Eta", kTH1F, {{100, -1.0, 1.0}}); histos.add("jetTrackPhi", "Jet Track Phi", kTH1F, {{80, -1.0, 7.0}}); - histos.add("dR_kaon_pion", "dR between kaon and pion1", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); - histos.add("dR_kaon_pion_passed", "dR between kaon and pion w pT cut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); - - histos.add("dR_taggedjet_kaon_all", "dR between tagged jet and kaon wo pT cut", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); - histos.add("dR_taggedjet_pion_all", "dR between tagged jet and pion wo pT cut", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); - histos.add("dR_taggedjet_all_all", "dR between tagged jet and kpi", {HistType::kTH2F, {{15, 0., 1.5}, {100, 0., 20.}}}); - - histos.add("dR_taggedjet_kaon_woJetR", "dR between tagged jet and kaon wo Jet R", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); - histos.add("dR_taggedjet_pion_woJetR", "dR between tagged jet and pion wo Jet R", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); - - histos.add("dR_taggedjet_kaon_passed", "dR between tagged jet and kaon w pT cut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); - histos.add("dR_taggedjet_pion_passed", "dR between tagged jet and pion w pT cut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_kaon_pion", "dR between kaon and pion1", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + + histos.add("dR_taggedjet_kaon", "dR between tagged jet and kaon wo pT cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_pion", "dR between tagged jet and pion wo pT cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_all", "dR between tagged jet and kpi", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_all_8cut", "dR between tagged jet and kpi with 8GeV/c cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); histos.add("missed_pion_INJets", "missed pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); histos.add("missed_kaon_INJets", "missed kaon In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); @@ -260,27 +280,16 @@ struct kstarInOO { histos.add("missed_kpi_INJets_12_15", "missed kpi In Jets with 12 < jetPt < 15", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); histos.add("missed_kpi_INJets_15_25", "missed kpi In Jets with 15 < jetPt < 25", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); histos.add("missed_kpi_INJets_25_infinite", "missed kpi In Jets with 25 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("missed_kpi_INJets_8_infinite", "missed kpi In Jets with 8 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); - histos.add("missed_kpi_INJets_fraction", "missed kaon and pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {120, 0., 1.2}}}); - - histos.add("catched_kpi_INJets", "catched_kpi_INJets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); - - histos.add("missed_pion_INJets_passed", "missed pion In Jets w pT cut", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); - histos.add("missed_kaon_INJets_passed", "missed kaon In Jets w pT cut", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); - histos.add("missed_kpi_INJets_passed", "missed kaon and pion In Jets w pT cut", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + // histos.add("missed_kpi_INJets_fraction", "missed kaon and pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {120, 0., 1.2}}}); histos.add("particle1_pdg", "particle1 pdg Code", kTH1F, {{2000, -1000., 1000.}}); histos.add("particle2_pdg", "particle2 pdg Code", kTH1F, {{2000, -1000., 1000.}}); - histos.add("kstar_pT_all", "kstar_pT_all", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); - histos.add("kstar_pT_passPtCut", "kstar_pT_passPtCut", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); - histos.add("jet_all", "jet all", kTH1F, {{4000, 0., 200.}}); - histos.add("jet_passCut", "jet passed pT cut", kTH1F, {{4000, 0., 200.}}); - - histos.add("nJetsPerEvent", "nJetsPerEvent", kTH1I, {{4, -0.5, 3.5}}); - histos.add("nGoodJets", "nGoodJets", kTH1I, {{4, -0.5, 3.5}}); + histos.add("kstar_pT", "kstar_pT", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); } - + //////////////////////////////////// histos.add("nEvents", "nEvents", kTH1F, {{7, 0.0, 7.0}}); histos.add("hUSS_KPi", "hUSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); @@ -329,23 +338,6 @@ struct kstarInOO { histos.add("hMotherPdg2", "hMotherPdg2", kTH1F, {{5000, 0., 5000.}}); } - std::shared_ptr hCutFlow = histos.get(HIST("hEvent_Cut")); - std::vector eventCutLabels = { - "All Events", - "sel8", - Form("|Vz| < %.1f", cfgEventVtxCut.value), - "kIsGoodZvtxFT0vsPV", - "kNoSameBunchPileup", - "kNoTimeFrameBorder", - "kNoITSROFrameBorder", - "kNoCollInTimeRangeStandard", - "kIsGoodITSLayersAll", - Form("Occupancy < %.0f", cfgOccupancyMax.value), - "All passed events"}; - for (size_t i = 0; i < eventCutLabels.size(); ++i) { - hCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str()); - } - // Jet eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits(static_cast(cfgEventSelections)); RealTriggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(cfgRealTriggerMasks); @@ -369,13 +361,10 @@ struct kstarInOO { //================= Filter JEPosZFilter = nabs(aod::jcollision::posZ) < cfgEventVtxCut; Filter JEMCPosZFilter = nabs(aod::jmccollision::posZ) < cfgEventVtxCut; - Filter jetCuts = aod::jet::pt > cfgJetpT&& aod::jet::r == nround(cfgJetR.node() * 100.0f); - - using JetTrackCandidates = soa::Join; + Filter JetCuts = aod::jet::pt > cfgJetpT&& aod::jet::r == nround(cfgJetR.node() * 100.0f); + using JetTrackCandidatesMC = soa::Join; - - using JetFilteredJets = soa::Filtered>; - + // For Mixed Event using BinningType = ColumnBinningPolicy; @@ -1050,8 +1039,11 @@ struct kstarInOO { //| JET DATA STUFF //| //======================================================= + using JetTrackCandidates = soa::Join; + using JetFilteredJets = soa::Filtered>; + int nJetEvents = 0; - void processDataJets(o2::aod::JetCollision const& collision, JetFilteredJets const& chargedjets, JetTrackCandidates const& jetTracks, TrackCandidates const&) + void processDataJets(o2::aod::JetCollision const& collision, JetFilteredJets const& chargedjets, JetTrackCandidates const& jetTracks, TrackCandidates const& Tracks) { if (cDebugLevel > 0) { nJetEvents++; @@ -1063,6 +1055,9 @@ struct kstarInOO { histos.fill(HIST("nEvents"), 0.5); // Raw event // Trigger before we start jet finding + //===================== + //| Trigger + //===================== if (cfgCutonTrig) { bool RT = false; bool VTtest1 = false; @@ -1099,21 +1094,37 @@ struct kstarInOO { } } // Trigger cut - histos.fill(HIST("nEvents"), 1.5); // Before passing the condition + histos.fill(HIST("nEvents"), 1.5); // After selecting the triggers - if (cfgManualEvSel) { - auto [goodEv, code] = JeteventSelection(collision, true); - if (!goodEv) - return; + if (std::fabs(collision.posZ()) > cfgEventVtxCut) + return; + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; } - - if (cfgJetEvSel) { - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } + + bool INELgt0 = false; + for (auto& jetTrack : jetTracks){ + if (std::fabs(jetTrack.eta()) < cfgTrackMaxEta) // NOT JetTrackEta cut. Just taking the general eta cut for Inclusive + INELgt0 = true; + break; } - histos.fill(HIST("nEvents"), 2.5); // Events after event quality selection for Inclusive - + if (!INELgt0) + return; + + histos.fill(HIST("nEvents"), 2.5); // Events for Inclusive + + //test + // for (auto& jetTrack:jetTracks){ + // histos.fill(HIST("jetTrackpT"), jetTrack.pt()); + // } + + // for (auto& track:Tracks){ + // histos.fill(HIST("TrackpT"), track.pt()); + // } + + //test + /* + std::vector jetpT{}; std::vector jetEta{}; std::vector jetPhi{}; @@ -1137,7 +1148,7 @@ struct kstarInOO { } //==================== - //|| Has Jets + //| Has Jets //==================== if (cfgReqJets) { if (!HasJets) @@ -1145,23 +1156,21 @@ struct kstarInOO { } histos.fill(HIST("nEvents"), 3.5); // Has jets - bool INELgt0 = false; for (auto& jetTrack : jetTracks) { auto originTrack = jetTrack.track_as(); if (!trackSelection(originTrack, true)) continue; - INELgt0 = true; if (cfgJetQAHistos) { histos.fill(HIST("rawDimpT"), jetTrack.pt(), jetTrack.pt() - originTrack.pt()); + histos.fill(HIST("jetTrackpT"), jetTrack.pt()); histos.fill(HIST("jetTrackEta"), jetTrack.eta()); histos.fill(HIST("jetTrackPhi"), jetTrack.phi()); } } // jetTrack loop - if (!INELgt0) - return; - - JetTrackSlicing(collision, jetTracks, chargedjets, false, true); + */ + + // JetTrackSlicing(collision, jetTracks, chargedjets, false, true); } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1189,11 +1198,11 @@ struct kstarInOO { if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) return; - histos.fill(HIST("nEvents"), 1.5); // Before passing the condition + histos.fill(HIST("nEvents"), 1.5); // After passing the triggers bool INELgt0 = false; for (auto& jetTrack : jetTracks) { - if (std::fabs(jetTrack.eta()) < 0.5) { + if (std::fabs(jetTrack.eta()) < (cfgTrackMaxEta-cfgJetR)) { INELgt0 = true; break; } @@ -1201,7 +1210,7 @@ struct kstarInOO { if (!INELgt0) return; - histos.fill(HIST("nEvents"), 2.5); // Events after event quality selection for Inclusive + histos.fill(HIST("nEvents"), 2.5); // Events for Inclusive std::vector mcdjetpT{}; std::vector mcdjetEta{}; @@ -1237,7 +1246,7 @@ struct kstarInOO { } histos.fill(HIST("nEvents"), 3.5); // Has jets - JetTrackSlicingMC(collision, jetTracks, mcdjets, false, true); + // JetTrackSlicingMC(collision, jetTracks, mcdjets, false, true); // Instead of using "JetTrackSlicingMC", Once we have to test showing the distribution each condition for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) { @@ -1379,6 +1388,7 @@ struct kstarInOO { continue; if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; + break; } } if (!INELgt0) @@ -1459,6 +1469,7 @@ struct kstarInOO { continue; if (std::fabs(track.eta()) < cfgTrackMaxEta) { INELgt0 = true; + break; } } if (!INELgt0) @@ -1516,53 +1527,81 @@ struct kstarInOO { //======================= //| Event & Signal loss //======================= + bool isTrueINELgt0 = false; + for (auto& particle : mcParticles){ + if (std::fabs(particle.eta()) > 1.0) + continue; + if (std::fabs(particle.pt()) <= 0.0) + continue; + isTrueINELgt0 = true; + break; + } + + if (cfgForceTrueINELgt){ + if (!isTrueINELgt0){ + return; + } + } if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); } + if (std::fabs(collision.posZ()) > cfgEventVtxCut) + return; + if (cfgMCHistos) { + histos.fill(HIST("nEvents_Gen"), 1.5); + } + for (auto& particle : mcParticles) { if (particle.pdgCode() != 313) continue; if (std::fabs(particle.eta()) > cfgTrackMaxEta) continue; - if (fabs(collision.posZ()) > cfgEventVtxCut) - break; if (cfgMCHistos) { - histos.fill(HIST("hGen_pT_Raw"), particle.pt()); + histos.fill(HIST("hGen_pT_Raw"), particle.pt()); /// numerator for SL } - } // Unreconstructed collisions(=Raw coll) for correction + } // Unrecon. collision(=Raw coll) for correction if (recocolls.size() <= 0) { // not reconstructed if (cfgForceGenReco) { return; } } + + //================= + //| Efficiency + //================= double centrality = -1; - for (auto& recocoll : recocolls) { + for (auto& recocoll : recocolls) { // poorly reconstructed centrality = recocoll.centFT0C(); auto [goodEv, code] = eventSelection(recocoll, true); + if (recocoll.posZ() > cfgEventVtxCut) + goodEv = false; + if (cfgMCHistos) { - histos.fill(HIST("nEvents_Gen"), 1.5); + histos.fill(HIST("nEvents_Gen"), 2.5); } if (!goodEv) continue; } // recocolls (=reconstructed collisions) + if (cfgMCHistos){ + histos.fill(HIST("nEvents_Gen"), 3.5); + } - //================= - //| Efficiency - //================= for (auto& particle : mcParticles) { if (particle.pdgCode() != 313) continue; // Not K*0 if (std::fabs(particle.eta()) > cfgTrackMaxEta) continue; + if (particle.pt() < cfgTrackMinPt) + continue; if (cfgMCHistos) { - histos.fill(HIST("nEvents_Gen"), 2.5); - histos.fill(HIST("hGen_pT_GoodEv"), centrality, particle.pt()); - } // cfgMCHistos + histos.fill(HIST("hGen_pT_GoodEv"), centrality, particle.pt()); // denominator for SL and eff + } + } // loop over particles } // processMCTrue PROCESS_SWITCH(kstarInOO, processGen, "process Generated Particles", false); @@ -1654,24 +1693,24 @@ struct kstarInOO { continue; /* // Not Yet - if (cfg_Force_BR) { - bool baddecay = false; - for (auto& phidaughter : particle.daughters_as()) { - if (std::fabs(phidaughter.pdgCode()) != 321) { - baddecay = true; - break; - } - if (cfg_Force_Kaon_Acceptence) { - if (std::fabs(phidaughter.eta()) > cfg_Track_MaxEta) { - baddecay = true; - break; - } - } - } // loop over daughters - - if (baddecay) - continue; - } // enforce BR restriction + if (cfg_Force_BR) { + bool baddecay = false; + for (auto& phidaughter : particle.daughters_as()) { + if (std::fabs(phidaughter.pdgCode()) != 321) { + baddecay = true; + break; + } + if (cfg_Force_Kaon_Acceptence) { + if (std::fabs(phidaughter.eta()) > cfg_Track_MaxEta) { + baddecay = true; + break; + } + } + } // loop over daughters + + if (baddecay) + continue; + } // enforce BR restriction */ if (cfgJetMCHistos) { @@ -1691,7 +1730,15 @@ struct kstarInOO { std::cout << "Processed dR test: " << ndRtest << std::endl; } } - + //=========================== + // + // recocolls -- done + // vertex filter + // jetParticles --> mcParticle.eta() cut ? + // INELgt0 + // mcpjet + // + //=========================== bool isTrueINELgt0 = false; for (auto& mcpjet : mcpjets) { if (std::fabs(mcpjet.eta()) > cfgTrackMaxEta) @@ -1734,32 +1781,37 @@ struct kstarInOO { mothers2PDG.push_back(mom2.pdgCode()); } - if (mothers1PDG[0] != 313 || mothers2PDG[0] != 313) // 313 is kstar0, 333 is phi(1020) + if (mothers1PDG[0] != 333 || mothers2PDG[0] != 333) // 313 is kstar0, 333 is phi(1020) continue; if (mothers1[0] != mothers2[0]) continue; - - if ((std::fabs(particle1.pdgCode()) != 211) && (std::fabs(particle1.pdgCode()) != 321)) - continue; - if ((std::fabs(particle2.pdgCode()) != 211) && (std::fabs(particle2.pdgCode()) != 321)) + //kstar + // if ((std::fabs(particle1.pdgCode()) != 211) && (std::fabs(particle1.pdgCode()) != 321)) //211 is pion + // continue; + // if ((std::fabs(particle2.pdgCode()) != 211) && (std::fabs(particle2.pdgCode()) != 321)) + // continue; + + //phi meson + if ((std::fabs(particle1.pdgCode()) != 321) && (std::fabs(particle2.pdgCode()) != 321)) //321 is kaon continue; - double track1_mass, track2_mass; - if (std::fabs(particle1.pdgCode()) == 211) { - track1_mass = massPi; - } else { - track1_mass = massKa; - } + //kstar + // double track1_mass, track2_mass; + // if (std::fabs(particle1.pdgCode()) == 211) { + // track1_mass = massPi; + // } else { + // track1_mass = massKa; + // } - if (std::fabs(particle2.pdgCode()) == 211) { - track2_mass = massPi; - } else { - track2_mass = massKa; - } + // if (std::fabs(particle2.pdgCode()) == 211) { + // track2_mass = massPi; + // } else { + // track2_mass = massKa; + // } - if (track1_mass == track2_mass) - continue; + // if (track1_mass == track2_mass) + // continue; histos.fill(HIST("particle1_pdg"), particle1.pdgCode()); // kaon histos.fill(HIST("particle2_pdg"), particle2.pdgCode()); // pion @@ -1767,8 +1819,10 @@ struct kstarInOO { // bool passPtCut = (particle1.pt() > 0.5 && particle2.pt() > 0.5); ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso; - lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), track1_mass); // kaon - lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), track2_mass); // pion + // lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), track1_mass); // kaon + // lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), track2_mass); // pion + lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), massKa); // kaon + lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), massKa); // kaon lTrueReso = lTrueDaughter1 + lTrueDaughter2; if (lTrueReso.M() < 0) @@ -1784,9 +1838,9 @@ struct kstarInOO { // if (jet.pt() < cfgJetpT) // continue; - if (jet.pt() < 6.0) // jetpT cut 6 GeV/c minimum //test - continue; - if (std::fabs(jet.eta()) < cfgJetTrackMaxEta) // cfgJetTrackMaxEta = TrackMaxeta - jet_R + // if (jet.pt() < 6.0) // jetpT cut 6 GeV/c minimum //test + // continue; + if (std::fabs(jet.eta()) < (cfgTrackMaxEta-cfgJetR)) // cfgJetTrackMaxEta INELgt0 = true; if (!INELgt0) continue; @@ -1804,11 +1858,11 @@ struct kstarInOO { double deta_kstar_jet = jet.eta() - lTrueReso.Eta(); double dR_kstar_jet = TMath::Sqrt((dphi_kstar_jet * dphi_kstar_jet) + (deta_kstar_jet * deta_kstar_jet)); - // bool kaon_out = (dR_jet_kaon > cfgJetR); - // bool pion_out = (dR_jet_pion > cfgJetR); + bool kaon_out = (dR_jet_kaon > cfgJetR); + bool pion_out = (dR_jet_pion > cfgJetR); - // double missing_pion_pt = 0; - // double missing_kaon_pt = 0; + double missing_pion_pt = 0; + double missing_kaon_pt = 0; if (dR_kstar_jet > cfgJetR) continue; @@ -1816,65 +1870,47 @@ struct kstarInOO { if (cfgJetQAHistos) { // without cut histos.fill(HIST("dR_kaon_pion"), dR, lTrueReso.Pt()); - histos.fill(HIST("kstar_pT_all"), dR_kstar_jet, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_kaon_all"), dR_jet_kaon, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_pion_all"), dR_jet_pion, lTrueReso.Pt()); - - histos.fill(HIST("dR_taggedjet_all_all"), dR_jet_kaon, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_all_all"), dR_jet_pion, lTrueReso.Pt()); - - // if (kaon_out){ - // missing_kaon_pt+=lTrueDaughter1.Pt(); //kaon - // histos.fill(HIST("missed_kaon_INJets"), (jet.pt() - missing_kaon_pt)/jet.pt(), lTrueReso.Pt()); - // } - // if (pion_out){ - // missing_pion_pt+=lTrueDaughter2.Pt(); //pion - // histos.fill(HIST("missed_pion_INJets"), (jet.pt() - missing_pion_pt)/jet.pt(), lTrueReso.Pt()); - // } - // if (kaon_out || pion_out){ // missing kaon + missing pion + both - // if (jet.pt() > 6.0 && jet.pt() < 8.0) - // histos.fill(HIST("missed_kpi_INJets_6_8"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // if (jet.pt() > 8.0 && jet.pt() < 10.0) - // histos.fill(HIST("missed_kpi_INJets_8_10"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // if (jet.pt() > 10.0 && jet.pt() < 12.0) - // histos.fill(HIST("missed_kpi_INJets_10_12"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // if (jet.pt() > 12.0 && jet.pt() < 15.0) - // histos.fill(HIST("missed_kpi_INJets_12_15"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // if (jet.pt() > 15.0 && jet.pt() < 25.0) - // histos.fill(HIST("missed_kpi_INJets_15_25"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // if (jet.pt() > 25.0) - // histos.fill(HIST("missed_kpi_INJets_25_infinite"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - - // // histos.fill(HIST("missed_kpi_INJets_fraction"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()/jet.pt()); - // } - // if (!kaon_out && !pion_out){ - // histos.fill(HIST("catched_kpi_INJets"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // } - - //======================================= - // test for cutting 0.5 GeV/c each track - //======================================= - // if (passPtCut){ - // histos.fill(HIST("dR_kaon_pion_passed"), dR, lTrueReso.Pt()); - // histos.fill(HIST("kstar_pT_passPtCut"), dR_kstar_jet, lTrueReso.Pt()); - // histos.fill(HIST("dR_taggedjet_kaon_passed"), dR_jet_kaon, lTrueReso.Pt()); - // histos.fill(HIST("dR_taggedjet_pion_passed"), dR_jet_pion, lTrueReso.Pt()); - - // if(kaon_out){ - // missing_kaon_pt+=lTrueDaughter1.Pt(); //kaon - // histos.fill(HIST("missed_kaon_INJets_passed"), (jet.pt() - missing_kaon_pt)/jet.pt(), lTrueReso.Pt()); - // } - // if(pion_out){ - // missing_pion_pt+=lTrueDaughter2.Pt(); //pion - // histos.fill(HIST("missed_pion_INJets_passed"), (jet.pt() - missing_pion_pt)/jet.pt(), lTrueReso.Pt()); - // } - // if(kaon_out || pion_out){ - // histos.fill(HIST("missed_kpi_INJets_passed"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - // } - - // } //passedPtCut - } // cfgJetQAHistos + histos.fill(HIST("kstar_pT"), dR_kstar_jet, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_kaon"), dR_jet_kaon, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_pion"), dR_jet_pion, lTrueReso.Pt()); + + histos.fill(HIST("dR_taggedjet_all"), dR_jet_kaon, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_jet_pion, lTrueReso.Pt()); + + if (jet.pt() > 8.0){ + histos.fill(HIST("dR_taggedjet_all_8cut"), dR_jet_kaon, lTrueReso.Pt()); + histos.fill(HIST("dR_taggedjet_all_8cut"), dR_jet_pion, lTrueReso.Pt()); + } + + if (kaon_out){ + missing_kaon_pt+=lTrueDaughter1.Pt(); //kaon + histos.fill(HIST("missed_kaon_INJets"), (jet.pt() - missing_kaon_pt)/jet.pt(), lTrueReso.Pt()); + } + if (pion_out){ + missing_pion_pt+=lTrueDaughter2.Pt(); //pion + histos.fill(HIST("missed_pion_INJets"), (jet.pt() - missing_pion_pt)/jet.pt(), lTrueReso.Pt()); + } + if (kaon_out || pion_out){ // missing kaon + missing pion + both + if (jet.pt() > 6.0 && jet.pt() < 8.0) + histos.fill(HIST("missed_kpi_INJets_6_8"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + if (jet.pt() > 8.0 && jet.pt() < 10.0) + histos.fill(HIST("missed_kpi_INJets_8_10"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + if (jet.pt() > 10.0 && jet.pt() < 12.0) + histos.fill(HIST("missed_kpi_INJets_10_12"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + if (jet.pt() > 12.0 && jet.pt() < 15.0) + histos.fill(HIST("missed_kpi_INJets_12_15"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + if (jet.pt() > 15.0 && jet.pt() < 25.0) + histos.fill(HIST("missed_kpi_INJets_15_25"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + if (jet.pt() > 25.0) + histos.fill(HIST("missed_kpi_INJets_25_infinite"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + + if (jet.pt() > 8.0) + histos.fill(HIST("missed_kpi_INJets_8_infinite"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); + + // histos.fill(HIST("missed_kpi_INJets_fraction"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()/jet.pt()); + } + } // cfgJetQAHistos } // mcpjets } // particle Loop }; From 53d005cb0dd03ab9717f0b7913a196225cea6c4f Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 12:32:54 +0900 Subject: [PATCH 03/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 688 ++++++++++++++------------- 1 file changed, 348 insertions(+), 340 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index b88eb8e1b21..18f9958ab92 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -81,6 +81,7 @@ struct kstarInOO { // Event Selection Configurable cfgEventSelections{"cfgEventSelections", "sel8", "Set event selection"}; Configurable cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"}; + Configurable cfgEventMaxEta{"cfgEventMaxEta", 1.0, "set INEL event eta cut"}; ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the centrality axis"}; Configurable cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"}; Configurable cfgOccupancyMax{"cfgOccupancyMax", 999999., "maximum occupancy of tracks in neighbouring collisions in a given time range"}; @@ -146,11 +147,9 @@ struct kstarInOO { Configurable cfgMixedHistos{"cfgMixedHistos", false, "Enable Mixed Histos"}; Configurable cfgJetHistos{"cfgJetHistos", false, "Enable Jet Histos"}; Configurable cfgJetMCHistos{"cfgJetMCHistos", false, "Enable Jet MC Histos"}; + Configurable cfgJetdRHistos{"cfgJetdRHistos", false, "Enable Jet dR QA Histos"}; Configurable cfgCutonTrig{"cfgCutonTrig", false, "Enable Jet Cut on Trig"}; - // Configurable cfgManualEvSel{"cfgManualEvSel", false, "Enable Manual EvSel"}; - // Configurable cfgJetEvSel{"cfgJetEvSel", false, "Enable Manual JetEvSel"}; - //====================== //| //| JET @@ -166,6 +165,9 @@ struct kstarInOO { Configurable cfgTriggerMasksTest3{"cfgTriggerMasksTest3", "", "possible JE Trigger masks Test3"}; Configurable cfgForceTrueINELgt{"cfgForceTrueINELgt", true, "Check generated event with True INELgt0"}; + Configurable cfgIsKstar{"cfgIsKstar", false, "Swaps Phi for Kstar analysis"}; + Configurable cfgBR{"cfgBR", false, "Forces Gen. Charged BR Only"}; + std::vector eventSelectionBits; std::vector RealTriggerMaskBits; std::vector triggerMaskBitsTest1; @@ -252,27 +254,27 @@ struct kstarInOO { histos.add("JetEta", "Jet Eta", kTH1F, {{100, -1.0, 1.0}}); histos.add("JetPhi", "Jet Phi", kTH1F, {{80, -1.0, 7.0}}); - histos.add("nGoodJets", "The number of good jets", kTH1F, {{5, -0.5, 5.5}}); - histos.add("nJetsPerEvent", "The number of jet per event", kTH1F, {{5, -0.5, 5.5}}); + histos.add("nGoodJets", "The number of good jets", kTH1F, {{6, -0.5, 5.5}}); + histos.add("nJetsPerEvent", "The number of jet per event", kTH1F, {{6, -0.5, 5.5}}); histos.add("rawDimpT", "rawDimpT", kTH2F, {{1000, 0.0, 10.0}, {100, -0.5, 0.5}}); - histos.add("jetTrackpT", "Jet Track pT", kTH1F, {{4000, 0., 200.}}); - histos.add("TrackpT", "Track pT", kTH1F, {{4000, 0., 200.}}); - - histos.add("jetTrackEta", "Jet Track Eta", kTH1F, {{100, -1.0, 1.0}}); histos.add("jetTrackPhi", "Jet Track Phi", kTH1F, {{80, -1.0, 7.0}}); + } + if (cfgJetdRHistos) { + histos.add("mcpjet_pt", "MC particle-level Jet pT (GeV/c)", kTH1F, {{2000, 0., 100.}}); + histos.add("mcpjet_eta", "MC particle-level Jet Eta", kTH1F, {{100, -1.0, 1.0}}); + histos.add("mcpjet_phi", "MC particle-level Jet Phi", kTH1F, {{80, -1.0, 7.0}}); - histos.add("dR_kaon_pion", "dR between kaon and pion1", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("Gen_particle_All_BR", "Generated particle All pT (GeV/c)", kTH1F, {{2000, 0., 100.}}); + histos.add("Gen_particle_BR", "Gen_particle_BR", kTH1F, {minvAxis}); + histos.add("Gen_particle_pT", "Generated particle pT (GeV/c)", kTH1F, {{2000, 0., 100.}}); histos.add("dR_taggedjet_kaon", "dR between tagged jet and kaon wo pT cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); histos.add("dR_taggedjet_pion", "dR between tagged jet and pion wo pT cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); histos.add("dR_taggedjet_all", "dR between tagged jet and kpi", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); - histos.add("dR_taggedjet_all_8cut", "dR between tagged jet and kpi with 8GeV/c cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); - - histos.add("missed_pion_INJets", "missed pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); - histos.add("missed_kaon_INJets", "missed kaon In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_all_6_8", "dR between tagged jet and kpi 6 < jet pT < 8", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); histos.add("missed_kpi_INJets_6_8", "missed kpi In Jets with 6 < jetPt < 8", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); histos.add("missed_kpi_INJets_8_10", "missed kpi In Jets with 8 < jetPt < 10", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); @@ -282,12 +284,9 @@ struct kstarInOO { histos.add("missed_kpi_INJets_25_infinite", "missed kpi In Jets with 25 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); histos.add("missed_kpi_INJets_8_infinite", "missed kpi In Jets with 8 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); - // histos.add("missed_kpi_INJets_fraction", "missed kaon and pion In Jets", {HistType::kTH2F, {{120, 0.0, 1.2}, {120, 0., 1.2}}}); - - histos.add("particle1_pdg", "particle1 pdg Code", kTH1F, {{2000, -1000., 1000.}}); - histos.add("particle2_pdg", "particle2 pdg Code", kTH1F, {{2000, -1000., 1000.}}); - - histos.add("kstar_pT", "kstar_pT", {HistType::kTH2F, {{30, 0., 1.5}, {100, 0., 20.}}}); + histos.add("recoveredJetpT_6_8to8_10", "recovered Jet pT", kTH1F, {{2000, 0., 100.}}); + + histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{100, 0.0, 50.0, "True jet pT (GeV/c)"}, {100, 0., 50., "Recovered jet pT (GeV/c)"}}}); } //////////////////////////////////// @@ -302,10 +301,10 @@ struct kstarInOO { histos.add("hUSS_PiK_Mix", "hUSS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } if (cfgMCHistos) { - histos.add("nEvents_Gen", "nEvents_Gen", kTH1F, {{4, 0.0, 4.0}}); + histos.add("nEvents_Gen", "nEvents_Gen", kTH1F, {{7, 0.0, 7.0}}); histos.add("hUSS_TrueRec", "hUSS_TrueRec", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hGen_pT_Raw", "Gen_pT_Raw (GeV/c)", kTH1F, {{800, 0., 40.}}); - histos.add("hGen_pT_GoodEv", "hGen_pT_GoodEv", kTHnSparseF, {cfgCentAxis, ptAxis}); + histos.add("hGen_pT_Kstar", "Gen_pT_Kstar (GeV/c)", kTH1F, {{800, 0., 40.}}); + histos.add("hRec_pT_Kstar", "Rec_pT_Kstar", kTHnSparseF, {cfgCentAxis, ptAxis}); } if (cfgJetHistos) { histos.add("hUSS_KPi_INSIDE", "hUSS_KPi_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); @@ -314,14 +313,15 @@ struct kstarInOO { histos.add("hLSS_PiK_INSIDE", "hLSS_PiK_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); } if (cfgJetMCHistos) { - histos.add("nEvents_Gen", "nEvents_Gen", kTH1F, {{7, -.0, 7.0}}); + histos.add("nEvents_Gen", "nEvents_Gen", kTH1F, {{7, 0.0, 7.0}}); histos.add("hUSS_TrueRec", "hUSS_TrueRec", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_TrueRec_INSIDE", "hUSS_TrueRec_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hGen_pT_Raw", "Gen_pT_Raw (GeV/c)", kTH1F, {{800, 0., 40.}}); - histos.add("hGen_pT_GoodEv", "Gen_pT_GoodTrig (GeV/c)", kTH1F, {{800, 0., 40.}}); + histos.add("hGen_pT_Kstar", "Gen_pT_Kstar (GeV/c)", kTH1F, {{800, 0., 40.}}); + histos.add("hRec_pT_Kstar", "Rec_pT_Kstar (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRec_pT", "EffRec_pT (GeV/c)", kTH1F, {{1600, 0., 80.}}); + histos.add("hEffRecTest0_pT", "EffRecTest0_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRecTest1_pT", "EffRecTest1_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRecTest2_pT", "EffRecTest2_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); histos.add("hEffRecTest3_pT", "EffRecTest3_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); @@ -801,7 +801,7 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) { return {}; } - if (std::fabs(particle1.eta()) > cfgTrackMaxEta || std::fabs(particle2.eta()) > cfgTrackMaxEta) { + if (std::abs(particle1.eta()) > cfgTrackMaxEta || std::abs(particle2.eta()) > cfgTrackMaxEta) { return {}; } @@ -826,19 +826,19 @@ struct kstarInOO { if (mothers1[0] != mothers2[0]) return {}; // Kaon and pion not from the same K*0 - if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) + if (std::abs(particle1.pdgCode()) != 211 && std::abs(particle1.pdgCode()) != 321) return {}; - if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) + if (std::abs(particle2.pdgCode()) != 211 && std::abs(particle2.pdgCode()) != 321) return {}; double track1_mass, track2_mass; - if (std::fabs(particle1.pdgCode()) == 211) { + if (std::abs(particle1.pdgCode()) == 211) { track1_mass = massPi; } else { track1_mass = massKa; } - if (std::fabs(particle2.pdgCode()) == 211) { + if (std::abs(particle2.pdgCode()) == 211) { track2_mass = massPi; } else { track2_mass = massKa; @@ -855,7 +855,7 @@ struct kstarInOO { if (lTrueReso.M() < 0) return {}; - if (std::fabs(lTrueReso.Eta()) > cfgTrackMaxEta) + if (std::abs(lTrueReso.Eta()) > cfgTrackMaxEta) return {}; return {lTrueReso}; @@ -1043,7 +1043,7 @@ struct kstarInOO { using JetFilteredJets = soa::Filtered>; int nJetEvents = 0; - void processDataJets(o2::aod::JetCollision const& collision, JetFilteredJets const& chargedjets, JetTrackCandidates const& jetTracks, TrackCandidates const& Tracks) + void processDataJets(o2::aod::JetCollision const& collision, JetFilteredJets const& chargedjets, JetTrackCandidates const& jetTracks, TrackCandidates const&) { if (cDebugLevel > 0) { nJetEvents++; @@ -1051,9 +1051,26 @@ struct kstarInOO { std::cout << "Processed Jet Data Events: " << nJetEvents << std::endl; } } - histos.fill(HIST("nEvents"), 0.5); // Raw event + bool INELgt0 = false; + for (auto& jetTrack : jetTracks){ + if (std::abs(jetTrack.eta()) < cfgEventMaxEta){ + INELgt0 = true; + break; + } + } + if (!INELgt0) + return; + histos.fill(HIST("nEvents"), 1.5); // INEL>0 event + + if (std::abs(collision.posZ()) > cfgEventVtxCut) + return; + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } + histos.fill(HIST("nEvents"), 2.5); // After selection + // Trigger before we start jet finding //===================== //| Trigger @@ -1093,38 +1110,8 @@ struct kstarInOO { return; } } // Trigger cut + histos.fill(HIST("nEvents"), 3.5); // After trigger cut - histos.fill(HIST("nEvents"), 1.5); // After selecting the triggers - - if (std::fabs(collision.posZ()) > cfgEventVtxCut) - return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; - } - - bool INELgt0 = false; - for (auto& jetTrack : jetTracks){ - if (std::fabs(jetTrack.eta()) < cfgTrackMaxEta) // NOT JetTrackEta cut. Just taking the general eta cut for Inclusive - INELgt0 = true; - break; - } - if (!INELgt0) - return; - - histos.fill(HIST("nEvents"), 2.5); // Events for Inclusive - - //test - // for (auto& jetTrack:jetTracks){ - // histos.fill(HIST("jetTrackpT"), jetTrack.pt()); - // } - - // for (auto& track:Tracks){ - // histos.fill(HIST("TrackpT"), track.pt()); - // } - - //test - /* - std::vector jetpT{}; std::vector jetEta{}; std::vector jetPhi{}; @@ -1154,7 +1141,7 @@ struct kstarInOO { if (!HasJets) return; } - histos.fill(HIST("nEvents"), 3.5); // Has jets + histos.fill(HIST("nEvents"), 4.5); // Has jets for (auto& jetTrack : jetTracks) { auto originTrack = jetTrack.track_as(); @@ -1163,14 +1150,12 @@ struct kstarInOO { if (cfgJetQAHistos) { histos.fill(HIST("rawDimpT"), jetTrack.pt(), jetTrack.pt() - originTrack.pt()); - histos.fill(HIST("jetTrackpT"), jetTrack.pt()); histos.fill(HIST("jetTrackEta"), jetTrack.eta()); histos.fill(HIST("jetTrackPhi"), jetTrack.phi()); } } // jetTrack loop - */ - // JetTrackSlicing(collision, jetTracks, chargedjets, false, true); + JetTrackSlicing(collision, jetTracks, chargedjets, false, true); } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1188,29 +1173,30 @@ struct kstarInOO { std::cout << "Processed Jet MC Events: " << nJetMCEvents << std::endl; } } - - histos.fill(HIST("nEvents"), 0.5); // Raw event - - if (std::abs(collision.posZ()) > cfgEventVtxCut) - return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) - return; - if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) - return; - - histos.fill(HIST("nEvents"), 1.5); // After passing the triggers + histos.fill(HIST("nEvents"), 0.5); // Gen event bool INELgt0 = false; for (auto& jetTrack : jetTracks) { - if (std::fabs(jetTrack.eta()) < (cfgTrackMaxEta-cfgJetR)) { + if (std::abs(jetTrack.eta()) < cfgEventMaxEta) { INELgt0 = true; break; } } // jetTrack loop if (!INELgt0) return; + histos.fill(HIST("nEvents"), 1.5); // INEL>0 event - histos.fill(HIST("nEvents"), 2.5); // Events for Inclusive + if (std::abs(collision.posZ()) > cfgEventVtxCut) + return; + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) + return; + histos.fill(HIST("nEvents"), 2.5); // Inclusive event + + // The trigger option doesn't work + // if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) + // return; + // histos.fill(HIST("nEvents"), 3.5); // Events for Inclusive + std::vector mcdjetpT{}; std::vector mcdjetEta{}; @@ -1244,7 +1230,7 @@ struct kstarInOO { return; } } - histos.fill(HIST("nEvents"), 3.5); // Has jets + histos.fill(HIST("nEvents"), 3.5); // Jet event // JetTrackSlicingMC(collision, jetTracks, mcdjets, false, true); @@ -1259,6 +1245,10 @@ struct kstarInOO { lDecayDaughterTest2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); lResonanceTest1 = lDecayDaughterTest1 + lDecayDaughterTest2; + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest0_pT"), lResonanceTest1.Pt()); + } + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; if (cfgJetMCHistos) { @@ -1307,7 +1297,7 @@ struct kstarInOO { } if (cfgJetMCHistos) { - histos.fill(HIST("hMotherPdg1"), std::fabs(mothers1PDG[0])); + histos.fill(HIST("hMotherPdg1"), std::abs(mothers1PDG[0])); } std::vector mothers2{}; std::vector mothers2PDG{}; @@ -1316,7 +1306,7 @@ struct kstarInOO { mothers2PDG.push_back(particle2_mom.pdgCode()); } if (cfgJetMCHistos) { - histos.fill(HIST("hMotherPdg2"), std::fabs(mothers2PDG[0])); + histos.fill(HIST("hMotherPdg2"), std::abs(mothers2PDG[0])); } if (mothers1[0] != mothers2[0]) @@ -1326,21 +1316,21 @@ struct kstarInOO { histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt()); } - if (std::fabs(particle1.pdgCode()) != 321) // kaon + if (std::abs(particle1.pdgCode()) != 321) // kaon continue; if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt()); } - if (std::fabs(particle2.pdgCode()) != 211) // pion + if (std::abs(particle2.pdgCode()) != 211) // pion continue; if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt()); } - if (std::fabs(mothers1PDG[0]) != 313) + if (std::abs(mothers1PDG[0]) != 313) continue; // mother not K*0 if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt()); @@ -1350,7 +1340,7 @@ struct kstarInOO { } } - if (std::fabs(mothers2PDG[0]) != 313) + if (std::abs(mothers2PDG[0]) != 313) continue; // mothers not K*0 if (cfgJetMCHistos) { @@ -1375,26 +1365,30 @@ struct kstarInOO { std::cout << "Processed Data Events: " << nEvents << std::endl; } } - - auto [goodEv, code] = eventSelection(collision, true); histos.fill(HIST("nEvents"), 0.5); - if (!goodEv) - return; - bool INELgt0 = false; for (const auto& track : tracks) { - if (!trackSelection(track, true)) - continue; - if (std::fabs(track.eta()) < cfgTrackMaxEta) { + if (std::abs(track.eta()) < cfgEventMaxEta) { //cfgTrackMaxEta --> cfgEventMaxEta INELgt0 = true; break; } } if (!INELgt0) return; - histos.fill(HIST("nEvents"), 1.5); + histos.fill(HIST("nEvents"), 1.5); + + auto [goodEv, code] = eventSelection(collision, true); + if (!goodEv) + return; + histos.fill(HIST("nEvents"), 2.5); + // for trackQA plot + for (const auto& track : tracks){ + if (!trackSelection(track, true)) + continue; + } + TrackSlicing(collision, tracks, collision, tracks, false, true); } // processSameEvents @@ -1423,9 +1417,9 @@ struct kstarInOO { bool VtxMixFlag = false; bool CentMixFlag = false; // bool OccupanacyMixFlag = false; - if (std::fabs(collision1.posZ() - collision2.posZ()) <= cfgVtxMixCut) // set default to maybe 10 + if (std::abs(collision1.posZ() - collision2.posZ()) <= cfgVtxMixCut) // set default to maybe 10 VtxMixFlag = true; - if (std::fabs(collision1.centFT0C() - collision2.centFT0C()) <= cfgVtxMixCut) // set default to maybe 10 + if (std::abs(collision1.centFT0C() - collision2.centFT0C()) <= cfgVtxMixCut) // set default to maybe 10 CentMixFlag = true; if (!goodEv1 || !goodEv2) @@ -1456,27 +1450,30 @@ struct kstarInOO { std::cout << "process_SameEvent_MC: " << nEventsMC << std::endl; } } - auto [goodEv, code] = eventSelection(collision, true); - histos.fill(HIST("nEvents"), 0.5); - - if (!goodEv) - return; - + bool INELgt0 = false; for (const auto& track : tracks) { - if (!trackSelection(track, true)) - continue; - if (std::fabs(track.eta()) < cfgTrackMaxEta) { + if (std::abs(track.eta()) < cfgEventMaxEta) { INELgt0 = true; break; } } if (!INELgt0) return; - histos.fill(HIST("nEvents"), 1.5); + auto [goodEv, code] = eventSelection(collision, true); //sel8 & vtx + if (!goodEv) + return; + histos.fill(HIST("nEvents"), 2.5); + + // for trackQA plot + for (const auto& track : tracks){ + if (!trackSelection(track, true)) + continue; + } + TrackSlicingMC(collision, tracks, collision, tracks, false, true); } // processSameEvents_MC PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", false); @@ -1523,45 +1520,45 @@ struct kstarInOO { if (nEventsGen % 10000 == 0) { std::cout << "Processed MC (GEN) Events: " << nEventsGen << std::endl; } + } + if (cfgMCHistos) { + histos.fill(HIST("nEvents_Gen"), 0.5); // Gen events } + //======================= //| Event & Signal loss //======================= - bool isTrueINELgt0 = false; + bool INELgt0 = false; for (auto& particle : mcParticles){ - if (std::fabs(particle.eta()) > 1.0) + if (std::abs(particle.eta()) > cfgEventMaxEta) continue; - if (std::fabs(particle.pt()) <= 0.0) + if (particle.pt() <= 0.0) continue; - isTrueINELgt0 = true; + INELgt0 = true; break; } - if (cfgForceTrueINELgt){ - if (!isTrueINELgt0){ + if (!INELgt0){ return; } } if (cfgMCHistos) { - histos.fill(HIST("nEvents_Gen"), 0.5); + histos.fill(HIST("nEvents_Gen"), 1.5); //INEL>0 Gen events & EL: denominator } - if (std::fabs(collision.posZ()) > cfgEventVtxCut) - return; - if (cfgMCHistos) { - histos.fill(HIST("nEvents_Gen"), 1.5); - } + if (std::abs(collision.posZ()) > cfgEventVtxCut) + return; for (auto& particle : mcParticles) { - if (particle.pdgCode() != 313) + if (std::abs(particle.pdgCode()) != 313) continue; - if (std::fabs(particle.eta()) > cfgTrackMaxEta) + if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; if (cfgMCHistos) { - histos.fill(HIST("hGen_pT_Raw"), particle.pt()); /// numerator for SL + histos.fill(HIST("hGen_pT_Kstar"), particle.pt()); // SL: denominator } - } // Unrecon. collision(=Raw coll) for correction + } // Gen colls if (recocolls.size() <= 0) { // not reconstructed if (cfgForceGenReco) { @@ -1573,37 +1570,38 @@ struct kstarInOO { //| Efficiency //================= double centrality = -1; + bool hasGoodEv = false; for (auto& recocoll : recocolls) { // poorly reconstructed - centrality = recocoll.centFT0C(); auto [goodEv, code] = eventSelection(recocoll, true); - if (recocoll.posZ() > cfgEventVtxCut) goodEv = false; - - if (cfgMCHistos) { - histos.fill(HIST("nEvents_Gen"), 2.5); - } if (!goodEv) continue; - } // recocolls (=reconstructed collisions) + + hasGoodEv = true; + centrality = recocoll.centFT0C(); + break; + } // recocolls + if (!hasGoodEv) + return; if (cfgMCHistos){ - histos.fill(HIST("nEvents_Gen"), 3.5); + histos.fill(HIST("nEvents_Gen"), 2.5); // EL: numerator } - + for (auto& particle : mcParticles) { - if (particle.pdgCode() != 313) + if (std::abs(particle.pdgCode()) != 313) continue; // Not K*0 - if (std::fabs(particle.eta()) > cfgTrackMaxEta) + if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; if (particle.pt() < cfgTrackMinPt) continue; if (cfgMCHistos) { - histos.fill(HIST("hGen_pT_GoodEv"), centrality, particle.pt()); // denominator for SL and eff + histos.fill(HIST("hRec_pT_Kstar"), centrality, particle.pt()); // SL: numerator // eff: denominator } } // loop over particles - } // processMCTrue + } // processGen PROCESS_SWITCH(kstarInOO, processGen, "process Generated Particles", false); //============================================== @@ -1612,7 +1610,7 @@ struct kstarInOO { //| //============================================== int nprocessGenEvents = 0; - void processJetsGen(o2::aod::JetMcCollision const& collision, soa::SmallGroups> const& recocolls, aod::JetParticles const& mcParticles) + void processGenJets(o2::aod::JetMcCollision const& collision, soa::SmallGroups> const& recocolls, aod::JetParticles const& mcParticles) { if (cDebugLevel > 0) { ++nprocessGenEvents; @@ -1620,45 +1618,43 @@ struct kstarInOO { std::cout << "Processed MC (GEN) Events: " << nprocessGenEvents << std::endl; } } + if (cfgJetMCHistos) { + histos.fill(HIST("nEvents_Gen"), 0.5); + } //======================= //| Event & Signal loss //======================= - bool isTrueINELgt0 = false; + bool INELgt0 = false; for (auto& particle : mcParticles) { - if (std::fabs(particle.eta()) > 1.0) + if (std::abs(particle.eta()) > cfgEventMaxEta) continue; - if (std::fabs(particle.pt()) <= 0.0) + if (particle.pt() <= 0.0) continue; - isTrueINELgt0 = true; + INELgt0 = true; break; } - if (cfgForceTrueINELgt) { - if (!isTrueINELgt0) { + if (!INELgt0) { return; } } if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 0.5); + histos.fill(HIST("nEvents_Gen"), 1.5); // EL: denominator } - - if (fabs(collision.posZ()) > cfgEventVtxCut) + + if (std::abs(collision.posZ()) > cfgEventVtxCut) return; - if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 1.5); - } - for (auto& particle : mcParticles) { - if (particle.pdgCode() != 313) + if (std::abs(particle.pdgCode()) != 313) continue; - if (std::fabs(particle.eta()) > cfgTrackMaxEta) + if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; if (cfgJetMCHistos) { - histos.fill(HIST("hGen_pT_Raw"), particle.pt()); /// numerator for SL + histos.fill(HIST("hGen_pT_Kstar"), particle.pt()); // SL: denominator } - } // Unrecon. collision(=Raw coll) for correction + } // Unreco. if (recocolls.size() <= 0) { // not reconstructed return; @@ -1671,23 +1667,20 @@ struct kstarInOO { if (goodEv) { goodEv = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); } - if (recocoll.posZ() > cfgEventVtxCut) + if (std::abs(recocoll.posZ()) > cfgEventVtxCut) goodEv = false; - if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 2.5); - } if (!goodEv) return; - } // recocoll + } // reco.coll if (cfgJetMCHistos) { - histos.fill(HIST("nEvents_Gen"), 3.5); + histos.fill(HIST("nEvents_Gen"), 2.5); // EL: numerator } for (auto& particle : mcParticles) { - if (particle.pdgCode() != 313) + if (std::abs(particle.pdgCode()) != 313) continue; - if (std::fabs(particle.eta()) > cfgTrackMaxEta) + if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; if (particle.pt() < cfgTrackMinPt) continue; @@ -1696,12 +1689,12 @@ struct kstarInOO { if (cfg_Force_BR) { bool baddecay = false; for (auto& phidaughter : particle.daughters_as()) { - if (std::fabs(phidaughter.pdgCode()) != 321) { + if (std::abs(phidaughter.pdgCode()) != 321) { baddecay = true; break; } if (cfg_Force_Kaon_Acceptence) { - if (std::fabs(phidaughter.eta()) > cfg_Track_MaxEta) { + if (std::abs(phidaughter.eta()) > cfg_Track_MaxEta) { baddecay = true; break; } @@ -1714,15 +1707,15 @@ struct kstarInOO { */ if (cfgJetMCHistos) { - histos.fill(HIST("hEffGen_pT"), particle.pt()); // denomenator for SL and eff + histos.fill(HIST("hRec_pT_Kstar"), particle.pt()); // SL: numerator and eff: denominator } } // loop over particles } // end of process - PROCESS_SWITCH(kstarInOO, processJetsGen, "Process Generated Particles Inclusive&Jets", false); + PROCESS_SWITCH(kstarInOO, processGenJets, "Process Generated Particles Inclusive&Jets", false); int ndRtest = 0; - void processJetQA(o2::aod::JetMcCollision const& collision, soa::Filtered const& mcpjets, aod::JetParticles const& jetParticles, aod::McParticles const& mcParticles) + void processJetQA(o2::aod::JetMcCollision const& collision, soa::Filtered const& mcpjets, aod::JetParticles const& mcParticles, aod::McParticles const&) { if (cDebugLevel > 0) { ++ndRtest; @@ -1730,190 +1723,205 @@ struct kstarInOO { std::cout << "Processed dR test: " << ndRtest << std::endl; } } - //=========================== - // - // recocolls -- done - // vertex filter - // jetParticles --> mcParticle.eta() cut ? - // INELgt0 - // mcpjet - // - //=========================== - bool isTrueINELgt0 = false; + + bool INELgt0 = false; for (auto& mcpjet : mcpjets) { - if (std::fabs(mcpjet.eta()) > cfgTrackMaxEta) + if (std::abs(mcpjet.eta()) > cfgEventMaxEta) continue; if (mcpjet.pt() <= 0.0) continue; - isTrueINELgt0 = true; - + INELgt0 = true; break; - } // Selection event through particle loop - - if (!isTrueINELgt0) + } // Selection event through mcpjet loop + if (!INELgt0) return; - if (std::fabs(collision.posZ()) > cfgEventVtxCut) + + if (std::abs(collision.posZ()) > cfgEventVtxCut) return; + histos.fill(HIST("nEvents"), 0.5); - // Particle Level - for (const auto& [particle1, particle2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetParticles, jetParticles))) { - - if (std::fabs(particle1.eta()) > cfgTrackMaxEta || std::fabs(particle2.eta()) > cfgTrackMaxEta) - continue; - if (!particle1.has_mothers() || !particle2.has_mothers()) - continue; - - std::vector mothers1{}; - std::vector mothers1PDG{}; - - for (auto& idx1 : particle1.mothersIds()) { - auto mom1 = mcParticles.rawIteratorAt(idx1); - mothers1.push_back(idx1); - mothers1PDG.push_back(mom1.pdgCode()); - } - - std::vector mothers2{}; - std::vector mothers2PDG{}; - - for (auto& idx2 : particle2.mothersIds()) { - auto mom2 = mcParticles.rawIteratorAt(idx2); - mothers2.push_back(idx2); - mothers2PDG.push_back(mom2.pdgCode()); - } - - if (mothers1PDG[0] != 333 || mothers2PDG[0] != 333) // 313 is kstar0, 333 is phi(1020) - continue; - - if (mothers1[0] != mothers2[0]) - continue; - //kstar - // if ((std::fabs(particle1.pdgCode()) != 211) && (std::fabs(particle1.pdgCode()) != 321)) //211 is pion - // continue; - // if ((std::fabs(particle2.pdgCode()) != 211) && (std::fabs(particle2.pdgCode()) != 321)) - // continue; - - //phi meson - if ((std::fabs(particle1.pdgCode()) != 321) && (std::fabs(particle2.pdgCode()) != 321)) //321 is kaon - continue; - - //kstar - // double track1_mass, track2_mass; - // if (std::fabs(particle1.pdgCode()) == 211) { - // track1_mass = massPi; - // } else { - // track1_mass = massKa; - // } - - // if (std::fabs(particle2.pdgCode()) == 211) { - // track2_mass = massPi; - // } else { - // track2_mass = massKa; - // } - - // if (track1_mass == track2_mass) - // continue; - - histos.fill(HIST("particle1_pdg"), particle1.pdgCode()); // kaon - histos.fill(HIST("particle2_pdg"), particle2.pdgCode()); // pion - - // bool passPtCut = (particle1.pt() > 0.5 && particle2.pt() > 0.5); - - ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso; - // lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), track1_mass); // kaon - // lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), track2_mass); // pion - lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), massKa); // kaon - lTrueDaughter2 = ROOT::Math::PxPyPzMVector(particle2.px(), particle2.py(), particle2.pz(), massKa); // kaon - lTrueReso = lTrueDaughter1 + lTrueDaughter2; - - if (lTrueReso.M() < 0) - continue; - if (std::fabs(lTrueReso.Eta()) > cfgTrackMaxEta) - continue; - - double dphi = TVector2::Phi_mpi_pi(particle1.phi() - particle2.phi()); - double deta = particle1.eta() - particle2.eta(); - double dR = TMath::Sqrt((dphi * dphi) + (deta * deta)); - bool INELgt0 = false; - for (auto const& jet : mcpjets) { - - // if (jet.pt() < cfgJetpT) - // continue; - // if (jet.pt() < 6.0) // jetpT cut 6 GeV/c minimum //test - // continue; - if (std::fabs(jet.eta()) < (cfgTrackMaxEta-cfgJetR)) // cfgJetTrackMaxEta - INELgt0 = true; - if (!INELgt0) - continue; - - // kaon and pion - double dphi_jet_pion = TVector2::Phi_mpi_pi(jet.phi() - particle2.phi()); - double deta_jet_pion = jet.eta() - particle2.eta(); - double dR_jet_pion = TMath::Sqrt((deta_jet_pion * deta_jet_pion) + (dphi_jet_pion * dphi_jet_pion)); - - double dphi_jet_kaon = TVector2::Phi_mpi_pi(jet.phi() - particle1.phi()); - double deta_jet_kaon = jet.eta() - particle1.eta(); - double dR_jet_kaon = TMath::Sqrt((deta_jet_kaon * deta_jet_kaon) + (dphi_jet_kaon * dphi_jet_kaon)); - - double dphi_kstar_jet = TVector2::Phi_mpi_pi(jet.phi() - lTrueReso.Phi()); - double deta_kstar_jet = jet.eta() - lTrueReso.Eta(); - double dR_kstar_jet = TMath::Sqrt((dphi_kstar_jet * dphi_kstar_jet) + (deta_kstar_jet * deta_kstar_jet)); + + for (auto& mcParticle : mcParticles){ + if (std::abs(mcParticle.eta()) > cfgTrackMaxEta) + continue; + if (!mcParticle.has_daughters()) + continue; - bool kaon_out = (dR_jet_kaon > cfgJetR); - bool pion_out = (dR_jet_pion > cfgJetR); + ROOT::Math::PxPyPzEVector lResonance; + lResonance = ROOT::Math::PxPyPzEVector(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); + + int GenPID = 0; + if (!cfgIsKstar) + GenPID = 333; + else + GenPID = 313; + + if (std::abs(mcParticle.pdgCode()) != GenPID) + continue; + + if (cfgJetdRHistos){ + histos.fill(HIST("Gen_particle_All_BR"), mcParticle.pt()); + } + + bool skip = false; + int daughter_kaon = 0; + int daughter_pion = 0; + if (!cfgIsKstar){ + for (auto& daughter : mcParticle.daughters_as()){ + if (std::abs(daughter.pdgCode()) != 321) + skip = true; + } + } //phi(1020) + else{ + for (auto& daughter : mcParticle.daughters_as()){ + if (std::abs(daughter.pdgCode()) == 321) + ++daughter_kaon; + else if (std::abs(daughter.pdgCode()) == 211) + ++daughter_pion; + } + if (daughter_kaon != 1 || daughter_pion != 1) + skip = true; + } //K*(892) + + if (skip && cfgBR) + continue; - double missing_pion_pt = 0; - double missing_kaon_pt = 0; + if (cfgJetdRHistos){ + histos.fill(HIST("Gen_particle_BR"), lResonance.M()); + histos.fill(HIST("Gen_particle_pT"), mcParticle.pt()); + } + + //================== + // Distinguish Jets + double bestR = 999; + double bestJetpT = 0; + double bestJetPhi = 0; + double bestJetEta = 0; + for (auto& mcpjet : mcpjets){ + if (mcpjet.pt() < cfgJetpT) + continue; + + if (cfgJetdRHistos){ + histos.fill(HIST("mcpjet_eta"), mcpjet.eta()); + histos.fill(HIST("mcpjet_phi"), mcpjet.phi()); + histos.fill(HIST("mcpjet_pt"), mcpjet.pt()); + } + + double dphi = TVector2::Phi_mpi_pi(mcpjet.phi() - lResonance.Phi()); + double deta = mcpjet.eta() - lResonance.Eta(); + double R = TMath::Sqrt((dphi*dphi) + (deta*deta)); + if (R < bestR){ + bestR = R; + bestJetpT = mcpjet.pt(); + bestJetPhi = mcpjet.phi(); + bestJetEta = mcpjet.eta(); + } + }// mcpJets + if (bestR > cfgJetR) + continue; - if (dR_kstar_jet > cfgJetR) - continue; + //================== + // daughters + double missing_pt = 0; + double dR_kaon, dR_pion; + bool kaon_out = false; + bool pion_out = false; + for (auto& daughter : mcParticle.daughters_as()){ + if (cfgIsKstar){ + if (std::abs(daughter.pdgCode()) == 321){ + + double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); + double deta_kaon = bestJetEta - daughter.eta(); + dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon)+(deta_kaon * deta_kaon)); + + if (bestR < cfgJetR){ + if (cfgJetdRHistos){ + histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + } + if (dR_kaon > cfgJetR){ + kaon_out = true; + missing_pt += daughter.pt(); + } + } //INSIDE Jets + } // kaon daughter + if (std::abs(daughter.pdgCode()) == 211){ + + double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); + double deta_pion = bestJetEta - daughter.eta(); + dR_pion = TMath::Sqrt((dphi_pion * dphi_pion)+(deta_pion * deta_pion)); + + if (bestR < cfgJetR){ + if (cfgJetdRHistos){ + histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); + + if (bestJetpT > 6.0 && bestJetpT < 8.0) + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); + } + if (dR_pion > cfgJetR){ + pion_out = true; + missing_pt += daughter.pt(); + } + } //INSIDE Jets + } // pion daughter + } //K*(892)0 + else { + if (std::abs(daughter.pdgCode()) == 321){ + double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); + double deta_kaon = bestJetEta - daughter.eta(); + dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon)+(deta_kaon * deta_kaon)); + + if (bestR < cfgJetR){ + if (cfgJetdRHistos){ + histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + + if (bestJetpT > 6.0 && bestJetpT < 8.0) + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); + } + + if(dR_kaon > cfgJetR){ + kaon_out = true; + missing_pt = daughter.pt(); + } + } + } // kaon daughter + } //phi(1020) + } //daughter + + if (kaon_out || pion_out){ + double recoveredJetpT = bestJetpT + missing_pt; + if (cfgJetdRHistos){ + if (bestJetpT > 6.0 && bestJetpT < 8.0){ + histos.fill(HIST("missed_kpi_INJets_6_8"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + if (recoveredJetpT > 8.0) + histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT); - if (cfgJetQAHistos) { - // without cut - histos.fill(HIST("dR_kaon_pion"), dR, lTrueReso.Pt()); - histos.fill(HIST("kstar_pT"), dR_kstar_jet, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_kaon"), dR_jet_kaon, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_pion"), dR_jet_pion, lTrueReso.Pt()); - - histos.fill(HIST("dR_taggedjet_all"), dR_jet_kaon, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_jet_pion, lTrueReso.Pt()); - - if (jet.pt() > 8.0){ - histos.fill(HIST("dR_taggedjet_all_8cut"), dR_jet_kaon, lTrueReso.Pt()); - histos.fill(HIST("dR_taggedjet_all_8cut"), dR_jet_pion, lTrueReso.Pt()); } - - if (kaon_out){ - missing_kaon_pt+=lTrueDaughter1.Pt(); //kaon - histos.fill(HIST("missed_kaon_INJets"), (jet.pt() - missing_kaon_pt)/jet.pt(), lTrueReso.Pt()); - } - if (pion_out){ - missing_pion_pt+=lTrueDaughter2.Pt(); //pion - histos.fill(HIST("missed_pion_INJets"), (jet.pt() - missing_pion_pt)/jet.pt(), lTrueReso.Pt()); - } - if (kaon_out || pion_out){ // missing kaon + missing pion + both - if (jet.pt() > 6.0 && jet.pt() < 8.0) - histos.fill(HIST("missed_kpi_INJets_6_8"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - if (jet.pt() > 8.0 && jet.pt() < 10.0) - histos.fill(HIST("missed_kpi_INJets_8_10"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - if (jet.pt() > 10.0 && jet.pt() < 12.0) - histos.fill(HIST("missed_kpi_INJets_10_12"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - if (jet.pt() > 12.0 && jet.pt() < 15.0) - histos.fill(HIST("missed_kpi_INJets_12_15"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - if (jet.pt() > 15.0 && jet.pt() < 25.0) - histos.fill(HIST("missed_kpi_INJets_15_25"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - if (jet.pt() > 25.0) - histos.fill(HIST("missed_kpi_INJets_25_infinite"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - - if (jet.pt() > 8.0) - histos.fill(HIST("missed_kpi_INJets_8_infinite"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()); - - // histos.fill(HIST("missed_kpi_INJets_fraction"), (jet.pt() - (missing_pion_pt+missing_kaon_pt))/jet.pt(), lTrueReso.Pt()/jet.pt()); - } - - } // cfgJetQAHistos - } // mcpjets - } // particle Loop + if (bestJetpT > 8.0 && bestJetpT < 10.0) + histos.fill(HIST("missed_kpi_INJets_8_10"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + if (bestJetpT > 10.0 && bestJetpT < 12.0) + histos.fill(HIST("missed_kpi_INJets_10_12"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + if (bestJetpT > 12.0 && bestJetpT < 15.0) + histos.fill(HIST("missed_kpi_INJets_12_15"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + if (bestJetpT > 15.0 && bestJetpT < 25.0) + histos.fill(HIST("missed_kpi_INJets_15_25"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + if (bestJetpT > 25.0) + histos.fill(HIST("missed_kpi_INJets_25_infinite"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + + if (bestJetpT > 8.0) + histos.fill(HIST("missed_kpi_INJets_8_infinite"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); + + + histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); + + + } //cfgJetdRHistos + } // kaon_out || pion_out + }// mcParticles }; + PROCESS_SWITCH(kstarInOO, processJetQA, "Process dR of K*0 Inclusive and Inside jet", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 4a4ccba49119adcfb02f0f0d32e735971d763b75 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 13:09:39 +0900 Subject: [PATCH 04/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 457 +++++++++++++-------------- 1 file changed, 225 insertions(+), 232 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 18f9958ab92..e84f2892514 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -21,19 +21,17 @@ #include "CommonConstants/PhysicsConstants.h" #include "DataFormatsParameters/GRPObject.h" - #include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "ReconstructionDataFormats/Track.h" - -#include "Framework/ASoAHelpers.h" #include "Framework/Configurable.h" +#include "Framework/HistogramRegistry.h" #include "Framework/HistogramSpec.h" #include "Framework/InitContext.h" #include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" // jet #include "PWGJE/Core/JetDerivedDataUtilities.h" @@ -195,19 +193,19 @@ struct kstarInOO { std::shared_ptr hCutFlow = histos.get(HIST("hEvent_Cut")); std::vector eventCutLabels = { - "All Events", - "sel8", - Form("|Vz| < %.1f", cfgEventVtxCut.value), - "kIsGoodZvtxFT0vsPV", - "kNoSameBunchPileup", - "kNoTimeFrameBorder", - "kNoITSROFrameBorder", - "kNoCollInTimeRangeStandard", - "kIsGoodITSLayersAll", - Form("Occupancy < %.0f", cfgOccupancyMax.value), - "All passed events"}; + "All Events", + "sel8", + Form("|Vz| < %.1f", cfgEventVtxCut.value), + "kIsGoodZvtxFT0vsPV", + "kNoSameBunchPileup", + "kNoTimeFrameBorder", + "kNoITSROFrameBorder", + "kNoCollInTimeRangeStandard", + "kIsGoodITSLayersAll", + Form("Occupancy < %.0f", cfgOccupancyMax.value), + "All passed events"}; for (size_t i = 0; i < eventCutLabels.size(); ++i) { - hCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str()); + hCutFlow->GetXaxis()->SetBinLabel(i + 1, eventCutLabels[i].c_str()); } } if (cfgTrackCutQA) { @@ -256,7 +254,7 @@ struct kstarInOO { histos.add("nGoodJets", "The number of good jets", kTH1F, {{6, -0.5, 5.5}}); histos.add("nJetsPerEvent", "The number of jet per event", kTH1F, {{6, -0.5, 5.5}}); - + histos.add("rawDimpT", "rawDimpT", kTH2F, {{1000, 0.0, 10.0}, {100, -0.5, 0.5}}); histos.add("jetTrackEta", "Jet Track Eta", kTH1F, {{100, -1.0, 1.0}}); @@ -270,7 +268,7 @@ struct kstarInOO { histos.add("Gen_particle_All_BR", "Generated particle All pT (GeV/c)", kTH1F, {{2000, 0., 100.}}); histos.add("Gen_particle_BR", "Gen_particle_BR", kTH1F, {minvAxis}); histos.add("Gen_particle_pT", "Generated particle pT (GeV/c)", kTH1F, {{2000, 0., 100.}}); - + histos.add("dR_taggedjet_kaon", "dR between tagged jet and kaon wo pT cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); histos.add("dR_taggedjet_pion", "dR between tagged jet and pion wo pT cut", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); histos.add("dR_taggedjet_all", "dR between tagged jet and kpi", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); @@ -285,10 +283,10 @@ struct kstarInOO { histos.add("missed_kpi_INJets_8_infinite", "missed kpi In Jets with 8 < jetPt < infinite", {HistType::kTH2F, {{120, 0.0, 1.2}, {100, 0., 20.}}}); histos.add("recoveredJetpT_6_8to8_10", "recovered Jet pT", kTH1F, {{2000, 0., 100.}}); - + histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{100, 0.0, 50.0, "True jet pT (GeV/c)"}, {100, 0., 50., "Recovered jet pT (GeV/c)"}}}); } - + //////////////////////////////////// histos.add("nEvents", "nEvents", kTH1F, {{7, 0.0, 7.0}}); histos.add("hUSS_KPi", "hUSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); @@ -362,9 +360,9 @@ struct kstarInOO { Filter JEPosZFilter = nabs(aod::jcollision::posZ) < cfgEventVtxCut; Filter JEMCPosZFilter = nabs(aod::jmccollision::posZ) < cfgEventVtxCut; Filter JetCuts = aod::jet::pt > cfgJetpT&& aod::jet::r == nround(cfgJetR.node() * 100.0f); - + using JetTrackCandidatesMC = soa::Join; - + // For Mixed Event using BinningType = ColumnBinningPolicy; @@ -1041,7 +1039,7 @@ struct kstarInOO { //======================================================= using JetTrackCandidates = soa::Join; using JetFilteredJets = soa::Filtered>; - + int nJetEvents = 0; void processDataJets(o2::aod::JetCollision const& collision, JetFilteredJets const& chargedjets, JetTrackCandidates const& jetTracks, TrackCandidates const&) { @@ -1054,10 +1052,10 @@ struct kstarInOO { histos.fill(HIST("nEvents"), 0.5); // Raw event bool INELgt0 = false; - for (auto& jetTrack : jetTracks){ - if (std::abs(jetTrack.eta()) < cfgEventMaxEta){ - INELgt0 = true; - break; + for (auto& jetTrack : jetTracks) { + if (std::abs(jetTrack.eta()) < cfgEventMaxEta) { + INELgt0 = true; + break; } } if (!INELgt0) @@ -1154,7 +1152,7 @@ struct kstarInOO { histos.fill(HIST("jetTrackPhi"), jetTrack.phi()); } } // jetTrack loop - + JetTrackSlicing(collision, jetTracks, chargedjets, false, true); } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1196,7 +1194,6 @@ struct kstarInOO { // if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) // return; // histos.fill(HIST("nEvents"), 3.5); // Events for Inclusive - std::vector mcdjetpT{}; std::vector mcdjetEta{}; @@ -1245,10 +1242,10 @@ struct kstarInOO { lDecayDaughterTest2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); lResonanceTest1 = lDecayDaughterTest1 + lDecayDaughterTest2; - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest0_pT"), lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest0_pT"), lResonanceTest1.Pt()); } - + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; if (cfgJetMCHistos) { @@ -1369,26 +1366,26 @@ struct kstarInOO { bool INELgt0 = false; for (const auto& track : tracks) { - if (std::abs(track.eta()) < cfgEventMaxEta) { //cfgTrackMaxEta --> cfgEventMaxEta + if (std::abs(track.eta()) < cfgEventMaxEta) { // cfgTrackMaxEta --> cfgEventMaxEta INELgt0 = true; - break; + break; } } if (!INELgt0) return; - histos.fill(HIST("nEvents"), 1.5); - + histos.fill(HIST("nEvents"), 1.5); + auto [goodEv, code] = eventSelection(collision, true); if (!goodEv) return; - histos.fill(HIST("nEvents"), 2.5); + histos.fill(HIST("nEvents"), 2.5); - // for trackQA plot - for (const auto& track : tracks){ + // for trackQA plot + for (const auto& track : tracks) { if (!trackSelection(track, true)) - continue; + continue; } - + TrackSlicing(collision, tracks, collision, tracks, false, true); } // processSameEvents @@ -1451,27 +1448,27 @@ struct kstarInOO { } } histos.fill(HIST("nEvents"), 0.5); - + bool INELgt0 = false; for (const auto& track : tracks) { if (std::abs(track.eta()) < cfgEventMaxEta) { INELgt0 = true; - break; + break; } } if (!INELgt0) return; histos.fill(HIST("nEvents"), 1.5); - auto [goodEv, code] = eventSelection(collision, true); //sel8 & vtx + auto [goodEv, code] = eventSelection(collision, true); // sel8 & vtx if (!goodEv) return; histos.fill(HIST("nEvents"), 2.5); - // for trackQA plot - for (const auto& track : tracks){ + // for trackQA plot + for (const auto& track : tracks) { if (!trackSelection(track, true)) - continue; + continue; } TrackSlicingMC(collision, tracks, collision, tracks, false, true); @@ -1520,7 +1517,7 @@ struct kstarInOO { if (nEventsGen % 10000 == 0) { std::cout << "Processed MC (GEN) Events: " << nEventsGen << std::endl; } - } + } if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); // Gen events } @@ -1529,25 +1526,25 @@ struct kstarInOO { //| Event & Signal loss //======================= bool INELgt0 = false; - for (auto& particle : mcParticles){ + for (auto& particle : mcParticles) { if (std::abs(particle.eta()) > cfgEventMaxEta) - continue; + continue; if (particle.pt() <= 0.0) - continue; + continue; INELgt0 = true; break; } - if (cfgForceTrueINELgt){ - if (!INELgt0){ - return; + if (cfgForceTrueINELgt) { + if (!INELgt0) { + return; } } if (cfgMCHistos) { - histos.fill(HIST("nEvents_Gen"), 1.5); //INEL>0 Gen events & EL: denominator + histos.fill(HIST("nEvents_Gen"), 1.5); // INEL>0 Gen events & EL: denominator } if (std::abs(collision.posZ()) > cfgEventVtxCut) - return; + return; for (auto& particle : mcParticles) { if (std::abs(particle.pdgCode()) != 313) @@ -1574,7 +1571,7 @@ struct kstarInOO { for (auto& recocoll : recocolls) { // poorly reconstructed auto [goodEv, code] = eventSelection(recocoll, true); if (recocoll.posZ() > cfgEventVtxCut) - goodEv = false; + goodEv = false; if (!goodEv) continue; @@ -1584,22 +1581,22 @@ struct kstarInOO { } // recocolls if (!hasGoodEv) return; - if (cfgMCHistos){ + if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 2.5); // EL: numerator } - + for (auto& particle : mcParticles) { if (std::abs(particle.pdgCode()) != 313) continue; // Not K*0 if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; if (particle.pt() < cfgTrackMinPt) - continue; + continue; if (cfgMCHistos) { - histos.fill(HIST("hRec_pT_Kstar"), centrality, particle.pt()); // SL: numerator // eff: denominator + histos.fill(HIST("hRec_pT_Kstar"), centrality, particle.pt()); // SL: numerator // eff: denominator } - + } // loop over particles } // processGen PROCESS_SWITCH(kstarInOO, processGen, "process Generated Particles", false); @@ -1641,7 +1638,7 @@ struct kstarInOO { if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 1.5); // EL: denominator } - + if (std::abs(collision.posZ()) > cfgEventVtxCut) return; @@ -1686,24 +1683,24 @@ struct kstarInOO { continue; /* // Not Yet - if (cfg_Force_BR) { - bool baddecay = false; - for (auto& phidaughter : particle.daughters_as()) { - if (std::abs(phidaughter.pdgCode()) != 321) { - baddecay = true; - break; - } - if (cfg_Force_Kaon_Acceptence) { - if (std::abs(phidaughter.eta()) > cfg_Track_MaxEta) { - baddecay = true; - break; - } - } - } // loop over daughters - - if (baddecay) - continue; - } // enforce BR restriction + if (cfg_Force_BR) { + bool baddecay = false; + for (auto& phidaughter : particle.daughters_as()) { + if (std::abs(phidaughter.pdgCode()) != 321) { + baddecay = true; + break; + } + if (cfg_Force_Kaon_Acceptence) { + if (std::abs(phidaughter.eta()) > cfg_Track_MaxEta) { + baddecay = true; + break; + } + } + } // loop over daughters + + if (baddecay) + continue; + } // enforce BR restriction */ if (cfgJetMCHistos) { @@ -1723,7 +1720,7 @@ struct kstarInOO { std::cout << "Processed dR test: " << ndRtest << std::endl; } } - + bool INELgt0 = false; for (auto& mcpjet : mcpjets) { if (std::abs(mcpjet.eta()) > cfgEventMaxEta) @@ -1735,60 +1732,59 @@ struct kstarInOO { } // Selection event through mcpjet loop if (!INELgt0) return; - + if (std::abs(collision.posZ()) > cfgEventVtxCut) return; histos.fill(HIST("nEvents"), 0.5); - - for (auto& mcParticle : mcParticles){ + for (auto& mcParticle : mcParticles) { if (std::abs(mcParticle.eta()) > cfgTrackMaxEta) - continue; + continue; if (!mcParticle.has_daughters()) - continue; + continue; ROOT::Math::PxPyPzEVector lResonance; lResonance = ROOT::Math::PxPyPzEVector(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); - + int GenPID = 0; if (!cfgIsKstar) - GenPID = 333; + GenPID = 333; else - GenPID = 313; - + GenPID = 313; + if (std::abs(mcParticle.pdgCode()) != GenPID) - continue; - - if (cfgJetdRHistos){ - histos.fill(HIST("Gen_particle_All_BR"), mcParticle.pt()); + continue; + + if (cfgJetdRHistos) { + histos.fill(HIST("Gen_particle_All_BR"), mcParticle.pt()); } bool skip = false; int daughter_kaon = 0; int daughter_pion = 0; - if (!cfgIsKstar){ - for (auto& daughter : mcParticle.daughters_as()){ - if (std::abs(daughter.pdgCode()) != 321) - skip = true; - } - } //phi(1020) - else{ - for (auto& daughter : mcParticle.daughters_as()){ - if (std::abs(daughter.pdgCode()) == 321) - ++daughter_kaon; - else if (std::abs(daughter.pdgCode()) == 211) - ++daughter_pion; - } - if (daughter_kaon != 1 || daughter_pion != 1) - skip = true; - } //K*(892) - + if (!cfgIsKstar) { + for (auto& daughter : mcParticle.daughters_as()) { + if (std::abs(daughter.pdgCode()) != 321) + skip = true; + } + } // phi(1020) + else { + for (auto& daughter : mcParticle.daughters_as()) { + if (std::abs(daughter.pdgCode()) == 321) + ++daughter_kaon; + else if (std::abs(daughter.pdgCode()) == 211) + ++daughter_pion; + } + if (daughter_kaon != 1 || daughter_pion != 1) + skip = true; + } // K*(892) + if (skip && cfgBR) - continue; + continue; - if (cfgJetdRHistos){ - histos.fill(HIST("Gen_particle_BR"), lResonance.M()); - histos.fill(HIST("Gen_particle_pT"), mcParticle.pt()); + if (cfgJetdRHistos) { + histos.fill(HIST("Gen_particle_BR"), lResonance.M()); + histos.fill(HIST("Gen_particle_pT"), mcParticle.pt()); } //================== @@ -1797,28 +1793,28 @@ struct kstarInOO { double bestJetpT = 0; double bestJetPhi = 0; double bestJetEta = 0; - for (auto& mcpjet : mcpjets){ - if (mcpjet.pt() < cfgJetpT) - continue; - - if (cfgJetdRHistos){ - histos.fill(HIST("mcpjet_eta"), mcpjet.eta()); - histos.fill(HIST("mcpjet_phi"), mcpjet.phi()); - histos.fill(HIST("mcpjet_pt"), mcpjet.pt()); - } - - double dphi = TVector2::Phi_mpi_pi(mcpjet.phi() - lResonance.Phi()); - double deta = mcpjet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((dphi*dphi) + (deta*deta)); - if (R < bestR){ - bestR = R; - bestJetpT = mcpjet.pt(); - bestJetPhi = mcpjet.phi(); - bestJetEta = mcpjet.eta(); - } - }// mcpJets + for (auto& mcpjet : mcpjets) { + if (mcpjet.pt() < cfgJetpT) + continue; + + if (cfgJetdRHistos) { + histos.fill(HIST("mcpjet_eta"), mcpjet.eta()); + histos.fill(HIST("mcpjet_phi"), mcpjet.phi()); + histos.fill(HIST("mcpjet_pt"), mcpjet.pt()); + } + + double dphi = TVector2::Phi_mpi_pi(mcpjet.phi() - lResonance.Phi()); + double deta = mcpjet.eta() - lResonance.Eta(); + double R = TMath::Sqrt((dphi * dphi) + (deta * deta)); + if (R < bestR) { + bestR = R; + bestJetpT = mcpjet.pt(); + bestJetPhi = mcpjet.phi(); + bestJetEta = mcpjet.eta(); + } + } // mcpJets if (bestR > cfgJetR) - continue; + continue; //================== // daughters @@ -1826,100 +1822,97 @@ struct kstarInOO { double dR_kaon, dR_pion; bool kaon_out = false; bool pion_out = false; - for (auto& daughter : mcParticle.daughters_as()){ - if (cfgIsKstar){ - if (std::abs(daughter.pdgCode()) == 321){ - - double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); - double deta_kaon = bestJetEta - daughter.eta(); - dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon)+(deta_kaon * deta_kaon)); - - if (bestR < cfgJetR){ - if (cfgJetdRHistos){ - histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); - } - if (dR_kaon > cfgJetR){ - kaon_out = true; - missing_pt += daughter.pt(); - } - } //INSIDE Jets - } // kaon daughter - if (std::abs(daughter.pdgCode()) == 211){ - - double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); - double deta_pion = bestJetEta - daughter.eta(); - dR_pion = TMath::Sqrt((dphi_pion * dphi_pion)+(deta_pion * deta_pion)); - - if (bestR < cfgJetR){ - if (cfgJetdRHistos){ - histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); - - if (bestJetpT > 6.0 && bestJetpT < 8.0) - histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); - } - if (dR_pion > cfgJetR){ - pion_out = true; - missing_pt += daughter.pt(); - } - } //INSIDE Jets - } // pion daughter - } //K*(892)0 - else { - if (std::abs(daughter.pdgCode()) == 321){ - double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); - double deta_kaon = bestJetEta - daughter.eta(); - dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon)+(deta_kaon * deta_kaon)); - - if (bestR < cfgJetR){ - if (cfgJetdRHistos){ - histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); - - if (bestJetpT > 6.0 && bestJetpT < 8.0) - histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); - } - - if(dR_kaon > cfgJetR){ - kaon_out = true; - missing_pt = daughter.pt(); - } - } - } // kaon daughter - } //phi(1020) - } //daughter - - if (kaon_out || pion_out){ - double recoveredJetpT = bestJetpT + missing_pt; - if (cfgJetdRHistos){ - if (bestJetpT > 6.0 && bestJetpT < 8.0){ - histos.fill(HIST("missed_kpi_INJets_6_8"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - if (recoveredJetpT > 8.0) - histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT); - - } - if (bestJetpT > 8.0 && bestJetpT < 10.0) - histos.fill(HIST("missed_kpi_INJets_8_10"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - if (bestJetpT > 10.0 && bestJetpT < 12.0) - histos.fill(HIST("missed_kpi_INJets_10_12"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - if (bestJetpT > 12.0 && bestJetpT < 15.0) - histos.fill(HIST("missed_kpi_INJets_12_15"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - if (bestJetpT > 15.0 && bestJetpT < 25.0) - histos.fill(HIST("missed_kpi_INJets_15_25"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - if (bestJetpT > 25.0) - histos.fill(HIST("missed_kpi_INJets_25_infinite"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - - if (bestJetpT > 8.0) - histos.fill(HIST("missed_kpi_INJets_8_infinite"),(bestJetpT - missing_pt)/bestJetpT, lResonance.Pt()); - - - histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); - - - } //cfgJetdRHistos - } // kaon_out || pion_out - }// mcParticles + for (auto& daughter : mcParticle.daughters_as()) { + if (cfgIsKstar) { + if (std::abs(daughter.pdgCode()) == 321) { + + double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); + double deta_kaon = bestJetEta - daughter.eta(); + dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); + + if (bestR < cfgJetR) { + if (cfgJetdRHistos) { + histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + } + if (dR_kaon > cfgJetR) { + kaon_out = true; + missing_pt += daughter.pt(); + } + } // INSIDE Jets + } // kaon daughter + if (std::abs(daughter.pdgCode()) == 211) { + + double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); + double deta_pion = bestJetEta - daughter.eta(); + dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion)); + + if (bestR < cfgJetR) { + if (cfgJetdRHistos) { + histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); + + if (bestJetpT > 6.0 && bestJetpT < 8.0) + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); + } + if (dR_pion > cfgJetR) { + pion_out = true; + missing_pt += daughter.pt(); + } + } // INSIDE Jets + } // pion daughter + } // K*(892)0 + else { + if (std::abs(daughter.pdgCode()) == 321) { + double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); + double deta_kaon = bestJetEta - daughter.eta(); + dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); + + if (bestR < cfgJetR) { + if (cfgJetdRHistos) { + histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + + if (bestJetpT > 6.0 && bestJetpT < 8.0) + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); + } + + if (dR_kaon > cfgJetR) { + kaon_out = true; + missing_pt = daughter.pt(); + } + } + } // kaon daughter + } // phi(1020) + } // daughter + + if (kaon_out || pion_out) { + double recoveredJetpT = bestJetpT + missing_pt; + if (cfgJetdRHistos) { + if (bestJetpT > 6.0 && bestJetpT < 8.0) { + histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + if (recoveredJetpT > 8.0) + histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT); + } + if (bestJetpT > 8.0 && bestJetpT < 10.0) + histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + if (bestJetpT > 10.0 && bestJetpT < 12.0) + histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + if (bestJetpT > 12.0 && bestJetpT < 15.0) + histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + if (bestJetpT > 15.0 && bestJetpT < 25.0) + histos.fill(HIST("missed_kpi_INJets_15_25"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + if (bestJetpT > 25.0) + histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + + if (bestJetpT > 8.0) + histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + + histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); + + } // cfgJetdRHistos + } // kaon_out || pion_out + } // mcParticles }; PROCESS_SWITCH(kstarInOO, processJetQA, "Process dR of K*0 Inclusive and Inside jet", false); From 7f7d45b461d84a12c59bf53b44905f7c6f5eb025 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 13:18:41 +0900 Subject: [PATCH 05/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index e84f2892514..8ebd3b9f48c 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1909,7 +1909,6 @@ struct kstarInOO { histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); - } // cfgJetdRHistos } // kaon_out || pion_out } // mcParticles From 8cdd3512c8869d8956643cd9882dcf47e98d885b Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 13:24:02 +0900 Subject: [PATCH 06/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 8ebd3b9f48c..68538cb6199 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -35,7 +35,7 @@ // jet #include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/EMCALClusters.h" +// #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetReducedData.h" #include "PWGJE/DataModel/TrackJetQa.h" From 181ff1ef14f599ab999d1736e6c362c6bfa6faed Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 13:31:49 +0900 Subject: [PATCH 07/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 68538cb6199..07192ed4fd6 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -34,8 +34,8 @@ #include "ReconstructionDataFormats/Track.h" // jet -#include "PWGJE/Core/JetDerivedDataUtilities.h" -// #include "PWGJE/DataModel/EMCALClusters.h" +#include +#include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetReducedData.h" #include "PWGJE/DataModel/TrackJetQa.h" From defb0d02df06da807bfa09e43cff428a14ba9622 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 13:34:03 +0900 Subject: [PATCH 08/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 07192ed4fd6..585348af0f4 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -34,11 +34,11 @@ #include "ReconstructionDataFormats/Track.h" // jet +#include +#include +#include +#include #include -#include "PWGJE/DataModel/EMCALClusters.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/JetReducedData.h" -#include "PWGJE/DataModel/TrackJetQa.h" #include From 980a8c9497f592ff323eddcb3957efe35fb0272b Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 22 Jun 2026 14:04:56 +0900 Subject: [PATCH 09/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 55 +++++++++++++--------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 585348af0f4..aef9c88c4c4 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -12,6 +12,11 @@ /// \brief the pT spectra of k*0(892) resonance analysis in OO collisions /// \author Jimun Lee +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/JetReducedData.h" + +#include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -19,39 +24,28 @@ #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CommonConstants/PhysicsConstants.h" -#include "DataFormatsParameters/GRPObject.h" -#include "Framework/ASoA.h" -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/Configurable.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/HistogramSpec.h" -#include "Framework/InitContext.h" -#include "Framework/OutputObjHeader.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" - -// jet -#include -#include -#include -#include -#include - -#include - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h) +#include +#include #include -#include -#include +#include #include -#include - -#include -#include #include #include #include @@ -62,6 +56,7 @@ #include #include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; From 0d483e97dd6d9b351d4b651e9e74db3812f0687f Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 23 Jun 2026 09:37:51 +0900 Subject: [PATCH 10/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index aef9c88c4c4..cfd4f4204d1 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1763,7 +1763,7 @@ struct kstarInOO { skip = true; } } // phi(1020) - else { + else{ for (auto& daughter : mcParticle.daughters_as()) { if (std::abs(daughter.pdgCode()) == 321) ++daughter_kaon; @@ -1857,7 +1857,7 @@ struct kstarInOO { } // INSIDE Jets } // pion daughter } // K*(892)0 - else { + else{ if (std::abs(daughter.pdgCode()) == 321) { double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); double deta_kaon = bestJetEta - daughter.eta(); From 2f8682c52534674d18201c2f0fde19b406c4eda3 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 23 Jun 2026 09:41:33 +0900 Subject: [PATCH 11/11] update of dR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index cfd4f4204d1..a07829b22b3 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1762,8 +1762,7 @@ struct kstarInOO { if (std::abs(daughter.pdgCode()) != 321) skip = true; } - } // phi(1020) - else{ + } else { for (auto& daughter : mcParticle.daughters_as()) { if (std::abs(daughter.pdgCode()) == 321) ++daughter_kaon; @@ -1856,8 +1855,7 @@ struct kstarInOO { } } // INSIDE Jets } // pion daughter - } // K*(892)0 - else{ + } else { if (std::abs(daughter.pdgCode()) == 321) { double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); double deta_kaon = bestJetEta - daughter.eta();