From 80b77c13e37819a655df5608e8ad750f5c8a56d7 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Sun, 24 May 2026 20:32:13 +0900 Subject: [PATCH 01/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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(); From 1034dbac92664fd76c18d331416d071e5a3560a2 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Fri, 26 Jun 2026 14:50:23 +0900 Subject: [PATCH 12/34] [PWGLF] Added the option of cfgJetdR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 44 +++++++++++++++++++--------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index a07829b22b3..6f28e11eb0f 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -149,7 +149,8 @@ struct kstarInOO { //| //====================== Configurable cfgJetpT{"cfgJetpT", 8.0, "Set Jet pT minimum"}; - Configurable cfgJetR{"cfgJetR", 0.4, "Set Jet radius parameter"}; + Configurable cfgJetR{"cfgJetR", 0.4, "Anti-kT Radius"}; + Configurable cfgJetdR{"cfgJetdR", 0.4, "Set Jet radius parameter"}; Configurable cfgSingleJet{"cfgSingleJet", false, "Enforces strict phi-jet correspondance"}; Configurable cfgReqJets{"cfgReqJets", false, "False: MB, True: Inside Jets"}; Configurable cfgRealTriggerMasks{"cfgRealTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; @@ -278,8 +279,14 @@ 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("recoveredJetpT_6_8to8_10_kstarSpectra", "Kstar pT within the 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("normalJetpT_8_kstarSpectra", "kstar pT in Jet > 8GeV/c", kTH1F, {{2000, 0., 100.}}); + histos.add("normalJetpT_6_8_kstarSpectra", "6 GeV/c < kstar pT in Jet < 8 GeV/c", kTH1F, {{2000, 0., 100.}}); + histos.add("normalJetpT_8_10_kstarSpectra", "8 GeV/c < kstar pT in Jet < 10 GeV/c", kTH1F, {{2000, 0., 100.}}); + histos.add("normalJetpT_10_12_kstarSpectra", "10 GeV/c < kstar pT in Jet < 12 GeV/c", kTH1F, {{2000, 0., 100.}}); + + histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{150, 0.0, 15.0, "True jet pT (GeV/c)"}, {150, 0., 15., "Recovered jet pT (GeV/c)"}}}); } //////////////////////////////////// @@ -1807,7 +1814,7 @@ struct kstarInOO { bestJetEta = mcpjet.eta(); } } // mcpJets - if (bestR > cfgJetR) + if (bestR > cfgJetdR) continue; //================== @@ -1824,12 +1831,12 @@ struct kstarInOO { double deta_kaon = bestJetEta - daughter.eta(); dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); - if (bestR < cfgJetR) { + if (bestR < cfgJetdR) { 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) { + if (dR_kaon > cfgJetdR) { kaon_out = true; missing_pt += daughter.pt(); } @@ -1841,7 +1848,7 @@ struct kstarInOO { double deta_pion = bestJetEta - daughter.eta(); dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion)); - if (bestR < cfgJetR) { + if (bestR < cfgJetdR) { if (cfgJetdRHistos) { histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); @@ -1849,7 +1856,7 @@ struct kstarInOO { if (bestJetpT > 6.0 && bestJetpT < 8.0) histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); } - if (dR_pion > cfgJetR) { + if (dR_pion > cfgJetdR) { pion_out = true; missing_pt += daughter.pt(); } @@ -1861,7 +1868,7 @@ struct kstarInOO { double deta_kaon = bestJetEta - daughter.eta(); dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); - if (bestR < cfgJetR) { + if (bestR < cfgJetdR) { if (cfgJetdRHistos) { histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); @@ -1870,7 +1877,7 @@ struct kstarInOO { histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); } - if (dR_kaon > cfgJetR) { + if (dR_kaon > cfgJetdR) { kaon_out = true; missing_pt = daughter.pt(); } @@ -1883,14 +1890,22 @@ struct kstarInOO { double recoveredJetpT = bestJetpT + missing_pt; if (cfgJetdRHistos) { if (bestJetpT > 6.0 && bestJetpT < 8.0) { + histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt()); histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (recoveredJetpT > 8.0) + if (recoveredJetpT > 8.0) { histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT); + histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt()); + } } - if (bestJetpT > 8.0 && bestJetpT < 10.0) + + 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("normalJetpT_8_10_kstarSpectra"), lResonance.Pt()); + } + if (bestJetpT > 10.0 && bestJetpT < 12.0) { histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), 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) @@ -1898,9 +1913,10 @@ struct kstarInOO { if (bestJetpT > 25.0) histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (bestJetpT > 8.0) + if (bestJetpT > 8.0) { histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - + histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt()); + } histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); } // cfgJetdRHistos } // kaon_out || pion_out From bc1d916e34f761019a4374277b9d1fb5a4b538fa Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Fri, 26 Jun 2026 15:27:58 +0900 Subject: [PATCH 13/34] [PWGLF] Added the option of cfgJetdR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 45 ++++++++++++++++++---------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 6f28e11eb0f..2e77c80fe25 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -791,6 +791,9 @@ struct kstarInOO { template ROOT::Math::PxPyPzMVector TrueReconstruction(const TracksType& trk1, const TracksType& trk2) { + constexpr int kaonPdg = 321; + constexpr int pionPdg = 211; + constexpr int kstar0Pdg = 313; double conjugate = trk1.sign() * trk2.sign(); if (conjugate > 0) return {}; @@ -819,26 +822,26 @@ struct kstarInOO { mothers2PDG.push_back(particle2_mom.pdgCode()); } - if (mothers1PDG[0] != 313) + if (mothers1PDG[0] != kstar0Pdg) return {}; // mother not K*0 - if (mothers2PDG[0] != 313) + if (mothers2PDG[0] != kstar0Pdg) return {}; // mothers not K*0 if (mothers1[0] != mothers2[0]) return {}; // Kaon and pion not from the same K*0 - if (std::abs(particle1.pdgCode()) != 211 && std::abs(particle1.pdgCode()) != 321) + if (std::abs(particle1.pdgCode()) != pionPdg && std::abs(particle1.pdgCode()) != kaonPdg) return {}; - if (std::abs(particle2.pdgCode()) != 211 && std::abs(particle2.pdgCode()) != 321) + if (std::abs(particle2.pdgCode()) != pionPdg && std::abs(particle2.pdgCode()) != kaonPdg) return {}; double track1_mass, track2_mass; - if (std::abs(particle1.pdgCode()) == 211) { + if (std::abs(particle1.pdgCode()) == pionPdg) { track1_mass = massPi; } else { track1_mass = massKa; } - if (std::abs(particle2.pdgCode()) == 211) { + if (std::abs(particle2.pdgCode()) == pionPdg) { track2_mass = massPi; } else { track2_mass = massKa; @@ -1118,6 +1121,9 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto chargedjet : chargedjets) { + // if(std::abs(chargedjet.eta()) > cfgJetEta) + // return; + jetpT.push_back(chargedjet.pt()); jetEta.push_back(chargedjet.eta()); jetPhi.push_back(chargedjet.phi()); @@ -1167,6 +1173,10 @@ struct kstarInOO { int nJetMCEvents = 0; void processMCJets(o2::aod::JetCollision const& collision, JetTrackCandidatesMC const& jetTracks, soa::Filtered const& mcdjets, TrackCandidatesMC const&, aod::McParticles const&, aod::JetParticles const&) { + constexpr int kaonPdg = 321; + constexpr int pionPdg = 211; + constexpr int kstar0Pdg = 313; + if (cDebugLevel > 0) { nJetMCEvents++; if ((nJetMCEvents + 1) % 10000 == 0) { @@ -1315,21 +1325,21 @@ struct kstarInOO { histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt()); } - if (std::abs(particle1.pdgCode()) != 321) // kaon + if (std::abs(particle1.pdgCode()) != kaonPdg) // kaon continue; if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt()); } - if (std::abs(particle2.pdgCode()) != 211) // pion + if (std::abs(particle2.pdgCode()) != pionPdg) // pion continue; if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt()); } - if (std::abs(mothers1PDG[0]) != 313) + if (std::abs(mothers1PDG[0]) != kstar0Pdg) continue; // mother not K*0 if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt()); @@ -1339,7 +1349,7 @@ struct kstarInOO { } } - if (std::abs(mothers2PDG[0]) != 313) + if (std::abs(mothers2PDG[0]) != kstar0Pdg) continue; // mothers not K*0 if (cfgJetMCHistos) { @@ -1764,16 +1774,19 @@ struct kstarInOO { bool skip = false; int daughter_kaon = 0; int daughter_pion = 0; + constexpr int kaonPdg = 321; + constexpr int pionPdg = 211; + if (!cfgIsKstar) { for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) != 321) + if (std::abs(daughter.pdgCode()) != kaonPdg) skip = true; } } else { for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) == 321) + if (std::abs(daughter.pdgCode()) == kaonPdg) ++daughter_kaon; - else if (std::abs(daughter.pdgCode()) == 211) + else if (std::abs(daughter.pdgCode()) == pionPdg) ++daughter_pion; } if (daughter_kaon != 1 || daughter_pion != 1) @@ -1825,7 +1838,7 @@ struct kstarInOO { bool pion_out = false; for (auto& daughter : mcParticle.daughters_as()) { if (cfgIsKstar) { - if (std::abs(daughter.pdgCode()) == 321) { + if (std::abs(daughter.pdgCode()) == kaonPdg) { double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); double deta_kaon = bestJetEta - daughter.eta(); @@ -1842,7 +1855,7 @@ struct kstarInOO { } } // INSIDE Jets } // kaon daughter - if (std::abs(daughter.pdgCode()) == 211) { + if (std::abs(daughter.pdgCode()) == pionPdg) { double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); double deta_pion = bestJetEta - daughter.eta(); @@ -1863,7 +1876,7 @@ struct kstarInOO { } // INSIDE Jets } // pion daughter } else { - if (std::abs(daughter.pdgCode()) == 321) { + if (std::abs(daughter.pdgCode()) == kaonPdg) { 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)); From ff269f62556195d6da07865b29b4e115278da81c Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Fri, 26 Jun 2026 15:36:40 +0900 Subject: [PATCH 14/34] [PWGLF] Added the option of cfgJetdR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 76 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 2e77c80fe25..83ac34002fa 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -285,7 +285,7 @@ struct kstarInOO { histos.add("normalJetpT_6_8_kstarSpectra", "6 GeV/c < kstar pT in Jet < 8 GeV/c", kTH1F, {{2000, 0., 100.}}); histos.add("normalJetpT_8_10_kstarSpectra", "8 GeV/c < kstar pT in Jet < 10 GeV/c", kTH1F, {{2000, 0., 100.}}); histos.add("normalJetpT_10_12_kstarSpectra", "10 GeV/c < kstar pT in Jet < 12 GeV/c", kTH1F, {{2000, 0., 100.}}); - + histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{150, 0.0, 15.0, "True jet pT (GeV/c)"}, {150, 0., 15., "Recovered jet pT (GeV/c)"}}}); } @@ -1121,9 +1121,6 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto chargedjet : chargedjets) { - // if(std::abs(chargedjet.eta()) > cfgJetEta) - // return; - jetpT.push_back(chargedjet.pt()); jetEta.push_back(chargedjet.eta()); jetPhi.push_back(chargedjet.phi()); @@ -1176,7 +1173,7 @@ struct kstarInOO { constexpr int kaonPdg = 321; constexpr int pionPdg = 211; constexpr int kstar0Pdg = 313; - + if (cDebugLevel > 0) { nJetMCEvents++; if ((nJetMCEvents + 1) % 10000 == 0) { @@ -1695,24 +1692,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) { @@ -1776,7 +1773,7 @@ struct kstarInOO { int daughter_pion = 0; constexpr int kaonPdg = 321; constexpr int pionPdg = 211; - + if (!cfgIsKstar) { for (auto& daughter : mcParticle.daughters_as()) { if (std::abs(daughter.pdgCode()) != kaonPdg) @@ -1903,22 +1900,23 @@ struct kstarInOO { double recoveredJetpT = bestJetpT + missing_pt; if (cfgJetdRHistos) { if (bestJetpT > 6.0 && bestJetpT < 8.0) { - histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt()); + histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt()); histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (recoveredJetpT > 8.0) { + if (recoveredJetpT > 8.0){ histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT); - histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt()); - } - } - - if (bestJetpT > 8.0 && bestJetpT < 10.0) { + histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt()); + } + } + + + if (bestJetpT > 8.0 && bestJetpT < 10.0){ histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_8_10_kstarSpectra"), lResonance.Pt()); - } - if (bestJetpT > 10.0 && bestJetpT < 12.0) { + histos.fill(HIST("normalJetpT_8_10_kstarSpectra"), lResonance.Pt()); + } + if (bestJetpT > 10.0 && bestJetpT < 12.0){ histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), lResonance.Pt()); - } + histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), 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) @@ -1926,10 +1924,10 @@ struct kstarInOO { if (bestJetpT > 25.0) histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (bestJetpT > 8.0) { + if (bestJetpT > 8.0){ histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt()); - } + histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt()); + } histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); } // cfgJetdRHistos } // kaon_out || pion_out From 3ffdc5bc1d3d2fac151717f255cadbaa8ffca94d Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Fri, 26 Jun 2026 15:42:09 +0900 Subject: [PATCH 15/34] [PWGLF] Added the option of cfgJetdR --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 73 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 83ac34002fa..accd5b91029 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -285,7 +285,7 @@ struct kstarInOO { histos.add("normalJetpT_6_8_kstarSpectra", "6 GeV/c < kstar pT in Jet < 8 GeV/c", kTH1F, {{2000, 0., 100.}}); histos.add("normalJetpT_8_10_kstarSpectra", "8 GeV/c < kstar pT in Jet < 10 GeV/c", kTH1F, {{2000, 0., 100.}}); histos.add("normalJetpT_10_12_kstarSpectra", "10 GeV/c < kstar pT in Jet < 12 GeV/c", kTH1F, {{2000, 0., 100.}}); - + histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{150, 0.0, 15.0, "True jet pT (GeV/c)"}, {150, 0., 15., "Recovered jet pT (GeV/c)"}}}); } @@ -1173,7 +1173,7 @@ struct kstarInOO { constexpr int kaonPdg = 321; constexpr int pionPdg = 211; constexpr int kstar0Pdg = 313; - + if (cDebugLevel > 0) { nJetMCEvents++; if ((nJetMCEvents + 1) % 10000 == 0) { @@ -1692,24 +1692,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) { @@ -1773,7 +1773,7 @@ struct kstarInOO { int daughter_pion = 0; constexpr int kaonPdg = 321; constexpr int pionPdg = 211; - + if (!cfgIsKstar) { for (auto& daughter : mcParticle.daughters_as()) { if (std::abs(daughter.pdgCode()) != kaonPdg) @@ -1900,23 +1900,22 @@ struct kstarInOO { double recoveredJetpT = bestJetpT + missing_pt; if (cfgJetdRHistos) { if (bestJetpT > 6.0 && bestJetpT < 8.0) { - histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt()); + histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt()); histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (recoveredJetpT > 8.0){ + if (recoveredJetpT > 8.0) { histos.fill(HIST("recoveredJetpT_6_8to8_10"), recoveredJetpT); - histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt()); - } - } - - - if (bestJetpT > 8.0 && bestJetpT < 10.0){ + histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt()); + } + } + + if (bestJetpT > 8.0 && bestJetpT < 10.0) { histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_8_10_kstarSpectra"), lResonance.Pt()); - } - if (bestJetpT > 10.0 && bestJetpT < 12.0){ + histos.fill(HIST("normalJetpT_8_10_kstarSpectra"), lResonance.Pt()); + } + if (bestJetpT > 10.0 && bestJetpT < 12.0) { histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), lResonance.Pt()); - } + histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), 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) @@ -1924,10 +1923,10 @@ struct kstarInOO { if (bestJetpT > 25.0) histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (bestJetpT > 8.0){ + if (bestJetpT > 8.0) { histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt()); - } + histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt()); + } histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); } // cfgJetdRHistos } // kaon_out || pion_out From 173b3e80622bcfa12e7826936dedde034d069114 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 11:09:52 +0900 Subject: [PATCH 16/34] [PWGLF] Added also the option of cfgJetMaxEta --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 103 ++++++++++++--------------- 1 file changed, 46 insertions(+), 57 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index accd5b91029..67f1ef6805d 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -151,6 +151,8 @@ struct kstarInOO { Configurable cfgJetpT{"cfgJetpT", 8.0, "Set Jet pT minimum"}; Configurable cfgJetR{"cfgJetR", 0.4, "Anti-kT Radius"}; Configurable cfgJetdR{"cfgJetdR", 0.4, "Set Jet radius parameter"}; + Configurable cfgJetMaxEta{"cfgJetMaxEta", 0.9, "Set Jet Max Eta"}; + Configurable cfgSingleJet{"cfgSingleJet", false, "Enforces strict phi-jet correspondance"}; Configurable cfgReqJets{"cfgReqJets", false, "False: MB, True: Inside Jets"}; Configurable cfgRealTriggerMasks{"cfgRealTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; @@ -376,6 +378,10 @@ struct kstarInOO { double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiMinus; + static constexpr int KaonPDG = 321; + static constexpr int PionPDG = 211; + static constexpr int Kstar0PDG = 313; + //================================== //|| //|| Helper Templates @@ -395,19 +401,8 @@ struct kstarInOO { } } } // eventSelection histogram - if (objecttype == 2) { - if constexpr (requires { obj.posZ(); }) { - if (!pass) { - histos.fill(HIST("hPosZ_BC"), obj.posZ()); - histos.fill(HIST("hcentFT0C_BC"), obj.centFT0C()); - } else { - histos.fill(HIST("hPosZ_AC"), obj.posZ()); - histos.fill(HIST("hcentFT0C_AC"), obj.centFT0C()); - } - } - } // Jet eventSelection histogram if constexpr (requires { obj.tpcCrossedRowsOverFindableCls(); }) { - if (objecttype == 3) { + if (objecttype == 2) { if (!pass) { histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY()); histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ()); @@ -435,7 +430,7 @@ struct kstarInOO { } } } // trackSelection - if (objecttype == 4) { + if (objecttype == 3) { if constexpr (requires { obj.pt(); }) { if (!pass) { histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), obj.pt(), obj.tpcNSigmaKa()); @@ -448,7 +443,7 @@ struct kstarInOO { } } } // kaon pid Selection - if (objecttype == 5) { + if (objecttype == 4) { if constexpr (requires { obj.pt(); }) { if (!pass) { histos.fill(HIST("QA_nSigma_pion_TPC_BC"), obj.pt(), obj.tpcNSigmaPi()); @@ -594,10 +589,10 @@ struct kstarInOO { }; template - std::pair JeteventSelection(const EventType event, const bool QA) + std::pair JetEventSelection(const EventType event, const bool QA) { if (cfgEventCutQA && QA) { - fillQA(false, event, 2); + fillQA(false, event, 1); } if (!jetderiveddatautilities::selectCollision(event, eventSelectionBits)) { // sel8 @@ -607,7 +602,7 @@ struct kstarInOO { return {false, 2}; if (cfgEventCutQA && QA) { - fillQA(true, event, 2); + fillQA(true, event, 1); } return {true, 8}; }; @@ -616,7 +611,7 @@ struct kstarInOO { bool trackSelection(const TracksType track, const bool QA) { if (cfgTrackCutQA && QA) { - fillQA(false, track, 3); + fillQA(false, track, 2); } if (cfgTrackGlobalSel && !track.isGlobalTrack()) @@ -647,7 +642,7 @@ struct kstarInOO { return false; if (cfgTrackCutQA && QA) { - fillQA(true, track, 3); + fillQA(true, track, 2); } return true; }; @@ -660,7 +655,7 @@ struct kstarInOO { bool tpcPIDPassed{false}, tofPIDPassed{false}; if (cfgTrackCutQA && QA) { - fillQA(false, candidate, 4); + fillQA(false, candidate, 3); } // TPC @@ -700,7 +695,7 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { - fillQA(true, candidate, 4); + fillQA(true, candidate, 3); } return true; } @@ -715,7 +710,7 @@ struct kstarInOO { bool tpcPIDPassed{false}, tofPIDPassed{false}; if (cfgTrackCutQA && QA) { - fillQA(false, candidate, 5); + fillQA(false, candidate, 4); } // TPC @@ -755,7 +750,7 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { - fillQA(true, candidate, 5); + fillQA(true, candidate, 4); } return true; } @@ -791,9 +786,6 @@ struct kstarInOO { template ROOT::Math::PxPyPzMVector TrueReconstruction(const TracksType& trk1, const TracksType& trk2) { - constexpr int kaonPdg = 321; - constexpr int pionPdg = 211; - constexpr int kstar0Pdg = 313; double conjugate = trk1.sign() * trk2.sign(); if (conjugate > 0) return {}; @@ -822,26 +814,26 @@ struct kstarInOO { mothers2PDG.push_back(particle2_mom.pdgCode()); } - if (mothers1PDG[0] != kstar0Pdg) + if (mothers1PDG[0] != Kstar0PDG) return {}; // mother not K*0 - if (mothers2PDG[0] != kstar0Pdg) + if (mothers2PDG[0] != Kstar0PDG) return {}; // mothers not K*0 if (mothers1[0] != mothers2[0]) return {}; // Kaon and pion not from the same K*0 - if (std::abs(particle1.pdgCode()) != pionPdg && std::abs(particle1.pdgCode()) != kaonPdg) + if (std::abs(particle1.pdgCode()) != PionPDG && std::abs(particle1.pdgCode()) != KaonPDG) return {}; - if (std::abs(particle2.pdgCode()) != pionPdg && std::abs(particle2.pdgCode()) != kaonPdg) + if (std::abs(particle2.pdgCode()) != PionPDG && std::abs(particle2.pdgCode()) != KaonPDG) return {}; double track1_mass, track2_mass; - if (std::abs(particle1.pdgCode()) == pionPdg) { + if (std::abs(particle1.pdgCode()) == PionPDG) { track1_mass = massPi; } else { track1_mass = massKa; } - if (std::abs(particle2.pdgCode()) == pionPdg) { + if (std::abs(particle2.pdgCode()) == PionPDG) { track2_mass = massPi; } else { track2_mass = massKa; @@ -1067,11 +1059,9 @@ struct kstarInOO { return; histos.fill(HIST("nEvents"), 1.5); // INEL>0 event - if (std::abs(collision.posZ()) > cfgEventVtxCut) - return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + auto [goodEv, code] = JetEventSelection(collision, true); + if (!goodEv) return; - } histos.fill(HIST("nEvents"), 2.5); // After selection // Trigger before we start jet finding @@ -1121,6 +1111,9 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto chargedjet : chargedjets) { + if (std::abs(chargedjet.eta()) > cfgJetMaxEta - cfgJetdR) + return; + jetpT.push_back(chargedjet.pt()); jetEta.push_back(chargedjet.eta()); jetPhi.push_back(chargedjet.phi()); @@ -1170,10 +1163,6 @@ struct kstarInOO { int nJetMCEvents = 0; void processMCJets(o2::aod::JetCollision const& collision, JetTrackCandidatesMC const& jetTracks, soa::Filtered const& mcdjets, TrackCandidatesMC const&, aod::McParticles const&, aod::JetParticles const&) { - constexpr int kaonPdg = 321; - constexpr int pionPdg = 211; - constexpr int kstar0Pdg = 313; - if (cDebugLevel > 0) { nJetMCEvents++; if ((nJetMCEvents + 1) % 10000 == 0) { @@ -1193,9 +1182,8 @@ struct kstarInOO { return; histos.fill(HIST("nEvents"), 1.5); // INEL>0 event - if (std::abs(collision.posZ()) > cfgEventVtxCut) - return; - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) + auto [goodEv, code] = JetEventSelection(collision, true); + if (!goodEv) return; histos.fill(HIST("nEvents"), 2.5); // Inclusive event @@ -1211,6 +1199,9 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto mcdjet : mcdjets) { + if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) + return; + mcdjetpT.push_back(mcdjet.pt()); mcdjetEta.push_back(mcdjet.eta()); mcdjetPhi.push_back(mcdjet.phi()); @@ -1322,21 +1313,21 @@ struct kstarInOO { histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt()); } - if (std::abs(particle1.pdgCode()) != kaonPdg) // kaon + if (std::abs(particle1.pdgCode()) != KaonPDG) // kaon continue; if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt()); } - if (std::abs(particle2.pdgCode()) != pionPdg) // pion + if (std::abs(particle2.pdgCode()) != PionPDG) // pion continue; if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt()); } - if (std::abs(mothers1PDG[0]) != kstar0Pdg) + if (std::abs(mothers1PDG[0]) != Kstar0PDG) continue; // mother not K*0 if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt()); @@ -1346,7 +1337,7 @@ struct kstarInOO { } } - if (std::abs(mothers2PDG[0]) != kstar0Pdg) + if (std::abs(mothers2PDG[0]) != Kstar0PDG) continue; // mothers not K*0 if (cfgJetMCHistos) { @@ -1375,7 +1366,7 @@ struct kstarInOO { bool INELgt0 = false; for (const auto& track : tracks) { - if (std::abs(track.eta()) < cfgEventMaxEta) { // cfgTrackMaxEta --> cfgEventMaxEta + if (std::abs(track.eta()) < cfgEventMaxEta) { INELgt0 = true; break; } @@ -1652,7 +1643,7 @@ struct kstarInOO { return; for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != 313) + if (std::abs(particle.pdgCode()) != Kstar0PDG) continue; if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; @@ -1771,19 +1762,17 @@ struct kstarInOO { bool skip = false; int daughter_kaon = 0; int daughter_pion = 0; - constexpr int kaonPdg = 321; - constexpr int pionPdg = 211; if (!cfgIsKstar) { for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) != kaonPdg) + if (std::abs(daughter.pdgCode()) != KaonPDG) skip = true; } } else { for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) == kaonPdg) + if (std::abs(daughter.pdgCode()) == KaonPDG) ++daughter_kaon; - else if (std::abs(daughter.pdgCode()) == pionPdg) + else if (std::abs(daughter.pdgCode()) == PionPDG) ++daughter_pion; } if (daughter_kaon != 1 || daughter_pion != 1) @@ -1835,7 +1824,7 @@ struct kstarInOO { bool pion_out = false; for (auto& daughter : mcParticle.daughters_as()) { if (cfgIsKstar) { - if (std::abs(daughter.pdgCode()) == kaonPdg) { + if (std::abs(daughter.pdgCode()) == KaonPDG) { double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); double deta_kaon = bestJetEta - daughter.eta(); @@ -1852,7 +1841,7 @@ struct kstarInOO { } } // INSIDE Jets } // kaon daughter - if (std::abs(daughter.pdgCode()) == pionPdg) { + if (std::abs(daughter.pdgCode()) == PionPDG) { double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); double deta_pion = bestJetEta - daughter.eta(); @@ -1873,7 +1862,7 @@ struct kstarInOO { } // INSIDE Jets } // pion daughter } else { - if (std::abs(daughter.pdgCode()) == kaonPdg) { + if (std::abs(daughter.pdgCode()) == KaonPDG) { 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)); From 23f183b1820efa6e59ec7a561660bf4eaa82fbfc Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 11:55:24 +0900 Subject: [PATCH 17/34] [PWGLF] Added also the option of cfgJetMaxEta --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 67f1ef6805d..785beeafec2 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -127,7 +127,7 @@ struct kstarInOO { Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; Configurable cfgMinvMax{"cfgMinvMax", 1.20, "Maximum Minv value"}; - + // Histogram ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2, 0.2}, ""}; ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2, 0.2}, ""}; @@ -152,7 +152,7 @@ struct kstarInOO { Configurable cfgJetR{"cfgJetR", 0.4, "Anti-kT Radius"}; Configurable cfgJetdR{"cfgJetdR", 0.4, "Set Jet radius parameter"}; Configurable cfgJetMaxEta{"cfgJetMaxEta", 0.9, "Set Jet Max Eta"}; - + Configurable cfgSingleJet{"cfgSingleJet", false, "Enforces strict phi-jet correspondance"}; Configurable cfgReqJets{"cfgReqJets", false, "False: MB, True: Inside Jets"}; Configurable cfgRealTriggerMasks{"cfgRealTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; @@ -378,9 +378,9 @@ struct kstarInOO { double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiMinus; + static constexpr int Kstar0PDG = 313; static constexpr int KaonPDG = 321; static constexpr int PionPDG = 211; - static constexpr int Kstar0PDG = 313; //================================== //|| @@ -905,7 +905,7 @@ struct kstarInOO { double DistinguishJets(const JetType& jets, ROOT::Math::PxPyPzMVector lResonance) { if (cDebugLevel > 0) - std::cout << "Finded multiple jets to the same phi." << std::endl; + LOG(info) << "Found multiple jets to the same phi."; double bestR = 0; double bestJetpT = 0; @@ -1043,7 +1043,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nJetEvents++; if ((nJetEvents + 1) % 10000 == 0) { - std::cout << "Processed Jet Data Events: " << nJetEvents << std::endl; + LOG(info) << "Processed Jet Data Events: " << nJetEvents; } } histos.fill(HIST("nEvents"), 0.5); // Raw event @@ -1112,8 +1112,8 @@ struct kstarInOO { int nJets = 0; for (auto chargedjet : chargedjets) { if (std::abs(chargedjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; - + return; + jetpT.push_back(chargedjet.pt()); jetEta.push_back(chargedjet.eta()); jetPhi.push_back(chargedjet.phi()); @@ -1166,7 +1166,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nJetMCEvents++; if ((nJetMCEvents + 1) % 10000 == 0) { - std::cout << "Processed Jet MC Events: " << nJetMCEvents << std::endl; + LOG(info) << "Processed Jet MC Events: " << nJetMCEvents; } } histos.fill(HIST("nEvents"), 0.5); // Gen event @@ -1200,8 +1200,8 @@ struct kstarInOO { int nJets = 0; for (auto mcdjet : mcdjets) { if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; - + return; + mcdjetpT.push_back(mcdjet.pt()); mcdjetEta.push_back(mcdjet.eta()); mcdjetPhi.push_back(mcdjet.phi()); @@ -1359,7 +1359,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nEvents++; if ((nEvents + 1) % 10000 == 0) { - std::cout << "Processed Data Events: " << nEvents << std::endl; + LOG(info) << "Processed Data Events: " << nEvents; } } histos.fill(HIST("nEvents"), 0.5); @@ -1406,7 +1406,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nEventsMix++; if ((nEventsMix + 1) % 10000 == 0) { - std::cout << "Processed DATA Mixed Events : " << nEventsMix << std::endl; + LOG(info) << "Processed DATA Mixed Events : " << nEventsMix; } } auto [goodEv1, code1] = eventSelection(collision1, false); @@ -1443,8 +1443,8 @@ struct kstarInOO { nEventsMC++; if ((nEventsMC + 1) % 10000 == 0) { double histmem = histos.getSize(); - std::cout << histmem << std::endl; - std::cout << "process_SameEvent_MC: " << nEventsMC << std::endl; + LOG(info) << histmem; + LOG(info) << "process_SameEvent_MC: " << nEventsMC; } } histos.fill(HIST("nEvents"), 0.5); @@ -1490,7 +1490,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nEventsMCMix++; if ((nEventsMCMix + 1) % 10000 == 0) { - std::cout << "Processed Mixed Events: " << nEventsMCMix << std::endl; + LOG(info) << "Processed Mixed Events: " << nEventsMCMix; } } auto [goodEv1, code1] = eventSelection(collision1, false); @@ -1515,7 +1515,7 @@ struct kstarInOO { if (cDebugLevel > 0) { ++nEventsGen; if (nEventsGen % 10000 == 0) { - std::cout << "Processed MC (GEN) Events: " << nEventsGen << std::endl; + LOG(info) << "Processed MC (GEN) Events: " << nEventsGen; } } if (cfgMCHistos) { @@ -1547,7 +1547,7 @@ struct kstarInOO { return; for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != 313) + if (std::abs(particle.pdgCode()) != Kstar0PDG) continue; if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; @@ -1586,7 +1586,7 @@ struct kstarInOO { } for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != 313) + if (std::abs(particle.pdgCode()) != Kstar0PDG) continue; // Not K*0 if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; @@ -1612,7 +1612,7 @@ struct kstarInOO { if (cDebugLevel > 0) { ++nprocessGenEvents; if (nprocessGenEvents % 10000 == 0) { - std::cout << "Processed MC (GEN) Events: " << nprocessGenEvents << std::endl; + LOG(info) << "Processed MC (GEN) Events: " << nprocessGenEvents; } } if (cfgJetMCHistos) { @@ -1675,7 +1675,7 @@ struct kstarInOO { } for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != 313) + if (std::abs(particle.pdgCode()) != Kstar0PDG) continue; if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; @@ -1717,7 +1717,7 @@ struct kstarInOO { if (cDebugLevel > 0) { ++ndRtest; if (ndRtest % 10000 == 0) { - std::cout << "Processed dR test: " << ndRtest << std::endl; + LOG(info) << "Processed dR test: " << ndRtest; } } From 42673ca2ce864fa603e25d65f26845a8afff1d79 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 11:57:55 +0900 Subject: [PATCH 18/34] [PWGLF] Fixed std::cout --> LOG(info) also --- 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 785beeafec2..5e28a4af97d 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -49,7 +49,7 @@ #include #include #include -#include +//#include #include #include #include From be153d88f7762eb1783485edb7fcd0c26b204f99 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 11:59:40 +0900 Subject: [PATCH 19/34] [PWGLF] Fixed std::cout --> LOG(info) also --- 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 5e28a4af97d..ab24e17f775 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -49,7 +49,6 @@ #include #include #include -//#include #include #include #include From 0cb0676ecc567b6a4e3ea341903b1614927d2455 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 12:05:13 +0900 Subject: [PATCH 20/34] [PWGLF] Fixed std::cout --> LOG(info) also --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index ab24e17f775..598baa0baee 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -53,7 +53,6 @@ #include #include #include - #include using namespace o2; @@ -1041,9 +1040,8 @@ struct kstarInOO { { if (cDebugLevel > 0) { nJetEvents++; - if ((nJetEvents + 1) % 10000 == 0) { + if ((nJetEvents + 1) % 10000 == 0) LOG(info) << "Processed Jet Data Events: " << nJetEvents; - } } histos.fill(HIST("nEvents"), 0.5); // Raw event @@ -1164,9 +1162,8 @@ struct kstarInOO { { if (cDebugLevel > 0) { nJetMCEvents++; - if ((nJetMCEvents + 1) % 10000 == 0) { + if ((nJetMCEvents + 1) % 10000 == 0) LOG(info) << "Processed Jet MC Events: " << nJetMCEvents; - } } histos.fill(HIST("nEvents"), 0.5); // Gen event @@ -1357,9 +1354,8 @@ struct kstarInOO { { if (cDebugLevel > 0) { nEvents++; - if ((nEvents + 1) % 10000 == 0) { + if ((nEvents + 1) % 10000 == 0) LOG(info) << "Processed Data Events: " << nEvents; - } } histos.fill(HIST("nEvents"), 0.5); @@ -1404,9 +1400,8 @@ struct kstarInOO { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { nEventsMix++; - if ((nEventsMix + 1) % 10000 == 0) { + if ((nEventsMix + 1) % 10000 == 0) LOG(info) << "Processed DATA Mixed Events : " << nEventsMix; - } } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); @@ -1488,9 +1483,8 @@ struct kstarInOO { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { nEventsMCMix++; - if ((nEventsMCMix + 1) % 10000 == 0) { + if ((nEventsMCMix + 1) % 10000 == 0) LOG(info) << "Processed Mixed Events: " << nEventsMCMix; - } } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); @@ -1513,9 +1507,8 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++nEventsGen; - if (nEventsGen % 10000 == 0) { + if (nEventsGen % 10000 == 0) LOG(info) << "Processed MC (GEN) Events: " << nEventsGen; - } } if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); // Gen events @@ -1610,9 +1603,8 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++nprocessGenEvents; - if (nprocessGenEvents % 10000 == 0) { + if (nprocessGenEvents % 10000 == 0) LOG(info) << "Processed MC (GEN) Events: " << nprocessGenEvents; - } } if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); @@ -1715,9 +1707,8 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++ndRtest; - if (ndRtest % 10000 == 0) { + if (ndRtest % 10000 == 0) LOG(info) << "Processed dR test: " << ndRtest; - } } bool INELgt0 = false; From bc4a015dd798333aa9794360a968279e49d1510b Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 12:14:33 +0900 Subject: [PATCH 21/34] [PWGLF] Fixed std::cout --> LOG(info) also --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 598baa0baee..16674cc22eb 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -53,6 +53,7 @@ #include #include #include + #include using namespace o2; @@ -125,7 +126,7 @@ struct kstarInOO { Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; Configurable cfgMinvMax{"cfgMinvMax", 1.20, "Maximum Minv value"}; - + // Histogram ConfigurableAxis binsDCAz{"binsDCAz", {40, -0.2, 0.2}, ""}; ConfigurableAxis binsDCAxy{"binsDCAxy", {40, -0.2, 0.2}, ""}; @@ -150,7 +151,7 @@ struct kstarInOO { Configurable cfgJetR{"cfgJetR", 0.4, "Anti-kT Radius"}; Configurable cfgJetdR{"cfgJetdR", 0.4, "Set Jet radius parameter"}; Configurable cfgJetMaxEta{"cfgJetMaxEta", 0.9, "Set Jet Max Eta"}; - + Configurable cfgSingleJet{"cfgSingleJet", false, "Enforces strict phi-jet correspondance"}; Configurable cfgReqJets{"cfgReqJets", false, "False: MB, True: Inside Jets"}; Configurable cfgRealTriggerMasks{"cfgRealTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; @@ -1041,7 +1042,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nJetEvents++; if ((nJetEvents + 1) % 10000 == 0) - LOG(info) << "Processed Jet Data Events: " << nJetEvents; + LOG(info) << "Processed Jet Data Events: " << nJetEvents; } histos.fill(HIST("nEvents"), 0.5); // Raw event @@ -1109,8 +1110,8 @@ struct kstarInOO { int nJets = 0; for (auto chargedjet : chargedjets) { if (std::abs(chargedjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; - + return; + jetpT.push_back(chargedjet.pt()); jetEta.push_back(chargedjet.eta()); jetPhi.push_back(chargedjet.phi()); @@ -1163,7 +1164,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nJetMCEvents++; if ((nJetMCEvents + 1) % 10000 == 0) - LOG(info) << "Processed Jet MC Events: " << nJetMCEvents; + LOG(info) << "Processed Jet MC Events: " << nJetMCEvents; } histos.fill(HIST("nEvents"), 0.5); // Gen event @@ -1196,8 +1197,8 @@ struct kstarInOO { int nJets = 0; for (auto mcdjet : mcdjets) { if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; - + return; + mcdjetpT.push_back(mcdjet.pt()); mcdjetEta.push_back(mcdjet.eta()); mcdjetPhi.push_back(mcdjet.phi()); @@ -1355,7 +1356,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nEvents++; if ((nEvents + 1) % 10000 == 0) - LOG(info) << "Processed Data Events: " << nEvents; + LOG(info) << "Processed Data Events: " << nEvents; } histos.fill(HIST("nEvents"), 0.5); @@ -1401,7 +1402,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nEventsMix++; if ((nEventsMix + 1) % 10000 == 0) - LOG(info) << "Processed DATA Mixed Events : " << nEventsMix; + LOG(info) << "Processed DATA Mixed Events : " << nEventsMix; } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); @@ -1437,8 +1438,8 @@ struct kstarInOO { nEventsMC++; if ((nEventsMC + 1) % 10000 == 0) { double histmem = histos.getSize(); - LOG(info) << histmem; - LOG(info) << "process_SameEvent_MC: " << nEventsMC; + LOG(info) << histmem; + LOG(info) << "process_SameEvent_MC: " << nEventsMC; } } histos.fill(HIST("nEvents"), 0.5); @@ -1484,7 +1485,7 @@ struct kstarInOO { if (cDebugLevel > 0) { nEventsMCMix++; if ((nEventsMCMix + 1) % 10000 == 0) - LOG(info) << "Processed Mixed Events: " << nEventsMCMix; + LOG(info) << "Processed Mixed Events: " << nEventsMCMix; } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); @@ -1508,7 +1509,7 @@ struct kstarInOO { if (cDebugLevel > 0) { ++nEventsGen; if (nEventsGen % 10000 == 0) - LOG(info) << "Processed MC (GEN) Events: " << nEventsGen; + LOG(info) << "Processed MC (GEN) Events: " << nEventsGen; } if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); // Gen events @@ -1604,7 +1605,7 @@ struct kstarInOO { if (cDebugLevel > 0) { ++nprocessGenEvents; if (nprocessGenEvents % 10000 == 0) - LOG(info) << "Processed MC (GEN) Events: " << nprocessGenEvents; + LOG(info) << "Processed MC (GEN) Events: " << nprocessGenEvents; } if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); @@ -1708,7 +1709,7 @@ struct kstarInOO { if (cDebugLevel > 0) { ++ndRtest; if (ndRtest % 10000 == 0) - LOG(info) << "Processed dR test: " << ndRtest; + LOG(info) << "Processed dR test: " << ndRtest; } bool INELgt0 = false; From 52ae7f42175cd0d44a53c2e0dcb46e2224ef3689 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 29 Jun 2026 12:16:37 +0900 Subject: [PATCH 22/34] [PWGLF] Fixed std::cout --> LOG(info) also --- 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 16674cc22eb..b2840dca788 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1110,7 +1110,7 @@ struct kstarInOO { int nJets = 0; for (auto chargedjet : chargedjets) { if (std::abs(chargedjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; + return; jetpT.push_back(chargedjet.pt()); jetEta.push_back(chargedjet.eta()); @@ -1197,7 +1197,7 @@ struct kstarInOO { int nJets = 0; for (auto mcdjet : mcdjets) { if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; + return; mcdjetpT.push_back(mcdjet.pt()); mcdjetEta.push_back(mcdjet.eta()); @@ -1438,8 +1438,8 @@ struct kstarInOO { nEventsMC++; if ((nEventsMC + 1) % 10000 == 0) { double histmem = histos.getSize(); - LOG(info) << histmem; - LOG(info) << "process_SameEvent_MC: " << nEventsMC; + LOG(info) << histmem; + LOG(info) << "process_SameEvent_MC: " << nEventsMC; } } histos.fill(HIST("nEvents"), 0.5); From 359c329f3051f31f07b207d026c7c91ac704556a Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 14 Jul 2026 13:24:54 +0900 Subject: [PATCH 23/34] [PWGLF] Added the Mis-IDentified PID cut --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 406 +++++++++++++++------------ 1 file changed, 222 insertions(+), 184 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index b2840dca788..b1d5a618c94 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -75,9 +75,6 @@ struct kstarInOO { 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"}; - Configurable cfgOccupancyMin{"cfgOccupancyMin", -100., "minimum occupancy of tracks in neighbouring collisions in a given time range"}; // Track Selection // General @@ -106,9 +103,12 @@ struct kstarInOO { Configurable cfgTrackCirclePIDCut{"cfgTrackCirclePIDCut", true, "Enables PID cut shape circle switch"}; Configurable cfgTrackCircleValue{"cfgTrackCircleValue", 2, "Enables TOF TPC PID circle cut value"}; Configurable cfgTrackTOFHard{"cfgTrackTOFHard", false, "Enables TOF Hard"}; + Configurable isMIDCut{"isMIDCut", false, "Enables Mis-IDentified PID cut"}; Configurable cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"}; Configurable cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"}; + Configurable cfgMIDnSig{"cfgMIDnSig", 1.5, "nTPC Mis-IDentification Particle sigma"}; + Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; // Mixing @@ -133,7 +133,6 @@ 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"}; @@ -199,7 +198,6 @@ struct kstarInOO { "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()); @@ -223,7 +221,10 @@ struct kstarInOO { histos.add("QA_nSigma_kaon_TOF_BC", "QA_nSigma_kaon_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_kaon_TPC_TOF_BC", "QA_kaon_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}}); histos.add("QA_track_pT_BC", "QA_track_pT_BC", kTH1F, {{13, 0.0, 13.0}}); - + + histos.add("Possible_MID_Pion_TPC", "Possible_MID_Pion_TPC", {HistType::kTH2F, {pidAxis, pidAxis}}); + histos.add("Possible_MID_Kaon_TPC", "Possible_MID_Kaon_TPC", {HistType::kTH2F, {pidAxis, pidAxis}}); + histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {axisDCAxy}); histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {axisDCAz}); histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}}); @@ -252,8 +253,6 @@ 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}}); histos.add("jetTrackPhi", "Jet Track Phi", kTH1F, {{80, -1.0, 7.0}}); } @@ -271,6 +270,21 @@ struct kstarInOO { 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_6_8", "dR between tagged jet and kpi 6 < jet pT < 8", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); + histos.add("Kstar_pT_INJet_6_8", "K*0 pT Inside 6-8 Jet", kTH1F, {{1000, 0., 50.}}); + histos.add("Kstar_pT_INJet_8_10", "K*0 pT Inside 8-10 Jet", kTH1F, {{1000, 0., 50.}}); + histos.add("Kstar_pT_INJet_10_12", "K*0 pT Inside 10-12 Jet", kTH1F, {{1000, 0., 50.}}); + histos.add("Kstar_pT_INJet_12_15", "K*0 pT Inside 12-15 Jet", kTH1F, {{1000, 0., 50.}}); + + histos.add("recoveredJetpT_6_8to8", "Recovered Jet pT 6-8 --> 8", kTH1F, {{2000, 0., 100.}}); + histos.add("Kstar_pT_6_8to8_IN_recoveredJet", "K*0 pT In recovered Jet pT 6-8 --> 8", kTH1F, {{1000, 0., 50.}}); + histos.add("Kstar_pT_6_8to8_10_IN_recoveredJet", "K*0 pT In recovered Jet pT 6-8 --> 8-10", kTH1F, {{1000, 0., 50.}}); + + histos.add("Daughter_pT_8_IN_recoveredJet", "Daughters pT In recovered Jet 8-infinite", kTH1F, {{1000, 0., 50.}}); + histos.add("Daughter_pT_8_10_IN_recoveredJet", "Daughters pT In recovered Jet 8-10", kTH1F, {{1000, 0., 50.}}); + histos.add("Daughter_pT_8_10_INJet", "Daughters pT In Jet 8-10", kTH1F, {{1000, 0., 50.}}); + histos.add("Daughter_pT_10_12_INJet", "Daughters pT In Jet 10-12", kTH1F, {{1000, 0., 50.}}); + histos.add("Daughter_pT_12_15_INJet", "Daughters pT In Jet 12-15", kTH1F, {{1000, 0., 50.}}); + 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.}}}); @@ -279,14 +293,6 @@ 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("recoveredJetpT_6_8to8_10", "recovered Jet pT", kTH1F, {{2000, 0., 100.}}); - histos.add("recoveredJetpT_6_8to8_10_kstarSpectra", "Kstar pT within the recovered Jet pT", kTH1F, {{2000, 0., 100.}}); - - histos.add("normalJetpT_8_kstarSpectra", "kstar pT in Jet > 8GeV/c", kTH1F, {{2000, 0., 100.}}); - histos.add("normalJetpT_6_8_kstarSpectra", "6 GeV/c < kstar pT in Jet < 8 GeV/c", kTH1F, {{2000, 0., 100.}}); - histos.add("normalJetpT_8_10_kstarSpectra", "8 GeV/c < kstar pT in Jet < 10 GeV/c", kTH1F, {{2000, 0., 100.}}); - histos.add("normalJetpT_10_12_kstarSpectra", "10 GeV/c < kstar pT in Jet < 12 GeV/c", kTH1F, {{2000, 0., 100.}}); - histos.add("JetMigration", "bin to bin migration", {HistType::kTH2F, {{150, 0.0, 15.0, "True jet pT (GeV/c)"}, {150, 0., 15., "Recovered jet pT (GeV/c)"}}}); } @@ -574,17 +580,12 @@ struct kstarInOO { if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 8); } - if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin)) - return {false, 9}; - if (cfgEventCutQA && QA) { - histos.fill(HIST("hEvent_Cut"), 9); - } - + if (cfgEventCutQA && QA) { fillQA(true, event, 1); - histos.fill(HIST("hEvent_Cut"), 10); + histos.fill(HIST("hEvent_Cut"), 9); } - return {true, 11}; + return {true, 10}; }; template @@ -645,34 +646,52 @@ struct kstarInOO { } return true; }; + + template + bool isMIDPion(const TrackPID& candidate) + { + if (cfgTrackCutQA) + histos.fill(HIST("Possible_MID_Pion_TPC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); + return std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig && std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig; + } + + template + bool isMIDKaon(const TrackPID& candidate) + { + if (cfgTrackCutQA) + histos.fill(HIST("Possible_MID_Kaon_TPC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); + return std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig && std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig; + } + template bool trackPIDKaon(const TrackPID& candidate, const bool QA) { double tpcpid = 0; double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - - if (cfgTrackCutQA && QA) { + + if (cfgTrackCutQA && QA) fillQA(false, candidate, 3); - } // TPC if (cfgTrackSquarePIDCut) { - if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) - tpcPIDPassed = true; - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) { - tofPIDPassed = true; - } - } else { - if (!cfgTrackTOFHard) { - tofPIDPassed = true; - } else { - tofPIDPassed = false; - } - } + if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig){ + tpcPIDPassed = true; + + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) { + tofPIDPassed = true; + } + } else { + if (!cfgTrackTOFHard) { + tofPIDPassed = true; + }else + tofPIDPassed = false; + } + } // TPCPID cut } // end of square cut + if (cfgTrackCirclePIDCut) { if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) tpcpid = std::abs(candidate.tpcNSigmaKa()); @@ -693,9 +712,8 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA && QA) { + if (cfgTrackCutQA && QA) fillQA(true, candidate, 3); - } return true; } return false; @@ -708,26 +726,27 @@ struct kstarInOO { double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (cfgTrackCutQA && QA) { + if (cfgTrackCutQA && QA) fillQA(false, candidate, 4); - } // TPC if (cfgTrackSquarePIDCut) { - if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) - tpcPIDPassed = true; - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) { - tofPIDPassed = true; - } - } else { - if (!cfgTrackTOFHard) { - tofPIDPassed = true; - } else { - tofPIDPassed = false; - } - } + if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig){ + tpcPIDPassed = true; + + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) + tofPIDPassed = true; + } else { + if (!cfgTrackTOFHard) { + tofPIDPassed = true; + } else + tofPIDPassed = false; + } + } // TPCPID cut + } // end of square cut + if (cfgTrackCirclePIDCut) { if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) tpcpid = std::abs(candidate.tpcNSigmaPi()); @@ -748,9 +767,8 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA && QA) { - fillQA(true, candidate, 4); - } + if (cfgTrackCutQA && QA) + fillQA(true, candidate, 4); return true; } return false; @@ -763,6 +781,11 @@ struct kstarInOO { return {}; if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) return {}; + if (isMIDCut && isMIDPion(trk1)) + return {}; + if (isMIDCut && isMIDKaon(trk2)) + return {}; + if (trk1.globalIndex() >= trk2.globalIndex()) return {}; @@ -792,12 +815,11 @@ struct kstarInOO { auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); - if (!particle1.has_mothers() || !particle2.has_mothers()) { + if (!particle1.has_mothers() || !particle2.has_mothers()) return {}; - } - if (std::abs(particle1.eta()) > cfgTrackMaxEta || std::abs(particle2.eta()) > cfgTrackMaxEta) { + + if (std::abs(particle1.eta()) > cfgTrackMaxEta || std::abs(particle2.eta()) > cfgTrackMaxEta) return {}; - } std::vector mothers1{}; std::vector mothers1PDG{}; @@ -947,13 +969,13 @@ struct kstarInOO { bool jetFlag = false; int goodjets = 0; double jetpt = 0; - double R = 0; + double dR = 0; for (auto const& jet : chargedjets) { - double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); - double etadiff = jet.eta() - lResonance.Eta(); - R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + double dphi = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); + double deta = jet.eta() - lResonance.Eta(); + dR = TMath::Sqrt((deta * deta) + (dphi * dphi)); - if (R < cfgJetR) { + if (dR < cfgJetR) { jetFlag = true; jetpt = jet.pt(); goodjets++; @@ -1103,18 +1125,12 @@ struct kstarInOO { } // Trigger cut histos.fill(HIST("nEvents"), 3.5); // After trigger cut - std::vector jetpT{}; - std::vector jetEta{}; - std::vector jetPhi{}; bool HasJets = false; int nJets = 0; for (auto chargedjet : chargedjets) { if (std::abs(chargedjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; - - jetpT.push_back(chargedjet.pt()); - jetEta.push_back(chargedjet.eta()); - jetPhi.push_back(chargedjet.phi()); + continue; + nJets++; if (cfgJetQAHistos) { histos.fill(HIST("JetpT"), chargedjet.pt()); @@ -1127,7 +1143,7 @@ struct kstarInOO { if (cfgJetQAHistos) { histos.fill(HIST("nJetsPerEvent"), nJets); } - + //==================== //| Has Jets //==================== @@ -1137,13 +1153,13 @@ struct kstarInOO { } histos.fill(HIST("nEvents"), 4.5); // Has jets + // Just for checking track QA plot for (auto& jetTrack : jetTracks) { auto originTrack = jetTrack.track_as(); if (!trackSelection(originTrack, true)) continue; if (cfgJetQAHistos) { - histos.fill(HIST("rawDimpT"), jetTrack.pt(), jetTrack.pt() - originTrack.pt()); histos.fill(HIST("jetTrackEta"), jetTrack.eta()); histos.fill(HIST("jetTrackPhi"), jetTrack.phi()); } @@ -1189,40 +1205,30 @@ struct kstarInOO { // return; // histos.fill(HIST("nEvents"), 3.5); // Events for Inclusive - std::vector mcdjetpT{}; - std::vector mcdjetEta{}; - std::vector mcdjetPhi{}; - bool HasJets = false; int nJets = 0; for (auto mcdjet : mcdjets) { if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) - return; - - mcdjetpT.push_back(mcdjet.pt()); - mcdjetEta.push_back(mcdjet.eta()); - mcdjetPhi.push_back(mcdjet.phi()); + continue; + nJets++; if (cfgJetQAHistos) { histos.fill(HIST("JetpT"), mcdjet.pt()); histos.fill(HIST("JetEta"), mcdjet.eta()); histos.fill(HIST("JetPhi"), mcdjet.phi()); } - if (mcdjet.pt() > cfgJetpT) { + if (mcdjet.pt() > cfgJetpT) HasJets = true; - } - } - if (cfgJetQAHistos) { + } //mcdjets + if (cfgJetQAHistos) histos.fill(HIST("nJetsPerEvent"), nJets); - } - + //==================== //| Has Jets //==================== if (cfgReqJets) { - if (!HasJets) { + if (!HasJets) return; - } } histos.fill(HIST("nEvents"), 3.5); // Jet event @@ -1239,15 +1245,13 @@ struct kstarInOO { lDecayDaughterTest2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); lResonanceTest1 = lDecayDaughterTest1 + lDecayDaughterTest2; - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest0_pT"), lResonanceTest1.Pt()); - } if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest1_pT"), lResonanceTest1.Pt()); - } ////////////////////////////// ////////////////////////////// @@ -1258,17 +1262,15 @@ struct kstarInOO { ////////////////////////////// ////////////////////////////// - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest2_pT"), lResonanceTest1.Pt()); - } if (cfgReqMcEffPID) { // false, true if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) continue; } - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest3_pT"), lResonanceTest1.Pt()); - } auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); @@ -1277,9 +1279,9 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) { continue; } - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest4_pT"), lResonanceTest1.Pt()); - } + //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -1290,39 +1292,35 @@ struct kstarInOO { mothers1PDG.push_back(particle1_mom.pdgCode()); } - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hMotherPdg1"), std::abs(mothers1PDG[0])); - } + std::vector mothers2{}; std::vector mothers2PDG{}; for (auto& particle2_mom : particle2.template mothers_as()) { mothers2.push_back(particle2_mom.globalIndex()); mothers2PDG.push_back(particle2_mom.pdgCode()); } - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hMotherPdg2"), std::abs(mothers2PDG[0])); - } if (mothers1[0] != mothers2[0]) continue; // Kaon and pion not from the same K*0 - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt()); - } if (std::abs(particle1.pdgCode()) != KaonPDG) // kaon continue; - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt()); - } if (std::abs(particle2.pdgCode()) != PionPDG) // pion continue; - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt()); - } if (std::abs(mothers1PDG[0]) != Kstar0PDG) continue; // mother not K*0 @@ -1337,9 +1335,8 @@ struct kstarInOO { if (std::abs(mothers2PDG[0]) != Kstar0PDG) continue; // mothers not K*0 - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hEffRec_pT"), lResonanceTest1.Pt()); - } } // track loop } // process loop @@ -1489,9 +1486,8 @@ struct kstarInOO { } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); - if (!goodEv1 || !goodEv2) { + if (!goodEv1 || !goodEv2) continue; - } TrackSlicingMC(collision1, tracks1, collision2, tracks2, true, false); } // mixing @@ -1511,9 +1507,8 @@ struct kstarInOO { if (nEventsGen % 10000 == 0) LOG(info) << "Processed MC (GEN) Events: " << nEventsGen; } - if (cfgMCHistos) { + if (cfgMCHistos) histos.fill(HIST("nEvents_Gen"), 0.5); // Gen events - } //======================= //| Event & Signal loss @@ -1528,13 +1523,11 @@ struct kstarInOO { break; } if (cfgForceTrueINELgt) { - if (!INELgt0) { + if (!INELgt0) return; - } } - if (cfgMCHistos) { + if (cfgMCHistos) histos.fill(HIST("nEvents_Gen"), 1.5); // INEL>0 Gen events & EL: denominator - } if (std::abs(collision.posZ()) > cfgEventVtxCut) return; @@ -1545,15 +1538,13 @@ struct kstarInOO { if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; - if (cfgMCHistos) { + if (cfgMCHistos) histos.fill(HIST("hGen_pT_Kstar"), particle.pt()); // SL: denominator - } } // Gen colls if (recocolls.size() <= 0) { // not reconstructed - if (cfgForceGenReco) { + if (cfgForceGenReco) return; - } } //================= @@ -1574,9 +1565,8 @@ 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()) != Kstar0PDG) @@ -1586,9 +1576,8 @@ struct kstarInOO { if (particle.pt() < cfgTrackMinPt) continue; - if (cfgMCHistos) { + if (cfgMCHistos) histos.fill(HIST("hRec_pT_Kstar"), centrality, particle.pt()); // SL: numerator // eff: denominator - } } // loop over particles } // processGen @@ -1607,9 +1596,9 @@ struct kstarInOO { if (nprocessGenEvents % 10000 == 0) LOG(info) << "Processed MC (GEN) Events: " << nprocessGenEvents; } - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("nEvents_Gen"), 0.5); - } + //======================= //| Event & Signal loss //======================= @@ -1623,13 +1612,11 @@ struct kstarInOO { break; } if (cfgForceTrueINELgt) { - if (!INELgt0) { + if (!INELgt0) return; - } } - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("nEvents_Gen"), 1.5); // EL: denominator - } if (std::abs(collision.posZ()) > cfgEventVtxCut) return; @@ -1640,14 +1627,12 @@ struct kstarInOO { if (std::abs(particle.eta()) > cfgTrackMaxEta) continue; - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hGen_pT_Kstar"), particle.pt()); // SL: denominator - } } // Unreco. - if (recocolls.size() <= 0) { // not reconstructed + if (recocolls.size() <= 0) // not reconstructed return; - } //================= //| Efficiency //================= @@ -1662,9 +1647,8 @@ struct kstarInOO { if (!goodEv) return; } // reco.coll - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("nEvents_Gen"), 2.5); // EL: numerator - } for (auto& particle : mcParticles) { if (std::abs(particle.pdgCode()) != Kstar0PDG) @@ -1695,9 +1679,8 @@ struct kstarInOO { } // enforce BR restriction */ - if (cfgJetMCHistos) { + if (cfgJetMCHistos) histos.fill(HIST("hRec_pT_Kstar"), particle.pt()); // SL: numerator and eff: denominator - } } // loop over particles } // end of process @@ -1746,9 +1729,8 @@ struct kstarInOO { if (std::abs(mcParticle.pdgCode()) != GenPID) continue; - if (cfgJetdRHistos) { + if (cfgJetdRHistos) histos.fill(HIST("Gen_particle_All_BR"), mcParticle.pt()); - } bool skip = false; int daughter_kaon = 0; @@ -1796,66 +1778,97 @@ struct kstarInOO { 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(); + double dR = TMath::Sqrt((dphi * dphi) + (deta * deta)); + + ROOT::Math::PxPyPzEVector MCPJet; + MCPJet = ROOT::Math::PxPyPzEVector(mcpjet.px(), mcpjet.py(), mcpjet.pz(), mcpjet.energy()); + if (dR < bestR) { + bestR = dR; + bestJetpT = MCPJet.Pt(); bestJetPhi = mcpjet.phi(); bestJetEta = mcpjet.eta(); } } // mcpJets if (bestR > cfgJetdR) continue; - + //================== // daughters double missing_pt = 0; + + double kaon_pt = 0; + double pion_pt = 0; + double dR_kaon, dR_pion; bool kaon_out = false; bool pion_out = false; for (auto& daughter : mcParticle.daughters_as()) { + ROOT::Math::PxPyPzEVector Daughter; + Daughter = ROOT::Math::PxPyPzEVector(daughter.px(), daughter.py(), daughter.pz(), daughter.energy()); + if (cfgIsKstar) { if (std::abs(daughter.pdgCode()) == KaonPDG) { - - double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); - double deta_kaon = bestJetEta - daughter.eta(); + 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 < cfgJetdR) { if (cfgJetdRHistos) { histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + + kaon_pt += Daughter.pt(); + if (bestJetpT > 6.0 && bestJetpT < 8.0){ + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); + } + if (bestJetpT > 8.0 && bestJetpT < 10.0) + histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); + if (bestJetpT > 10.0 && bestJetpT < 12.0) + histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); + if (bestJetpT > 12.0 && bestJetpT < 15.0) + histos.fill(HIST("Kstar_pT_INJet_12_15"), lResonance.Pt()); } if (dR_kaon > cfgJetdR) { kaon_out = true; - missing_pt += daughter.pt(); + missing_pt += Daughter.Pt(); + kaon_pt += Daughter.Pt(); } } // INSIDE Jets } // kaon daughter if (std::abs(daughter.pdgCode()) == PionPDG) { - - double dphi_pion = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); - double deta_pion = bestJetEta - daughter.eta(); + 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 < cfgJetdR) { 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()); + + pion_pt += daughter.pt(); + if (bestJetpT > 6.0 && bestJetpT < 8.0){ + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); + histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); + } + if (bestJetpT > 8.0 && bestJetpT < 10.0) + histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); + if (bestJetpT > 10.0 && bestJetpT < 12.0) + histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); + if (bestJetpT > 12.0 && bestJetpT < 15.0) + histos.fill(HIST("Kstar_pT_INJet_12_15"), lResonance.Pt()); } if (dR_pion > cfgJetdR) { pion_out = true; - missing_pt += daughter.pt(); + missing_pt += Daughter.pt(); + pion_pt += Daughter.pt(); } } // INSIDE Jets } // pion daughter } else { if (std::abs(daughter.pdgCode()) == KaonPDG) { - double dphi_kaon = TVector2::Phi_mpi_pi(bestJetPhi - daughter.phi()); - double deta_kaon = bestJetEta - daughter.eta(); + 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 < cfgJetdR) { @@ -1869,44 +1882,69 @@ struct kstarInOO { if (dR_kaon > cfgJetdR) { kaon_out = true; - missing_pt = daughter.pt(); + missing_pt = Daughter.pt(); } - } + } // IN Jet } // kaon daughter } // phi(1020) } // daughter - - if (kaon_out || pion_out) { + + if (kaon_out || pion_out) { // (kaon_in and pion_in double recoveredJetpT = bestJetpT + missing_pt; if (cfgJetdRHistos) { if (bestJetpT > 6.0 && bestJetpT < 8.0) { - histos.fill(HIST("normalJetpT_6_8_kstarSpectra"), lResonance.Pt()); 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); - histos.fill(HIST("recoveredJetpT_6_8to8_10_kstarSpectra"), lResonance.Pt()); + histos.fill(HIST("recoveredJetpT_6_8to8"), recoveredJetpT); + histos.fill(HIST("Kstar_pT_6_8to8_IN_recoveredJet"), lResonance.Pt()); + if (!kaon_out) + histos.fill(HIST("Daughter_pT_8_IN_recoveredJet"), kaon_pt); + if (!pion_out) + histos.fill(HIST("Daughter_pT_8_IN_recoveredJet"), pion_pt); } - } + + if (recoveredJetpT > 8.0 && recoveredJetpT < 10.0){ + histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); + if (!kaon_out) + histos.fill(HIST("Daughter_pT_8_10_IN_recoveredJet"), kaon_pt); + if (!pion_out) + histos.fill(HIST("Daughter_pT_8_10_IN_recoveredJet"), pion_pt); + } + } // 6 < bestJetpT < 8 GeV/c if (bestJetpT > 8.0 && bestJetpT < 10.0) { histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_8_10_kstarSpectra"), lResonance.Pt()); - } + if (!kaon_out) + histos.fill(HIST("Daughter_pT_8_10_INJet"), kaon_pt); + if (!pion_out) + histos.fill(HIST("Daughter_pT_8_10_INJet"), pion_pt); + } // 8 < bestJetpT < 10 GeV/c + if (bestJetpT > 10.0 && bestJetpT < 12.0) { histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_10_12_kstarSpectra"), lResonance.Pt()); - } - if (bestJetpT > 12.0 && bestJetpT < 15.0) + if (!kaon_out) + histos.fill(HIST("Daughter_pT_10_12_INJet"), kaon_pt); + if (!pion_out) + histos.fill(HIST("Daughter_pT_10_12_INJet"), pion_pt); + } // 10 < bestJetpT < 12 GeV/c + + if (bestJetpT > 12.0 && bestJetpT < 15.0){ histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); + if (!kaon_out) + histos.fill(HIST("Daughter_pT_12_15_INJet"), kaon_pt); + if (!pion_out) + histos.fill(HIST("Daughter_pT_12_15_INJet"), pion_pt); + } // 12 < bestJetpT < 15 GeV/c + 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) { + if (bestJetpT > 8.0) histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - histos.fill(HIST("normalJetpT_8_kstarSpectra"), lResonance.Pt()); - } + histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); } // cfgJetdRHistos } // kaon_out || pion_out From 363d647777f0b65873c0db14b2a29efad3bc7373 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Sun, 2 Aug 2026 21:30:48 +0900 Subject: [PATCH 24/34] [PWGLF] Added the Mis-IDentified PID cut --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 579 ++++++++++++--------------- 1 file changed, 248 insertions(+), 331 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index b1d5a618c94..123d67b8a55 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -134,7 +134,8 @@ struct kstarInOO { Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; Configurable cfgJetQAHistos{"cfgJetQAHistos", false, "Enable Jet QA Histos"}; - Configurable cfgMCHistos{"cfgMCHistos", false, "Enable MC Hists"}; + + Configurable cfgMCHistos{"cfgMCHistos", false, "Enable MC Histos"}; Configurable cfgMixedHistos{"cfgMixedHistos", false, "Enable Mixed Histos"}; Configurable cfgJetHistos{"cfgJetHistos", false, "Enable Jet Histos"}; Configurable cfgJetMCHistos{"cfgJetMCHistos", false, "Enable Jet MC Histos"}; @@ -159,9 +160,6 @@ 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; @@ -261,29 +259,28 @@ struct kstarInOO { 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("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("nJet_6_8", "MC particle-level nJet pT 6 < jet pT < 8 (GeV/c)", kTH1F, {{2000, 0., 100.}}); + + histos.add("Gen_KstarPt_All_BR", "Generated K*0 All pT (GeV/c)", kTH1F, {{2000, 0., 100.}}); + histos.add("Gen_Kstar_BR", "Generated K*0 BR", kTH1F, {minvAxis}); + histos.add("Gen_KstarPt_BR", "Generated K*0 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_6_8", "dR between tagged jet and kpi 6 < jet pT < 8", {HistType::kTH2F, {{60, 0., 1.5}, {100, 0., 20.}}}); + histos.add("dR_taggedjet_kaon", "dR between tagged jet and kaon wo pT cut", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); + histos.add("dR_taggedjet_pion", "dR between tagged jet and pion wo pT cut", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); + histos.add("dR_taggedjet_all", "dR between tagged jet and kpi", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); + histos.add("dR_taggedjet_all_6_8", "dR between tagged jet and kpi 6 < jet pT < 8", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); + histos.add("dR_kstar_pion", "dR between kstar and pion", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); + histos.add("dR_kstar_kaon", "dR between kstar and kaon", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); + histos.add("Kstar_pT_INJet_6_8", "K*0 pT Inside 6-8 Jet", kTH1F, {{1000, 0., 50.}}); histos.add("Kstar_pT_INJet_8_10", "K*0 pT Inside 8-10 Jet", kTH1F, {{1000, 0., 50.}}); histos.add("Kstar_pT_INJet_10_12", "K*0 pT Inside 10-12 Jet", kTH1F, {{1000, 0., 50.}}); - histos.add("Kstar_pT_INJet_12_15", "K*0 pT Inside 12-15 Jet", kTH1F, {{1000, 0., 50.}}); - + + histos.add("JetpT_8to", "Jet pT 8 to", kTH1F, {{2000, 0., 100.}}); histos.add("recoveredJetpT_6_8to8", "Recovered Jet pT 6-8 --> 8", kTH1F, {{2000, 0., 100.}}); histos.add("Kstar_pT_6_8to8_IN_recoveredJet", "K*0 pT In recovered Jet pT 6-8 --> 8", kTH1F, {{1000, 0., 50.}}); histos.add("Kstar_pT_6_8to8_10_IN_recoveredJet", "K*0 pT In recovered Jet pT 6-8 --> 8-10", kTH1F, {{1000, 0., 50.}}); - - histos.add("Daughter_pT_8_IN_recoveredJet", "Daughters pT In recovered Jet 8-infinite", kTH1F, {{1000, 0., 50.}}); - histos.add("Daughter_pT_8_10_IN_recoveredJet", "Daughters pT In recovered Jet 8-10", kTH1F, {{1000, 0., 50.}}); - histos.add("Daughter_pT_8_10_INJet", "Daughters pT In Jet 8-10", kTH1F, {{1000, 0., 50.}}); - histos.add("Daughter_pT_10_12_INJet", "Daughters pT In Jet 10-12", kTH1F, {{1000, 0., 50.}}); - histos.add("Daughter_pT_12_15_INJet", "Daughters pT In Jet 12-15", kTH1F, {{1000, 0., 50.}}); 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.}}}); @@ -299,11 +296,11 @@ struct kstarInOO { //////////////////////////////////// histos.add("nEvents", "nEvents", kTH1F, {{7, 0.0, 7.0}}); histos.add("hUSS_KPi", "hUSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hUSS_PiK", "hUSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hLSS_KPi", "hLSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_PiK", "hUSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - - if (cfgMixedHistos) { + + if (cfgMixedHistos) { histos.add("hUSS_KPi_Mix", "hUSS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_PiK_Mix", "hUSS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } @@ -359,9 +356,9 @@ struct kstarInOO { using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As using EventCandidatesTrue = aod::McCollisions; using TrackCandidates = soa::Join; + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>; using TrackCandidatesMC = soa::Join; + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>; //================= //|| Jet Analysis @@ -463,71 +460,60 @@ struct kstarInOO { } // pion pid Selection } // fill QA - enum class objectType { MB, + enum class objectType { Inclusive, Jets, - MBRecParticle, - JetsRecParticle }; + RecoParticle, + JetsRecoParticle }; template - void fillMinv(objectType type, const TrackType& trk1, const TrackType& trk2, const ROOT::Math::PxPyPzMVector& lReso, double centrality, double jetpt, bool IsMix, bool flip) + void fillMinv(objectType type, const TrackType& trk1, const TrackType& trk2, const ROOT::Math::PxPyPzMVector& lReso, double centrality, double jetpt, bool flip) { double conjugate = trk1.sign() * trk2.sign(); switch (type) { - case objectType::MB: - if (IsMix && cfgMixedHistos) { - if (conjugate < 0) { - if (!flip) - histos.fill(HIST("hUSS_KPi_Mix"), centrality, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hUSS_PiK_Mix"), centrality, lReso.Pt(), lReso.M()); - } - } else { - if (conjugate < 0) { - if (!flip) - histos.fill(HIST("hUSS_KPi"), centrality, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hUSS_PiK"), centrality, lReso.Pt(), lReso.M()); - } else if (conjugate > 0) { - if (!flip) - histos.fill(HIST("hLSS_KPi"), centrality, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hLSS_PiK"), centrality, lReso.Pt(), lReso.M()); - } - } - break; - - case objectType::Jets: - if (!IsMix && cfgJetHistos) { - if (conjugate < 0) { - if (!flip) - histos.fill(HIST("hUSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hUSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - } else { - if (conjugate > 0) { - if (!flip) - histos.fill(HIST("hLSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hLSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - } - } - } - break; + case objectType::Inclusive: + if (conjugate < 0) { + if (!flip) + histos.fill(HIST("hUSS_KPi"), centrality, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hUSS_PiK"), centrality, lReso.Pt(), lReso.M()); + } else if (conjugate > 0) { + if (!flip) + histos.fill(HIST("hLSS_KPi"), centrality, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hLSS_PiK"), centrality, lReso.Pt(), lReso.M()); + } + break; + + case objectType::Jets: + if (cfgJetHistos) { + if (conjugate < 0) { + if (!flip) + histos.fill(HIST("hUSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hUSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } else if (conjugate > 0) { + if (!flip) + histos.fill(HIST("hLSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hLSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } + } + break; - case objectType::MBRecParticle: - if (cfgMCHistos) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec"), centrality, lReso.Pt(), lReso.M()); - } - } - break; + case objectType::RecoParticle: + if (cfgMCHistos) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec"), centrality, lReso.Pt(), lReso.M()); + } + } + break; - case objectType::JetsRecParticle: - if (cfgJetMCHistos) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - } - } - break; + case objectType::JetsRecoParticle: + if (cfgJetMCHistos) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } + } + break; } // switch } // fillMinv //====================================================================== @@ -575,7 +561,7 @@ struct kstarInOO { if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 7); } - if (!event.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) + if (!event.selection_bit(aod::evsel::kIsGoodITSLayersAll)) return {false, 8}; if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 8); @@ -648,21 +634,20 @@ struct kstarInOO { }; template - bool isMIDPion(const TrackPID& candidate) + bool isMIDPion(const TrackPID& candidate, const bool QA) { - if (cfgTrackCutQA) + if (cfgTrackCutQA && QA) histos.fill(HIST("Possible_MID_Pion_TPC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); - return std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig && std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig; + return std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig && std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig; } template - bool isMIDKaon(const TrackPID& candidate) + bool isMIDKaon(const TrackPID& candidate, const bool QA) { - if (cfgTrackCutQA) + if (cfgTrackCutQA && QA) histos.fill(HIST("Possible_MID_Kaon_TPC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); - return std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig && std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig; + return std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig && std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig; } - template bool trackPIDKaon(const TrackPID& candidate, const bool QA) @@ -712,8 +697,8 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA && QA) - fillQA(true, candidate, 3); + // if (cfgTrackCutQA && QA) + // fillQA(true, candidate, 3); return true; } return false; @@ -767,8 +752,8 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { - if (cfgTrackCutQA && QA) - fillQA(true, candidate, 4); + // if (cfgTrackCutQA && QA) + // fillQA(true, candidate, 4); return true; } return false; @@ -781,13 +766,20 @@ struct kstarInOO { return {}; if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) return {}; - if (isMIDCut && isMIDPion(trk1)) + if (trk1.globalIndex() >= trk2.globalIndex()) return {}; - if (isMIDCut && isMIDKaon(trk2)) + + if (isMIDCut && isMIDPion(trk1, QA)) return {}; - - if (trk1.globalIndex() >= trk2.globalIndex()) + + if (isMIDCut && isMIDKaon(trk2, QA)) return {}; + + + if (cfgTrackCutQA && QA){ + fillQA(true, trk1, 3); + fillQA(true, trk2, 4); + } ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance; if (!flip) { @@ -817,7 +809,6 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) return {}; - if (std::abs(particle1.eta()) > cfgTrackMaxEta || std::abs(particle2.eta()) > cfgTrackMaxEta) return {}; @@ -878,7 +869,7 @@ struct kstarInOO { } // TrueReconstruction template - void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA) + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA) { auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); @@ -890,13 +881,13 @@ struct kstarInOO { if (lReso.M() < 0) continue; - fillMinv(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + fillMinv(objectType::Inclusive, trk1, trk2, lReso, centrality, -1.0, flip); } // flip } // for } // TrackSlicing template - void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA) + void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA) { auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); @@ -911,14 +902,14 @@ struct kstarInOO { if (lReso.M() < 0) continue; - fillMinv(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + fillMinv(objectType::Inclusive, trk1, trk2, lReso, centrality, -1.0, flip); } // flip //============================ //| True Reconstruction //============================ auto lTrueReso = TrueReconstruction(trk1, trk2); - fillMinv(objectType::MBRecParticle, trk1, trk2, lTrueReso, centrality, -1.0, IsMix, false); + fillMinv(objectType::RecoParticle, trk1, trk2, lTrueReso, centrality, -1.0, false); } // tracks } // TrackSlicingMC @@ -946,7 +937,7 @@ struct kstarInOO { } template - void JetTrackSlicing(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA) + void JetTrackSlicing(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool QA) { //============= //| Inclusive @@ -961,7 +952,7 @@ struct kstarInOO { if (lResonance.M() < 0) continue; - fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); + fillMinv(objectType::Inclusive, trk1, trk2, lResonance, centrality, -1.0, flip); //======== //| Jets @@ -992,14 +983,14 @@ struct kstarInOO { } if (jetFlag) { - fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); + fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, flip); } // jetFlag } // flip } // jetTracks } // JetTrackSlicing template - void JetTrackSlicingMC(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& mcdjets, const bool IsMix, const bool QA) + void JetTrackSlicingMC(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& mcdjets, const bool QA) { //============================ //| MB: Track Reconstruction @@ -1017,7 +1008,7 @@ struct kstarInOO { if (lResonance.M() < 0) continue; - fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); + fillMinv(objectType::Inclusive, trk1, trk2, lResonance, centrality, -1.0, flip); //============================== //| Jets: Track Reconstruction //============================== @@ -1044,7 +1035,7 @@ struct kstarInOO { } if (jetFlag) { - fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); + fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, flip); } // jetFlag } // filp } // Tracks loop @@ -1080,6 +1071,7 @@ struct kstarInOO { histos.fill(HIST("nEvents"), 1.5); // INEL>0 event auto [goodEv, code] = JetEventSelection(collision, true); + // auto [goodEv, code] = eventSelection(collision, true); if (!goodEv) return; histos.fill(HIST("nEvents"), 2.5); // After selection @@ -1128,7 +1120,7 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto chargedjet : chargedjets) { - if (std::abs(chargedjet.eta()) > cfgJetMaxEta - cfgJetdR) + if (std::abs(chargedjet.eta()) > (cfgJetMaxEta - cfgJetdR)) continue; nJets++; @@ -1165,7 +1157,7 @@ struct kstarInOO { } } // jetTrack loop - JetTrackSlicing(collision, jetTracks, chargedjets, false, true); + JetTrackSlicing(collision, jetTracks, chargedjets, true); } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1232,7 +1224,7 @@ struct kstarInOO { } histos.fill(HIST("nEvents"), 3.5); // Jet event - // JetTrackSlicingMC(collision, jetTracks, mcdjets, false, true); + // JetTrackSlicingMC(collision, jetTracks, mcdjets, 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,8 +1371,7 @@ struct kstarInOO { continue; } - TrackSlicing(collision, tracks, collision, tracks, false, true); - + TrackSlicing(collision, tracks, collision, tracks, true); } // processSameEvents PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false); @@ -1418,7 +1409,7 @@ struct kstarInOO { if (!VtxMixFlag) continue; - TrackSlicing(collision1, tracks1, collision2, tracks2, true, false); + TrackSlicing(collision1, tracks1, collision2, tracks2, false); } } PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false); @@ -1463,7 +1454,7 @@ struct kstarInOO { continue; } - TrackSlicingMC(collision, tracks, collision, tracks, false, true); + TrackSlicingMC(collision, tracks, collision, tracks, true); } // processSameEvents_MC PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", false); @@ -1489,7 +1480,7 @@ struct kstarInOO { if (!goodEv1 || !goodEv2) continue; - TrackSlicingMC(collision1, tracks1, collision2, tracks2, true, false); + TrackSlicingMC(collision1, tracks1, collision2, tracks2, false); } // mixing } // processMixedEvent_MC PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false); @@ -1659,24 +1650,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) @@ -1706,7 +1697,6 @@ struct kstarInOO { } // Selection event through mcpjet loop if (!INELgt0) return; - if (std::abs(collision.posZ()) > cfgEventVtxCut) return; histos.fill(HIST("nEvents"), 0.5); @@ -1716,241 +1706,168 @@ struct kstarInOO { continue; if (!mcParticle.has_daughters()) continue; - - 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) + if (std::abs(mcParticle.pdgCode()) != Kstar0PDG) continue; if (cfgJetdRHistos) - histos.fill(HIST("Gen_particle_All_BR"), mcParticle.pt()); + histos.fill(HIST("Gen_KstarPt_All_BR"), mcParticle.pt()); + // 4vector: K*0 + ROOT::Math::PxPyPzEVector lResonance = ROOT::Math::PxPyPzEVector(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); bool skip = false; int daughter_kaon = 0; int daughter_pion = 0; - if (!cfgIsKstar) { - for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) != KaonPDG) - skip = true; - } - } else { - for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) == KaonPDG) - ++daughter_kaon; - else if (std::abs(daughter.pdgCode()) == PionPDG) - ++daughter_pion; - } - if (daughter_kaon != 1 || daughter_pion != 1) - skip = true; - } // K*(892) - - if (skip && cfgBR) + for (auto& daughter : mcParticle.daughters_as()) { + if (std::abs(daughter.pdgCode()) == KaonPDG) + ++daughter_kaon; + else if (std::abs(daughter.pdgCode()) == PionPDG) + ++daughter_pion; + } + if (daughter_kaon != 1 || daughter_pion != 1) + skip = true; + if (skip) continue; - + if (cfgJetdRHistos) { - histos.fill(HIST("Gen_particle_BR"), lResonance.M()); - histos.fill(HIST("Gen_particle_pT"), mcParticle.pt()); + histos.fill(HIST("Gen_Kstar_BR"), lResonance.M()); + histos.fill(HIST("Gen_KstarPt_BR"), mcParticle.pt()); } //================== // Distinguish Jets - double bestR = 999; - double bestJetpT = 0; - double bestJetPhi = 0; - double bestJetEta = 0; + double bestR = 999; + ROOT::Math::PxPyPzEVector bestJet; + 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 dR = TMath::Sqrt((dphi * dphi) + (deta * deta)); - - ROOT::Math::PxPyPzEVector MCPJet; - MCPJet = ROOT::Math::PxPyPzEVector(mcpjet.px(), mcpjet.py(), mcpjet.pz(), mcpjet.energy()); if (dR < bestR) { bestR = dR; - bestJetpT = MCPJet.Pt(); - bestJetPhi = mcpjet.phi(); - bestJetEta = mcpjet.eta(); - } + bestJet = ROOT::Math::PxPyPzEVector(mcpjet.px(), mcpjet.py(), mcpjet.pz(), mcpjet.energy()); + } //bestR } // mcpJets if (bestR > cfgJetdR) continue; + + if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0){ + if (cfgJetdRHistos) + histos.fill(HIST("nJet_6_8"), bestJet.Pt()); + } //================== // daughters - double missing_pt = 0; - - double kaon_pt = 0; - double pion_pt = 0; - - double dR_kaon, dR_pion; - bool kaon_out = false; - bool pion_out = false; + double dR_kaon, dR_pion, dR_k_kstar, dR_pi_kstar; + bool isKaonInJet = false; + bool isPionInJet = false; + ROOT::Math::PxPyPzEVector Daughter, missing_daughter; + for (auto& daughter : mcParticle.daughters_as()) { - ROOT::Math::PxPyPzEVector Daughter; - Daughter = ROOT::Math::PxPyPzEVector(daughter.px(), daughter.py(), daughter.pz(), daughter.energy()); - - if (cfgIsKstar) { - if (std::abs(daughter.pdgCode()) == KaonPDG) { - 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 < cfgJetdR) { - if (cfgJetdRHistos) { - histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); - - kaon_pt += Daughter.pt(); - if (bestJetpT > 6.0 && bestJetpT < 8.0){ - histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); - } - if (bestJetpT > 8.0 && bestJetpT < 10.0) - histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); - if (bestJetpT > 10.0 && bestJetpT < 12.0) - histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - if (bestJetpT > 12.0 && bestJetpT < 15.0) - histos.fill(HIST("Kstar_pT_INJet_12_15"), lResonance.Pt()); - } - if (dR_kaon > cfgJetdR) { - kaon_out = true; - missing_pt += Daughter.Pt(); - kaon_pt += Daughter.Pt(); - } - } // INSIDE Jets - } // kaon daughter - if (std::abs(daughter.pdgCode()) == PionPDG) { - 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 < cfgJetdR) { - if (cfgJetdRHistos) { - histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); - - pion_pt += daughter.pt(); - if (bestJetpT > 6.0 && bestJetpT < 8.0){ - histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); - histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); - } - if (bestJetpT > 8.0 && bestJetpT < 10.0) - histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); - if (bestJetpT > 10.0 && bestJetpT < 12.0) - histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - if (bestJetpT > 12.0 && bestJetpT < 15.0) - histos.fill(HIST("Kstar_pT_INJet_12_15"), lResonance.Pt()); - } - if (dR_pion > cfgJetdR) { - pion_out = true; - missing_pt += Daughter.pt(); - pion_pt += Daughter.pt(); - } - } // INSIDE Jets - } // pion daughter - } else { - if (std::abs(daughter.pdgCode()) == KaonPDG) { - 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 < cfgJetdR) { - 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 > cfgJetdR) { - kaon_out = true; - missing_pt = Daughter.pt(); - } - } // IN Jet - } // kaon daughter - } // phi(1020) + Daughter = ROOT::Math::PxPyPzEVector(daughter.px(), daughter.py(), daughter.pz(), daughter.energy()); + + if (std::abs(daughter.pdgCode()) == KaonPDG){ + //=============== + // K*0 and kaon + double dphi_k_kstar = TVector2::Phi_mpi_pi(lResonance.Phi() - Daughter.Phi()); + double deta_k_kstar = lResonance.Eta() - Daughter.Eta(); + dR_k_kstar = TMath::Sqrt((dphi_k_kstar * dphi_k_kstar) + (deta_k_kstar*deta_k_kstar)); + + // Jet and kaon + double dphi_kaon = TVector2::Phi_mpi_pi(bestJet.Phi() - Daughter.Phi()); + double deta_kaon = bestJet.Eta() - Daughter.Eta(); + dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); + + if (dR_kaon <= cfgJetdR) + isKaonInJet = true; + else + missing_daughter += Daughter; + + } else if (std::abs(daughter.pdgCode()) == PionPDG) { + //=============== + // K*0 and pion + double dphi_pi_kstar = TVector2::Phi_mpi_pi(lResonance.Phi() - Daughter.Phi()); + double deta_pi_kstar = lResonance.Eta() - Daughter.Eta(); + dR_pi_kstar = TMath::Sqrt((dphi_pi_kstar * dphi_pi_kstar) + (deta_pi_kstar*deta_pi_kstar)); + + // Jet and pion + double dphi_pion = TVector2::Phi_mpi_pi(bestJet.Phi() - Daughter.Phi()); + double deta_pion = bestJet.Eta() - Daughter.Eta(); + dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion)); + + if (dR_pion <= cfgJetdR) + isPionInJet = true; + else + missing_daughter += Daughter; + } } // daughter - - if (kaon_out || pion_out) { // (kaon_in and pion_in - 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"), recoveredJetpT); - histos.fill(HIST("Kstar_pT_6_8to8_IN_recoveredJet"), lResonance.Pt()); - if (!kaon_out) - histos.fill(HIST("Daughter_pT_8_IN_recoveredJet"), kaon_pt); - if (!pion_out) - histos.fill(HIST("Daughter_pT_8_IN_recoveredJet"), pion_pt); - } - - if (recoveredJetpT > 8.0 && recoveredJetpT < 10.0){ - histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); - if (!kaon_out) - histos.fill(HIST("Daughter_pT_8_10_IN_recoveredJet"), kaon_pt); - if (!pion_out) - histos.fill(HIST("Daughter_pT_8_10_IN_recoveredJet"), pion_pt); - } - } // 6 < bestJetpT < 8 GeV/c - - if (bestJetpT > 8.0 && bestJetpT < 10.0) { - histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (!kaon_out) - histos.fill(HIST("Daughter_pT_8_10_INJet"), kaon_pt); - if (!pion_out) - histos.fill(HIST("Daughter_pT_8_10_INJet"), pion_pt); - } // 8 < bestJetpT < 10 GeV/c + + if (cfgJetdRHistos){ + histos.fill(HIST("dR_kstar_kaon"), dR_k_kstar, lResonance.Pt()); + histos.fill(HIST("dR_kstar_pion"), dR_pi_kstar, lResonance.Pt()); + + if (bestR < cfgJetdR){ + histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); - if (bestJetpT > 10.0 && bestJetpT < 12.0) { - histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (!kaon_out) - histos.fill(HIST("Daughter_pT_10_12_INJet"), kaon_pt); - if (!pion_out) - histos.fill(HIST("Daughter_pT_10_12_INJet"), pion_pt); - } // 10 < bestJetpT < 12 GeV/c + histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); - if (bestJetpT > 12.0 && bestJetpT < 15.0){ - histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJetpT - missing_pt) / bestJetpT, lResonance.Pt()); - if (!kaon_out) - histos.fill(HIST("Daughter_pT_12_15_INJet"), kaon_pt); - if (!pion_out) - histos.fill(HIST("Daughter_pT_12_15_INJet"), pion_pt); - } // 12 < bestJetpT < 15 GeV/c + if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0){ + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); + histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); + } + if (bestJet.Pt() > 8.0) + histos.fill(HIST("JetpT_8to"), bestJet.Pt()); + if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) + histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); + if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) + histos.fill(HIST("Kstar_pT_INJet_10_12"), 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()); + if (!isKaonInJet || !isPionInJet) { + ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; + if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { + histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + + if (recoveredJet.Pt() > 8.0) { + histos.fill(HIST("recoveredJetpT_6_8to8"), recoveredJet.Pt()); + histos.fill(HIST("Kstar_pT_6_8to8_IN_recoveredJet"), lResonance.Pt()); + } + if (recoveredJet.Pt() > 8.0 && recoveredJet.Pt() < 10.0) + histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); + } // 6 < bestJetpT < 8 GeV/c + + if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) + histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) + histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 12.0 && bestJet.Pt() < 15.0) + histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 15.0 && bestJet.Pt() < 25.0) + histos.fill(HIST("missed_kpi_INJets_15_25"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 25.0) + histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + + if (bestJet.Pt() > 8.0) + histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - histos.fill(HIST("JetMigration"), bestJetpT, recoveredJetpT); - } // cfgJetdRHistos - } // kaon_out || pion_out + histos.fill(HIST("JetMigration"), bestJet.Pt(), recoveredJet.Pt()); + + } // Daughters out of jet + } // K*0 InJet + } //cfgJetdRHistos } // mcParticles }; - PROCESS_SWITCH(kstarInOO, processJetQA, "Process dR of K*0 Inclusive and Inside jet", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 53a2209dc889efdfff228357fab61c48da615847 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 18:29:14 +0900 Subject: [PATCH 25/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 447 +++++++++++++-------------- 1 file changed, 222 insertions(+), 225 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 123d67b8a55..584b2e71a10 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -108,7 +108,7 @@ struct kstarInOO { Configurable cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"}; Configurable cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"}; Configurable cfgMIDnSig{"cfgMIDnSig", 1.5, "nTPC Mis-IDentification Particle sigma"}; - + Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; // Mixing @@ -134,7 +134,6 @@ struct kstarInOO { Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; Configurable cfgJetQAHistos{"cfgJetQAHistos", false, "Enable Jet QA Histos"}; - Configurable cfgMCHistos{"cfgMCHistos", false, "Enable MC Histos"}; Configurable cfgMixedHistos{"cfgMixedHistos", false, "Enable Mixed Histos"}; Configurable cfgJetHistos{"cfgJetHistos", false, "Enable Jet Histos"}; @@ -219,10 +218,10 @@ struct kstarInOO { histos.add("QA_nSigma_kaon_TOF_BC", "QA_nSigma_kaon_TOF_BC", {HistType::kTH2F, {ptAxis, pidAxis}}); histos.add("QA_kaon_TPC_TOF_BC", "QA_kaon_TPC_TOF_BC", {HistType::kTH2F, {pidAxis, pidAxis}}); histos.add("QA_track_pT_BC", "QA_track_pT_BC", kTH1F, {{13, 0.0, 13.0}}); - + histos.add("Possible_MID_Pion_TPC", "Possible_MID_Pion_TPC", {HistType::kTH2F, {pidAxis, pidAxis}}); histos.add("Possible_MID_Kaon_TPC", "Possible_MID_Kaon_TPC", {HistType::kTH2F, {pidAxis, pidAxis}}); - + histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {axisDCAxy}); histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {axisDCAz}); histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}}); @@ -272,16 +271,16 @@ struct kstarInOO { histos.add("dR_kstar_pion", "dR between kstar and pion", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); histos.add("dR_kstar_kaon", "dR between kstar and kaon", {HistType::kTH2F, {{100, 0., 3.0}, {150, 0., 30.}}}); - + histos.add("Kstar_pT_INJet_6_8", "K*0 pT Inside 6-8 Jet", kTH1F, {{1000, 0., 50.}}); histos.add("Kstar_pT_INJet_8_10", "K*0 pT Inside 8-10 Jet", kTH1F, {{1000, 0., 50.}}); histos.add("Kstar_pT_INJet_10_12", "K*0 pT Inside 10-12 Jet", kTH1F, {{1000, 0., 50.}}); - + histos.add("JetpT_8to", "Jet pT 8 to", kTH1F, {{2000, 0., 100.}}); histos.add("recoveredJetpT_6_8to8", "Recovered Jet pT 6-8 --> 8", kTH1F, {{2000, 0., 100.}}); histos.add("Kstar_pT_6_8to8_IN_recoveredJet", "K*0 pT In recovered Jet pT 6-8 --> 8", kTH1F, {{1000, 0., 50.}}); histos.add("Kstar_pT_6_8to8_10_IN_recoveredJet", "K*0 pT In recovered Jet pT 6-8 --> 8-10", kTH1F, {{1000, 0., 50.}}); - + 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.}}}); @@ -299,8 +298,8 @@ struct kstarInOO { histos.add("hLSS_KPi", "hLSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_PiK", "hUSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - - if (cfgMixedHistos) { + + if (cfgMixedHistos) { histos.add("hUSS_KPi_Mix", "hUSS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_PiK_Mix", "hUSS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } @@ -356,9 +355,9 @@ struct kstarInOO { using EventCandidates = soa::Join; //, aod::CentFT0Ms, aod::CentFT0As using EventCandidatesTrue = aod::McCollisions; using TrackCandidates = soa::Join; + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>; using TrackCandidatesMC = soa::Join; + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>; //================= //|| Jet Analysis @@ -469,51 +468,51 @@ struct kstarInOO { { double conjugate = trk1.sign() * trk2.sign(); switch (type) { - case objectType::Inclusive: - if (conjugate < 0) { - if (!flip) - histos.fill(HIST("hUSS_KPi"), centrality, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hUSS_PiK"), centrality, lReso.Pt(), lReso.M()); - } else if (conjugate > 0) { - if (!flip) - histos.fill(HIST("hLSS_KPi"), centrality, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hLSS_PiK"), centrality, lReso.Pt(), lReso.M()); - } - break; - - case objectType::Jets: - if (cfgJetHistos) { - if (conjugate < 0) { - if (!flip) - histos.fill(HIST("hUSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hUSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - } else if (conjugate > 0) { - if (!flip) - histos.fill(HIST("hLSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - else - histos.fill(HIST("hLSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - } - } - break; + case objectType::Inclusive: + if (conjugate < 0) { + if (!flip) + histos.fill(HIST("hUSS_KPi"), centrality, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hUSS_PiK"), centrality, lReso.Pt(), lReso.M()); + } else if (conjugate > 0) { + if (!flip) + histos.fill(HIST("hLSS_KPi"), centrality, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hLSS_PiK"), centrality, lReso.Pt(), lReso.M()); + } + break; - case objectType::RecoParticle: - if (cfgMCHistos) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec"), centrality, lReso.Pt(), lReso.M()); - } - } - break; + case objectType::Jets: + if (cfgJetHistos) { + if (conjugate < 0) { + if (!flip) + histos.fill(HIST("hUSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hUSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } else if (conjugate > 0) { + if (!flip) + histos.fill(HIST("hLSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + else + histos.fill(HIST("hLSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } + } + break; - case objectType::JetsRecoParticle: - if (cfgJetMCHistos) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - } - } - break; + case objectType::RecoParticle: + if (cfgMCHistos) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec"), centrality, lReso.Pt(), lReso.M()); + } + } + break; + + case objectType::JetsRecoParticle: + if (cfgJetMCHistos) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } + } + break; } // switch } // fillMinv //====================================================================== @@ -566,7 +565,7 @@ struct kstarInOO { if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 8); } - + if (cfgEventCutQA && QA) { fillQA(true, event, 1); histos.fill(HIST("hEvent_Cut"), 9); @@ -632,7 +631,7 @@ struct kstarInOO { } return true; }; - + template bool isMIDPion(const TrackPID& candidate, const bool QA) { @@ -640,7 +639,7 @@ struct kstarInOO { histos.fill(HIST("Possible_MID_Pion_TPC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); return std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig && std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig; } - + template bool isMIDKaon(const TrackPID& candidate, const bool QA) { @@ -648,35 +647,35 @@ struct kstarInOO { histos.fill(HIST("Possible_MID_Kaon_TPC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); return std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig && std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig; } - + template bool trackPIDKaon(const TrackPID& candidate, const bool QA) { double tpcpid = 0; double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - + if (cfgTrackCutQA && QA) fillQA(false, candidate, 3); // TPC if (cfgTrackSquarePIDCut) { - if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig){ - tpcPIDPassed = true; - - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) { - tofPIDPassed = true; - } - } else { - if (!cfgTrackTOFHard) { - tofPIDPassed = true; - }else - tofPIDPassed = false; - } - } // TPCPID cut + if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) { + tpcPIDPassed = true; + + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) { + tofPIDPassed = true; + } + } else { + if (!cfgTrackTOFHard) { + tofPIDPassed = true; + } else + tofPIDPassed = false; + } + } // TPCPID cut } // end of square cut - + if (cfgTrackCirclePIDCut) { if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) tpcpid = std::abs(candidate.tpcNSigmaKa()); @@ -716,22 +715,22 @@ struct kstarInOO { // TPC if (cfgTrackSquarePIDCut) { - if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig){ - tpcPIDPassed = true; - - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) - tofPIDPassed = true; - } else { - if (!cfgTrackTOFHard) { - tofPIDPassed = true; - } else - tofPIDPassed = false; - } + if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) { + tpcPIDPassed = true; + + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) + tofPIDPassed = true; + } else { + if (!cfgTrackTOFHard) { + tofPIDPassed = true; + } else + tofPIDPassed = false; + } } // TPCPID cut - + } // end of square cut - + if (cfgTrackCirclePIDCut) { if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) tpcpid = std::abs(candidate.tpcNSigmaPi()); @@ -753,7 +752,7 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { // if (cfgTrackCutQA && QA) - // fillQA(true, candidate, 4); + // fillQA(true, candidate, 4); return true; } return false; @@ -771,12 +770,10 @@ struct kstarInOO { if (isMIDCut && isMIDPion(trk1, QA)) return {}; - if (isMIDCut && isMIDKaon(trk2, QA)) return {}; - - - if (cfgTrackCutQA && QA){ + + if (cfgTrackCutQA && QA) { fillQA(true, trk1, 3); fillQA(true, trk2, 4); } @@ -1122,7 +1119,7 @@ struct kstarInOO { for (auto chargedjet : chargedjets) { if (std::abs(chargedjet.eta()) > (cfgJetMaxEta - cfgJetdR)) continue; - + nJets++; if (cfgJetQAHistos) { histos.fill(HIST("JetpT"), chargedjet.pt()); @@ -1135,7 +1132,7 @@ struct kstarInOO { if (cfgJetQAHistos) { histos.fill(HIST("nJetsPerEvent"), nJets); } - + //==================== //| Has Jets //==================== @@ -1202,7 +1199,7 @@ struct kstarInOO { for (auto mcdjet : mcdjets) { if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) continue; - + nJets++; if (cfgJetQAHistos) { histos.fill(HIST("JetpT"), mcdjet.pt()); @@ -1211,10 +1208,10 @@ struct kstarInOO { } if (mcdjet.pt() > cfgJetpT) HasJets = true; - } //mcdjets + } // mcdjets if (cfgJetQAHistos) histos.fill(HIST("nJetsPerEvent"), nJets); - + //==================== //| Has Jets //==================== @@ -1273,7 +1270,7 @@ struct kstarInOO { } if (cfgJetMCHistos) histos.fill(HIST("hEffRecTest4_pT"), lResonanceTest1.Pt()); - + //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -1589,7 +1586,7 @@ struct kstarInOO { } if (cfgJetMCHistos) histos.fill(HIST("nEvents_Gen"), 0.5); - + //======================= //| Event & Signal loss //======================= @@ -1650,24 +1647,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) @@ -1712,23 +1709,23 @@ struct kstarInOO { if (cfgJetdRHistos) histos.fill(HIST("Gen_KstarPt_All_BR"), mcParticle.pt()); - // 4vector: K*0 + // 4vector: K*0 ROOT::Math::PxPyPzEVector lResonance = ROOT::Math::PxPyPzEVector(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); bool skip = false; int daughter_kaon = 0; int daughter_pion = 0; for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) == KaonPDG) - ++daughter_kaon; - else if (std::abs(daughter.pdgCode()) == PionPDG) - ++daughter_pion; + if (std::abs(daughter.pdgCode()) == KaonPDG) + ++daughter_kaon; + else if (std::abs(daughter.pdgCode()) == PionPDG) + ++daughter_pion; } if (daughter_kaon != 1 || daughter_pion != 1) - skip = true; + skip = true; if (skip) continue; - + if (cfgJetdRHistos) { histos.fill(HIST("Gen_Kstar_BR"), lResonance.M()); histos.fill(HIST("Gen_KstarPt_BR"), mcParticle.pt()); @@ -1736,35 +1733,35 @@ struct kstarInOO { //================== // Distinguish Jets - double bestR = 999; + double bestR = 999; ROOT::Math::PxPyPzEVector bestJet; - + 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 dR = TMath::Sqrt((dphi * dphi) + (deta * deta)); if (dR < bestR) { bestR = dR; - bestJet = ROOT::Math::PxPyPzEVector(mcpjet.px(), mcpjet.py(), mcpjet.pz(), mcpjet.energy()); - } //bestR + bestJet = ROOT::Math::PxPyPzEVector(mcpjet.px(), mcpjet.py(), mcpjet.pz(), mcpjet.energy()); + } // bestR } // mcpJets if (bestR > cfgJetdR) continue; - - if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0){ - if (cfgJetdRHistos) - histos.fill(HIST("nJet_6_8"), bestJet.Pt()); + + if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { + if (cfgJetdRHistos) + histos.fill(HIST("nJet_6_8"), bestJet.Pt()); } - + //================== // daughters double dR_kaon, dR_pion, dR_k_kstar, dR_pi_kstar; @@ -1775,97 +1772,97 @@ struct kstarInOO { for (auto& daughter : mcParticle.daughters_as()) { Daughter = ROOT::Math::PxPyPzEVector(daughter.px(), daughter.py(), daughter.pz(), daughter.energy()); - if (std::abs(daughter.pdgCode()) == KaonPDG){ - //=============== - // K*0 and kaon - double dphi_k_kstar = TVector2::Phi_mpi_pi(lResonance.Phi() - Daughter.Phi()); - double deta_k_kstar = lResonance.Eta() - Daughter.Eta(); - dR_k_kstar = TMath::Sqrt((dphi_k_kstar * dphi_k_kstar) + (deta_k_kstar*deta_k_kstar)); - - // Jet and kaon - double dphi_kaon = TVector2::Phi_mpi_pi(bestJet.Phi() - Daughter.Phi()); - double deta_kaon = bestJet.Eta() - Daughter.Eta(); - dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); - - if (dR_kaon <= cfgJetdR) - isKaonInJet = true; - else - missing_daughter += Daughter; - - } else if (std::abs(daughter.pdgCode()) == PionPDG) { - //=============== - // K*0 and pion - double dphi_pi_kstar = TVector2::Phi_mpi_pi(lResonance.Phi() - Daughter.Phi()); - double deta_pi_kstar = lResonance.Eta() - Daughter.Eta(); - dR_pi_kstar = TMath::Sqrt((dphi_pi_kstar * dphi_pi_kstar) + (deta_pi_kstar*deta_pi_kstar)); - - // Jet and pion - double dphi_pion = TVector2::Phi_mpi_pi(bestJet.Phi() - Daughter.Phi()); - double deta_pion = bestJet.Eta() - Daughter.Eta(); - dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion)); - - if (dR_pion <= cfgJetdR) - isPionInJet = true; - else - missing_daughter += Daughter; - } + if (std::abs(daughter.pdgCode()) == KaonPDG) { + //=============== + // K*0 and kaon + double dphi_k_kstar = TVector2::Phi_mpi_pi(lResonance.Phi() - Daughter.Phi()); + double deta_k_kstar = lResonance.Eta() - Daughter.Eta(); + dR_k_kstar = TMath::Sqrt((dphi_k_kstar * dphi_k_kstar) + (deta_k_kstar * deta_k_kstar)); + + // Jet and kaon + double dphi_kaon = TVector2::Phi_mpi_pi(bestJet.Phi() - Daughter.Phi()); + double deta_kaon = bestJet.Eta() - Daughter.Eta(); + dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); + + if (dR_kaon <= cfgJetdR) + isKaonInJet = true; + else + missing_daughter += Daughter; + + } else if (std::abs(daughter.pdgCode()) == PionPDG) { + //=============== + // K*0 and pion + double dphi_pi_kstar = TVector2::Phi_mpi_pi(lResonance.Phi() - Daughter.Phi()); + double deta_pi_kstar = lResonance.Eta() - Daughter.Eta(); + dR_pi_kstar = TMath::Sqrt((dphi_pi_kstar * dphi_pi_kstar) + (deta_pi_kstar * deta_pi_kstar)); + + // Jet and pion + double dphi_pion = TVector2::Phi_mpi_pi(bestJet.Phi() - Daughter.Phi()); + double deta_pion = bestJet.Eta() - Daughter.Eta(); + dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion)); + + if (dR_pion <= cfgJetdR) + isPionInJet = true; + else + missing_daughter += Daughter; + } } // daughter - if (cfgJetdRHistos){ - histos.fill(HIST("dR_kstar_kaon"), dR_k_kstar, lResonance.Pt()); - histos.fill(HIST("dR_kstar_pion"), dR_pi_kstar, lResonance.Pt()); - - if (bestR < cfgJetdR){ - histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); - - histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); - - if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0){ - histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); - histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); - } - if (bestJet.Pt() > 8.0) - histos.fill(HIST("JetpT_8to"), bestJet.Pt()); - if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) - histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); - if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) - histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - - if (!isKaonInJet || !isPionInJet) { - ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; - if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { - histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - - if (recoveredJet.Pt() > 8.0) { - histos.fill(HIST("recoveredJetpT_6_8to8"), recoveredJet.Pt()); - histos.fill(HIST("Kstar_pT_6_8to8_IN_recoveredJet"), lResonance.Pt()); - } - if (recoveredJet.Pt() > 8.0 && recoveredJet.Pt() < 10.0) - histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); - } // 6 < bestJetpT < 8 GeV/c - - if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) - histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) - histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 12.0 && bestJet.Pt() < 15.0) - histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 15.0 && bestJet.Pt() < 25.0) - histos.fill(HIST("missed_kpi_INJets_15_25"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 25.0) - histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - - if (bestJet.Pt() > 8.0) - histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - - histos.fill(HIST("JetMigration"), bestJet.Pt(), recoveredJet.Pt()); - - } // Daughters out of jet - } // K*0 InJet - } //cfgJetdRHistos + if (cfgJetdRHistos) { + histos.fill(HIST("dR_kstar_kaon"), dR_k_kstar, lResonance.Pt()); + histos.fill(HIST("dR_kstar_pion"), dR_pi_kstar, lResonance.Pt()); + + if (bestR < cfgJetdR) { + histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); + + histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); + + if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_kaon, lResonance.Pt()); + histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); + histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); + } + if (bestJet.Pt() > 8.0) + histos.fill(HIST("JetpT_8to"), bestJet.Pt()); + if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) + histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); + if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) + histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); + + if (!isKaonInJet || !isPionInJet) { + ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; + if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { + histos.fill(HIST("missed_kpi_INJets_6_8"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + + if (recoveredJet.Pt() > 8.0) { + histos.fill(HIST("recoveredJetpT_6_8to8"), recoveredJet.Pt()); + histos.fill(HIST("Kstar_pT_6_8to8_IN_recoveredJet"), lResonance.Pt()); + } + if (recoveredJet.Pt() > 8.0 && recoveredJet.Pt() < 10.0) + histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); + } // 6 < bestJetpT < 8 GeV/c + + if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) + histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) + histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 12.0 && bestJet.Pt() < 15.0) + histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 15.0 && bestJet.Pt() < 25.0) + histos.fill(HIST("missed_kpi_INJets_15_25"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + if (bestJet.Pt() > 25.0) + histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + + if (bestJet.Pt() > 8.0) + histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); + + histos.fill(HIST("JetMigration"), bestJet.Pt(), recoveredJet.Pt()); + + } // Daughters out of jet + } // K*0 InJet + } // cfgJetdRHistos } // mcParticles }; PROCESS_SWITCH(kstarInOO, processJetQA, "Process dR of K*0 Inclusive and Inside jet", false); From 1a29237fdb7da9b7ea5e56018e4674d079577c46 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 19:28:34 +0900 Subject: [PATCH 26/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 584b2e71a10..b7f6ae7343e 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1815,7 +1815,6 @@ struct kstarInOO { if (bestR < cfgJetdR) { histos.fill(HIST("dR_taggedjet_all"), dR_kaon, lResonance.Pt()); histos.fill(HIST("dR_taggedjet_all"), dR_pion, lResonance.Pt()); - histos.fill(HIST("dR_taggedjet_kaon"), dR_kaon, lResonance.Pt()); histos.fill(HIST("dR_taggedjet_pion"), dR_pion, lResonance.Pt()); @@ -1831,6 +1830,7 @@ struct kstarInOO { if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); + // Daughters out of jets if (!isKaonInJet || !isPionInJet) { ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { @@ -1843,7 +1843,6 @@ struct kstarInOO { if (recoveredJet.Pt() > 8.0 && recoveredJet.Pt() < 10.0) histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); } // 6 < bestJetpT < 8 GeV/c - if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) @@ -1859,7 +1858,6 @@ struct kstarInOO { histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); histos.fill(HIST("JetMigration"), bestJet.Pt(), recoveredJet.Pt()); - } // Daughters out of jet } // K*0 InJet } // cfgJetdRHistos From d8558f893e4318189edc74e4e59f274ebd702a3b Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 19:34:37 +0900 Subject: [PATCH 27/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index b7f6ae7343e..249a37605ad 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1764,7 +1764,10 @@ struct kstarInOO { //================== // daughters - double dR_kaon, dR_pion, dR_k_kstar, dR_pi_kstar; + double dR_kaon = 0; + double dR_pion = 0; + double dR_k_kstar = 0; + double dR_pi_kstar = 0; bool isKaonInJet = false; bool isPionInJet = false; ROOT::Math::PxPyPzEVector Daughter, missing_daughter; @@ -1830,7 +1833,7 @@ struct kstarInOO { if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - // Daughters out of jets + // Daughters out of jets if (!isKaonInJet || !isPionInJet) { ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { From 48e08911d24a4e35907e67e2bb9cd4cf6c2b0c2e Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 19:59:35 +0900 Subject: [PATCH 28/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 249a37605ad..54d26d8baf5 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1108,7 +1108,8 @@ struct kstarInOO { } if (!RT) { return; - } else if (RT && (VTtest1 || VTtest2 || VTtest3)) { + } + if (RT && (VTtest1 || VTtest2 || VTtest3)) { return; } } // Trigger cut @@ -1833,7 +1834,7 @@ struct kstarInOO { if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - // Daughters out of jets + // Daughters out of jets if (!isKaonInJet || !isPionInJet) { ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { From bf4f59d48895f387eae60586f552444a03549607 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 20:03:44 +0900 Subject: [PATCH 29/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 54d26d8baf5..dd844f50602 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -668,9 +668,9 @@ struct kstarInOO { tofPIDPassed = true; } } else { - if (!cfgTrackTOFHard) { + if (!cfgTrackTOFHard) tofPIDPassed = true; - } else + else tofPIDPassed = false; } } // TPCPID cut @@ -684,9 +684,8 @@ struct kstarInOO { if (candidate.hasTOF()) { tofpid = std::abs(candidate.tofNSigmaKa()); } else { - if (cfgTrackTOFHard) { + if (cfgTrackTOFHard) tofpid = 999; - } } if (tpcpid * tpcpid + tofpid * tofpid < cfgTrackCircleValue) { tpcPIDPassed = true; @@ -722,9 +721,9 @@ struct kstarInOO { if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) tofPIDPassed = true; } else { - if (!cfgTrackTOFHard) { + if (!cfgTrackTOFHard) tofPIDPassed = true; - } else + else tofPIDPassed = false; } } // TPCPID cut @@ -739,9 +738,8 @@ struct kstarInOO { if (candidate.hasTOF()) { tofpid = std::abs(candidate.tofNSigmaPi()); } else { - if (cfgTrackTOFHard) { + if (cfgTrackTOFHard) tofpid = 999; - } } if (tpcpid * tpcpid + tofpid * tofpid < cfgTrackCircleValue) { tpcPIDPassed = true; @@ -848,9 +846,8 @@ struct kstarInOO { track2_mass = massKa; } - if (track1_mass == track2_mass) { + if (track1_mass == track2_mass) return {}; - } ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso; lTrueDaughter1 = ROOT::Math::PxPyPzMVector(particle1.px(), particle1.py(), particle1.pz(), track1_mass); @@ -1834,7 +1831,7 @@ struct kstarInOO { if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - // Daughters out of jets + // Daughters out of jets if (!isKaonInJet || !isPionInJet) { ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { From dafb906b4b4735bb072704f133541e47963db061 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 20:28:57 +0900 Subject: [PATCH 30/34] added isMIDDaughters function --- 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 dd844f50602..d854aac0de3 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1106,7 +1106,7 @@ struct kstarInOO { if (!RT) { return; } - if (RT && (VTtest1 || VTtest2 || VTtest3)) { + if (VTtest1 || VTtest2 || VTtest3) { return; } } // Trigger cut @@ -1831,7 +1831,7 @@ struct kstarInOO { if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - // Daughters out of jets + // Daughters out of jets if (!isKaonInJet || !isPionInJet) { ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { From 0455d70e21c0fde699129d1d556877e21f526428 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Mon, 3 Aug 2026 20:30:37 +0900 Subject: [PATCH 31/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index d854aac0de3..086d0281a0d 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -1103,9 +1103,9 @@ struct kstarInOO { histos.fill(HIST("nTriggerQA"), 3.5); } } - if (!RT) { + if (!RT) return; - } + if (VTtest1 || VTtest2 || VTtest3) { return; } @@ -1831,7 +1831,7 @@ struct kstarInOO { if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); - // Daughters out of jets + // Daughters out of jets if (!isKaonInJet || !isPionInJet) { ROOT::Math::PxPyPzEVector recoveredJet = bestJet + missing_daughter; if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { From a693e8089bb3e68f1632d9cc342f5c1d83225f3e Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 4 Aug 2026 10:10:57 +0900 Subject: [PATCH 32/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 563 +++++++++++++++++---------- 1 file changed, 355 insertions(+), 208 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 086d0281a0d..0a8a0a329d8 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -470,30 +470,34 @@ struct kstarInOO { switch (type) { case objectType::Inclusive: if (conjugate < 0) { - if (!flip) + if (!flip) { histos.fill(HIST("hUSS_KPi"), centrality, lReso.Pt(), lReso.M()); - else + } else { histos.fill(HIST("hUSS_PiK"), centrality, lReso.Pt(), lReso.M()); + } } else if (conjugate > 0) { - if (!flip) + if (!flip) { histos.fill(HIST("hLSS_KPi"), centrality, lReso.Pt(), lReso.M()); - else + } else { histos.fill(HIST("hLSS_PiK"), centrality, lReso.Pt(), lReso.M()); + } } break; case objectType::Jets: if (cfgJetHistos) { if (conjugate < 0) { - if (!flip) + if (!flip) { histos.fill(HIST("hUSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - else + } else { histos.fill(HIST("hUSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } } else if (conjugate > 0) { - if (!flip) + if (!flip) { histos.fill(HIST("hLSS_KPi_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); - else + } else { histos.fill(HIST("hLSS_PiK_INSIDE"), centrality, jetpt, lReso.Pt(), lReso.M()); + } } } break; @@ -525,43 +529,51 @@ struct kstarInOO { histos.fill(HIST("hEvent_Cut"), 0); } - if (!event.sel8()) + if (!event.sel8()) { return {false, 1}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 1); } - if (std::abs(event.posZ()) > cfgEventVtxCut) + if (std::abs(event.posZ()) > cfgEventVtxCut) { return {false, 2}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 2); } - if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) + if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { return {false, 3}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 3); } - if (!event.selection_bit(aod::evsel::kNoSameBunchPileup)) + if (!event.selection_bit(aod::evsel::kNoSameBunchPileup)) { return {false, 4}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 4); } - if (!event.selection_bit(aod::evsel::kNoTimeFrameBorder)) + if (!event.selection_bit(aod::evsel::kNoTimeFrameBorder)) { return {false, 5}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 5); } - if (!event.selection_bit(aod::evsel::kNoITSROFrameBorder)) + if (!event.selection_bit(aod::evsel::kNoITSROFrameBorder)) { return {false, 6}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 6); } - if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) + if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) { return {false, 7}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 7); } - if (!event.selection_bit(aod::evsel::kIsGoodITSLayersAll)) + if (!event.selection_bit(aod::evsel::kIsGoodITSLayersAll)) { return {false, 8}; + } if (cfgEventCutQA && QA) { histos.fill(HIST("hEvent_Cut"), 8); } @@ -583,8 +595,9 @@ struct kstarInOO { if (!jetderiveddatautilities::selectCollision(event, eventSelectionBits)) { // sel8 return {false, 1}; } - if (std::abs(event.posZ()) > cfgEventVtxCut) + if (std::abs(event.posZ()) > cfgEventVtxCut) { return {false, 2}; + } if (cfgEventCutQA && QA) { fillQA(true, event, 1); @@ -599,32 +612,45 @@ struct kstarInOO { fillQA(false, track, 2); } - if (cfgTrackGlobalSel && !track.isGlobalTrack()) + if (cfgTrackGlobalSel && !track.isGlobalTrack()) { return false; - if (track.pt() < cfgTrackMinPt) + } + if (track.pt() < cfgTrackMinPt) { return false; - if (std::abs(track.eta()) > cfgTrackMaxEta) + } + if (std::abs(track.eta()) > cfgTrackMaxEta) { return false; - if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut) + } + if (std::abs(track.dcaXY()) > cfgTrackMaxDCArToPVcut) { return false; - if (std::abs(track.dcaZ()) > cfgTrackMaxDCAzToPVcut) + } + if (std::abs(track.dcaZ()) > cfgTrackMaxDCAzToPVcut) { return false; - if (cfgTrackPrimaryTrack && !track.isPrimaryTrack()) + } + if (cfgTrackPrimaryTrack && !track.isPrimaryTrack()) { return false; - if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + } + if (cfgTrackGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) { return false; - if (cfgTrackFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTrackFindableTPCClusters) + } + if (cfgTrackFindableTPCClusters > 0 && track.tpcNClsFindable() < cfgTrackFindableTPCClusters) { return false; - if (track.tpcNClsCrossedRows() < cfgTrackTPCCrossedRows) + } + if (track.tpcNClsCrossedRows() < cfgTrackTPCCrossedRows) { return false; - if (cfgTrackRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTrackRowsOverFindable) + } + if (cfgTrackRowsOverFindable > 0 && track.tpcCrossedRowsOverFindableCls() > cfgTrackRowsOverFindable) { return false; - if (track.tpcChi2NCl() > cfgTrackTPCChi2) + } + if (track.tpcChi2NCl() > cfgTrackTPCChi2) { return false; - if (track.itsChi2NCl() > cfgTrackITSChi2) + } + if (track.itsChi2NCl() > cfgTrackITSChi2) { return false; - if (cfgTrackConnectedToPV && !track.isPVContributor()) + } + if (cfgTrackConnectedToPV && !track.isPVContributor()) { return false; + } if (cfgTrackCutQA && QA) { fillQA(true, track, 2); @@ -635,16 +661,18 @@ struct kstarInOO { template bool isMIDPion(const TrackPID& candidate, const bool QA) { - if (cfgTrackCutQA && QA) + if (cfgTrackCutQA && QA) { histos.fill(HIST("Possible_MID_Pion_TPC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); + } return std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig && std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig; } template bool isMIDKaon(const TrackPID& candidate, const bool QA) { - if (cfgTrackCutQA && QA) + if (cfgTrackCutQA && QA) { histos.fill(HIST("Possible_MID_Kaon_TPC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); + } return std::abs(candidate.tpcNSigmaPi()) < cfgMIDnSig && std::abs(candidate.tpcNSigmaKa()) < cfgMIDnSig; } @@ -655,8 +683,9 @@ struct kstarInOO { double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (cfgTrackCutQA && QA) + if (cfgTrackCutQA && QA) { fillQA(false, candidate, 3); + } // TPC if (cfgTrackSquarePIDCut) { @@ -668,24 +697,27 @@ struct kstarInOO { tofPIDPassed = true; } } else { - if (!cfgTrackTOFHard) + if (!cfgTrackTOFHard) { tofPIDPassed = true; - else + } else { tofPIDPassed = false; + } } } // TPCPID cut } // end of square cut if (cfgTrackCirclePIDCut) { - if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) + if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) { tpcpid = std::abs(candidate.tpcNSigmaKa()); + } tofpid = 0; if (candidate.hasTOF()) { tofpid = std::abs(candidate.tofNSigmaKa()); } else { - if (cfgTrackTOFHard) + if (cfgTrackTOFHard) { tofpid = 999; + } } if (tpcpid * tpcpid + tofpid * tofpid < cfgTrackCircleValue) { tpcPIDPassed = true; @@ -718,28 +750,32 @@ struct kstarInOO { tpcPIDPassed = true; if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) + if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) { tofPIDPassed = true; + } } else { - if (!cfgTrackTOFHard) + if (!cfgTrackTOFHard) { tofPIDPassed = true; - else + } else { tofPIDPassed = false; + } } } // TPCPID cut } // end of square cut if (cfgTrackCirclePIDCut) { - if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) + if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) { tpcpid = std::abs(candidate.tpcNSigmaPi()); + } tofpid = 0; if (candidate.hasTOF()) { tofpid = std::abs(candidate.tofNSigmaPi()); } else { - if (cfgTrackTOFHard) + if (cfgTrackTOFHard) { tofpid = 999; + } } if (tpcpid * tpcpid + tofpid * tofpid < cfgTrackCircleValue) { tpcPIDPassed = true; @@ -759,17 +795,22 @@ struct kstarInOO { template ROOT::Math::PxPyPzMVector minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip) { - if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) + if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) { return {}; - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) + } + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) { return {}; - if (trk1.globalIndex() >= trk2.globalIndex()) + } + if (trk1.globalIndex() >= trk2.globalIndex()) { return {}; + } - if (isMIDCut && isMIDPion(trk1, QA)) + if (isMIDCut && isMIDPion(trk1, QA)) { return {}; - if (isMIDCut && isMIDKaon(trk2, QA)) + } + if (isMIDCut && isMIDKaon(trk2, QA)) { return {}; + } if (cfgTrackCutQA && QA) { fillQA(true, trk1, 3); @@ -786,8 +827,9 @@ struct kstarInOO { } lResonance = lDecayDaughter1 + lDecayDaughter2; - if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) + if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) { return {}; + } return {lResonance}; } // minvReconstruction @@ -796,16 +838,19 @@ struct kstarInOO { ROOT::Math::PxPyPzMVector TrueReconstruction(const TracksType& trk1, const TracksType& trk2) { double conjugate = trk1.sign() * trk2.sign(); - if (conjugate > 0) + if (conjugate > 0) { return {}; + } auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); - if (!particle1.has_mothers() || !particle2.has_mothers()) + if (!particle1.has_mothers() || !particle2.has_mothers()) { return {}; - if (std::abs(particle1.eta()) > cfgTrackMaxEta || std::abs(particle2.eta()) > cfgTrackMaxEta) + } + if (std::abs(particle1.eta()) > cfgTrackMaxEta || std::abs(particle2.eta()) > cfgTrackMaxEta) { return {}; + } std::vector mothers1{}; std::vector mothers1PDG{}; @@ -821,17 +866,21 @@ struct kstarInOO { mothers2PDG.push_back(particle2_mom.pdgCode()); } - if (mothers1PDG[0] != Kstar0PDG) + if (mothers1PDG[0] != Kstar0PDG) { return {}; // mother not K*0 - if (mothers2PDG[0] != Kstar0PDG) + } + if (mothers2PDG[0] != Kstar0PDG) { return {}; // mothers not K*0 - if (mothers1[0] != mothers2[0]) + } + if (mothers1[0] != mothers2[0]) { return {}; // Kaon and pion not from the same K*0 - - if (std::abs(particle1.pdgCode()) != PionPDG && std::abs(particle1.pdgCode()) != KaonPDG) + } + if (std::abs(particle1.pdgCode()) != PionPDG && std::abs(particle1.pdgCode()) != KaonPDG) { return {}; - if (std::abs(particle2.pdgCode()) != PionPDG && std::abs(particle2.pdgCode()) != KaonPDG) + } + if (std::abs(particle2.pdgCode()) != PionPDG && std::abs(particle2.pdgCode()) != KaonPDG) { return {}; + } double track1_mass, track2_mass; if (std::abs(particle1.pdgCode()) == PionPDG) { @@ -846,18 +895,21 @@ struct kstarInOO { track2_mass = massKa; } - if (track1_mass == track2_mass) + if (track1_mass == track2_mass) { return {}; + } ROOT::Math::PxPyPzMVector lTrueDaughter1, lTrueDaughter2, lTrueReso; 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) + if (lTrueReso.M() < 0) { return {}; - if (std::abs(lTrueReso.Eta()) > cfgTrackMaxEta) + } + if (std::abs(lTrueReso.Eta()) > cfgTrackMaxEta) { return {}; + } return {lTrueReso}; } // TrueReconstruction @@ -872,8 +924,9 @@ struct kstarInOO { for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { for (bool flip : {false, true}) { auto lReso = minvReconstruction(trk1, trk2, QA, flip); - if (lReso.M() < 0) + if (lReso.M() < 0) { continue; + } fillMinv(objectType::Inclusive, trk1, trk2, lReso, centrality, -1.0, flip); } // flip @@ -888,14 +941,15 @@ struct kstarInOO { auto centrality = collision1.centFT0C(); for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) { continue; + } for (bool flip : {false, true}) { auto lReso = minvReconstruction(trk1, trk2, QA, flip); - if (lReso.M() < 0) + if (lReso.M() < 0) { continue; - + } fillMinv(objectType::Inclusive, trk1, trk2, lReso, centrality, -1.0, flip); } // flip @@ -943,8 +997,9 @@ struct kstarInOO { for (bool flip : {false, true}) { auto lResonance = minvReconstruction(trk1, trk2, QA, flip); - if (lResonance.M() < 0) + if (lResonance.M() < 0) { continue; + } fillMinv(objectType::Inclusive, trk1, trk2, lResonance, centrality, -1.0, flip); @@ -994,13 +1049,15 @@ struct kstarInOO { auto trk1 = track1.template track_as(); auto trk2 = track2.template track_as(); - if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) { continue; + } for (bool flip : {false, true}) { auto lResonance = minvReconstruction(trk1, trk2, QA, flip); - if (lResonance.M() < 0) + if (lResonance.M() < 0) { continue; + } fillMinv(objectType::Inclusive, trk1, trk2, lResonance, centrality, -1.0, flip); //============================== @@ -1048,8 +1105,9 @@ struct kstarInOO { { if (cDebugLevel > 0) { nJetEvents++; - if ((nJetEvents + 1) % 10000 == 0) + if ((nJetEvents + 1) % 10000 == 0) { LOG(info) << "Processed Jet Data Events: " << nJetEvents; + } } histos.fill(HIST("nEvents"), 0.5); // Raw event @@ -1060,14 +1118,16 @@ struct kstarInOO { break; } } - if (!INELgt0) + if (!INELgt0) { return; + } histos.fill(HIST("nEvents"), 1.5); // INEL>0 event auto [goodEv, code] = JetEventSelection(collision, true); // auto [goodEv, code] = eventSelection(collision, true); - if (!goodEv) + if (!goodEv) { return; + } histos.fill(HIST("nEvents"), 2.5); // After selection // Trigger before we start jet finding @@ -1103,9 +1163,9 @@ struct kstarInOO { histos.fill(HIST("nTriggerQA"), 3.5); } } - if (!RT) + if (!RT) { return; - + } if (VTtest1 || VTtest2 || VTtest3) { return; } @@ -1115,8 +1175,9 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto chargedjet : chargedjets) { - if (std::abs(chargedjet.eta()) > (cfgJetMaxEta - cfgJetdR)) + if (std::abs(chargedjet.eta()) > (cfgJetMaxEta - cfgJetdR)) { continue; + } nJets++; if (cfgJetQAHistos) { @@ -1124,8 +1185,9 @@ struct kstarInOO { histos.fill(HIST("JetEta"), chargedjet.eta()); histos.fill(HIST("JetPhi"), chargedjet.phi()); } - if (chargedjet.pt() > cfgJetpT) + if (chargedjet.pt() > cfgJetpT) { HasJets = true; + } } if (cfgJetQAHistos) { histos.fill(HIST("nJetsPerEvent"), nJets); @@ -1135,16 +1197,18 @@ struct kstarInOO { //| Has Jets //==================== if (cfgReqJets) { - if (!HasJets) + if (!HasJets) { return; + } } histos.fill(HIST("nEvents"), 4.5); // Has jets // Just for checking track QA plot for (auto& jetTrack : jetTracks) { auto originTrack = jetTrack.track_as(); - if (!trackSelection(originTrack, true)) + if (!trackSelection(originTrack, true)) { continue; + } if (cfgJetQAHistos) { histos.fill(HIST("jetTrackEta"), jetTrack.eta()); @@ -1166,8 +1230,9 @@ struct kstarInOO { { if (cDebugLevel > 0) { nJetMCEvents++; - if ((nJetMCEvents + 1) % 10000 == 0) + if ((nJetMCEvents + 1) % 10000 == 0) { LOG(info) << "Processed Jet MC Events: " << nJetMCEvents; + } } histos.fill(HIST("nEvents"), 0.5); // Gen event @@ -1178,13 +1243,15 @@ struct kstarInOO { break; } } // jetTrack loop - if (!INELgt0) + if (!INELgt0) { return; + } histos.fill(HIST("nEvents"), 1.5); // INEL>0 event auto [goodEv, code] = JetEventSelection(collision, true); - if (!goodEv) + if (!goodEv) { return; + } histos.fill(HIST("nEvents"), 2.5); // Inclusive event // The trigger option doesn't work @@ -1195,8 +1262,9 @@ struct kstarInOO { bool HasJets = false; int nJets = 0; for (auto mcdjet : mcdjets) { - if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) + if (std::abs(mcdjet.eta()) > cfgJetMaxEta - cfgJetdR) { continue; + } nJets++; if (cfgJetQAHistos) { @@ -1204,18 +1272,20 @@ struct kstarInOO { histos.fill(HIST("JetEta"), mcdjet.eta()); histos.fill(HIST("JetPhi"), mcdjet.phi()); } - if (mcdjet.pt() > cfgJetpT) + if (mcdjet.pt() > cfgJetpT) { HasJets = true; + } } // mcdjets - if (cfgJetQAHistos) + if (cfgJetQAHistos) { histos.fill(HIST("nJetsPerEvent"), nJets); - + } //==================== //| Has Jets //==================== if (cfgReqJets) { - if (!HasJets) + if (!HasJets) { return; + } } histos.fill(HIST("nEvents"), 3.5); // Jet event @@ -1232,33 +1302,37 @@ struct kstarInOO { lDecayDaughterTest2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); lResonanceTest1 = lDecayDaughterTest1 + lDecayDaughterTest2; - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest0_pT"), lResonanceTest1.Pt()); + } - if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) { continue; - if (cfgJetMCHistos) + } + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest1_pT"), lResonanceTest1.Pt()); - + } ////////////////////////////// ////////////////////////////// if (cfgReqMcEffTrackQA) { // false, true - if (!trackSelection(trk1, true) || !trackSelection(trk2, false)) + if (!trackSelection(trk1, true) || !trackSelection(trk2, false)) { continue; + } } ////////////////////////////// ////////////////////////////// - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest2_pT"), lResonanceTest1.Pt()); - + } if (cfgReqMcEffPID) { // false, true - if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) + if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) { continue; + } } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest3_pT"), lResonanceTest1.Pt()); - + } auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); //////////////////////////////////////////////////////////////////////// @@ -1266,9 +1340,9 @@ struct kstarInOO { if (!particle1.has_mothers() || !particle2.has_mothers()) { continue; } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest4_pT"), lResonanceTest1.Pt()); - + } //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -1279,8 +1353,9 @@ struct kstarInOO { mothers1PDG.push_back(particle1_mom.pdgCode()); } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hMotherPdg1"), std::abs(mothers1PDG[0])); + } std::vector mothers2{}; std::vector mothers2PDG{}; @@ -1288,29 +1363,33 @@ struct kstarInOO { mothers2.push_back(particle2_mom.globalIndex()); mothers2PDG.push_back(particle2_mom.pdgCode()); } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hMotherPdg2"), std::abs(mothers2PDG[0])); - - if (mothers1[0] != mothers2[0]) + } + if (mothers1[0] != mothers2[0]) { continue; // Kaon and pion not from the same K*0 - - if (cfgJetMCHistos) + } + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt()); - - if (std::abs(particle1.pdgCode()) != KaonPDG) // kaon + } + // kaon + if (std::abs(particle1.pdgCode()) != KaonPDG) { continue; + } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt()); - - if (std::abs(particle2.pdgCode()) != PionPDG) // pion + } + // pion + if (std::abs(particle2.pdgCode()) != PionPDG) { continue; - - if (cfgJetMCHistos) + } + if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt()); - - if (std::abs(mothers1PDG[0]) != Kstar0PDG) + } + if (std::abs(mothers1PDG[0]) != Kstar0PDG) { continue; // mother not K*0 + } if (cfgJetMCHistos) { histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt()); if (lResonanceTest1.Pt() < 0.4) { @@ -1319,12 +1398,12 @@ struct kstarInOO { } } - if (std::abs(mothers2PDG[0]) != Kstar0PDG) + if (std::abs(mothers2PDG[0]) != Kstar0PDG) { continue; // mothers not K*0 - - if (cfgJetMCHistos) + } + if (cfgJetMCHistos) { histos.fill(HIST("hEffRec_pT"), lResonanceTest1.Pt()); - + } } // track loop } // process loop PROCESS_SWITCH(kstarInOO, processMCJets, "process MC Jets", false); @@ -1339,8 +1418,9 @@ struct kstarInOO { { if (cDebugLevel > 0) { nEvents++; - if ((nEvents + 1) % 10000 == 0) + if ((nEvents + 1) % 10000 == 0) { LOG(info) << "Processed Data Events: " << nEvents; + } } histos.fill(HIST("nEvents"), 0.5); @@ -1351,19 +1431,22 @@ struct kstarInOO { break; } } - if (!INELgt0) + if (!INELgt0) { return; + } histos.fill(HIST("nEvents"), 1.5); auto [goodEv, code] = eventSelection(collision, true); - if (!goodEv) + if (!goodEv) { return; + } histos.fill(HIST("nEvents"), 2.5); // for trackQA plot for (const auto& track : tracks) { - if (!trackSelection(track, true)) + if (!trackSelection(track, true)) { continue; + } } TrackSlicing(collision, tracks, collision, tracks, true); @@ -1384,25 +1467,31 @@ struct kstarInOO { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { nEventsMix++; - if ((nEventsMix + 1) % 10000 == 0) + if ((nEventsMix + 1) % 10000 == 0) { LOG(info) << "Processed DATA Mixed Events : " << nEventsMix; + } } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); bool VtxMixFlag = false; bool CentMixFlag = false; // bool OccupanacyMixFlag = false; - if (std::abs(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::abs(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) + if (!goodEv1 || !goodEv2) { continue; - if (!CentMixFlag) + } + if (!CentMixFlag) { continue; - if (!VtxMixFlag) + } + if (!VtxMixFlag) { continue; + } TrackSlicing(collision1, tracks1, collision2, tracks2, false); } @@ -1434,19 +1523,22 @@ struct kstarInOO { break; } } - if (!INELgt0) + if (!INELgt0) { return; + } histos.fill(HIST("nEvents"), 1.5); auto [goodEv, code] = eventSelection(collision, true); // sel8 & vtx - if (!goodEv) + if (!goodEv) { return; + } histos.fill(HIST("nEvents"), 2.5); // for trackQA plot for (const auto& track : tracks) { - if (!trackSelection(track, true)) + if (!trackSelection(track, true)) { continue; + } } TrackSlicingMC(collision, tracks, collision, tracks, true); @@ -1467,13 +1559,15 @@ struct kstarInOO { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { nEventsMCMix++; - if ((nEventsMCMix + 1) % 10000 == 0) + if ((nEventsMCMix + 1) % 10000 == 0) { LOG(info) << "Processed Mixed Events: " << nEventsMCMix; + } } auto [goodEv1, code1] = eventSelection(collision1, false); auto [goodEv2, code2] = eventSelection(collision2, false); - if (!goodEv1 || !goodEv2) + if (!goodEv1 || !goodEv2) { continue; + } TrackSlicingMC(collision1, tracks1, collision2, tracks2, false); } // mixing @@ -1490,47 +1584,56 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++nEventsGen; - if (nEventsGen % 10000 == 0) + if (nEventsGen % 10000 == 0) { LOG(info) << "Processed MC (GEN) Events: " << nEventsGen; + } } - if (cfgMCHistos) + if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); // Gen events - + } //======================= //| Event & Signal loss //======================= bool INELgt0 = false; for (auto& particle : mcParticles) { - if (std::abs(particle.eta()) > cfgEventMaxEta) + if (std::abs(particle.eta()) > cfgEventMaxEta) { continue; - if (particle.pt() <= 0.0) + } + if (particle.pt() <= 0.0) { continue; + } INELgt0 = true; break; } if (cfgForceTrueINELgt) { - if (!INELgt0) + if (!INELgt0) { return; + } } - if (cfgMCHistos) + if (cfgMCHistos) { histos.fill(HIST("nEvents_Gen"), 1.5); // INEL>0 Gen events & EL: denominator - - if (std::abs(collision.posZ()) > cfgEventVtxCut) + } + if (std::abs(collision.posZ()) > cfgEventVtxCut) { return; + } for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != Kstar0PDG) + if (std::abs(particle.pdgCode()) != Kstar0PDG) { continue; - if (std::abs(particle.eta()) > cfgTrackMaxEta) + } + if (std::abs(particle.eta()) > cfgTrackMaxEta) { continue; + } - if (cfgMCHistos) + if (cfgMCHistos) { histos.fill(HIST("hGen_pT_Kstar"), particle.pt()); // SL: denominator + } } // Gen colls if (recocolls.size() <= 0) { // not reconstructed - if (cfgForceGenReco) + if (cfgForceGenReco) { return; + } } //================= @@ -1540,31 +1643,37 @@ struct kstarInOO { bool hasGoodEv = false; for (auto& recocoll : recocolls) { // poorly reconstructed auto [goodEv, code] = eventSelection(recocoll, true); - if (recocoll.posZ() > cfgEventVtxCut) + if (recocoll.posZ() > cfgEventVtxCut) { goodEv = false; - if (!goodEv) + } + if (!goodEv) { continue; + } hasGoodEv = true; centrality = recocoll.centFT0C(); break; } // recocolls - if (!hasGoodEv) + 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()) != Kstar0PDG) + if (std::abs(particle.pdgCode()) != Kstar0PDG) { continue; // Not K*0 - if (std::abs(particle.eta()) > cfgTrackMaxEta) + } + if (std::abs(particle.eta()) > cfgTrackMaxEta) { continue; - if (particle.pt() < cfgTrackMinPt) + } + if (particle.pt() < cfgTrackMinPt) { continue; + } - if (cfgMCHistos) + if (cfgMCHistos) { 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); @@ -1579,46 +1688,55 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++nprocessGenEvents; - if (nprocessGenEvents % 10000 == 0) + if (nprocessGenEvents % 10000 == 0) { LOG(info) << "Processed MC (GEN) Events: " << nprocessGenEvents; + } } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 0.5); - + } //======================= //| Event & Signal loss //======================= bool INELgt0 = false; for (auto& particle : mcParticles) { - if (std::abs(particle.eta()) > cfgEventMaxEta) + if (std::abs(particle.eta()) > cfgEventMaxEta) { continue; - if (particle.pt() <= 0.0) + } + if (particle.pt() <= 0.0) { continue; + } INELgt0 = true; break; } if (cfgForceTrueINELgt) { - if (!INELgt0) + if (!INELgt0) { return; + } } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 1.5); // EL: denominator - - if (std::abs(collision.posZ()) > cfgEventVtxCut) + } + if (std::abs(collision.posZ()) > cfgEventVtxCut) { return; + } for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != Kstar0PDG) + if (std::abs(particle.pdgCode()) != Kstar0PDG) { continue; - if (std::abs(particle.eta()) > cfgTrackMaxEta) + } + if (std::abs(particle.eta()) > cfgTrackMaxEta) { continue; + } - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hGen_pT_Kstar"), particle.pt()); // SL: denominator + } } // Unreco. - if (recocolls.size() <= 0) // not reconstructed + if (recocolls.size() <= 0) { // not reconstructed return; + } //================= //| Efficiency //================= @@ -1627,22 +1745,28 @@ struct kstarInOO { if (goodEv) { goodEv = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); } - if (std::abs(recocoll.posZ()) > cfgEventVtxCut) + if (std::abs(recocoll.posZ()) > cfgEventVtxCut) { goodEv = false; + } - if (!goodEv) + if (!goodEv) { return; + } } // reco.coll - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_Gen"), 2.5); // EL: numerator + } for (auto& particle : mcParticles) { - if (std::abs(particle.pdgCode()) != Kstar0PDG) + if (std::abs(particle.pdgCode()) != Kstar0PDG) { continue; - if (std::abs(particle.eta()) > cfgTrackMaxEta) + } + if (std::abs(particle.eta()) > cfgTrackMaxEta) { continue; - if (particle.pt() < cfgTrackMinPt) + } + if (particle.pt() < cfgTrackMinPt) { continue; + } /* // Not Yet if (cfg_Force_BR) { @@ -1665,9 +1789,9 @@ struct kstarInOO { } // enforce BR restriction */ - if (cfgJetMCHistos) + if (cfgJetMCHistos) { histos.fill(HIST("hRec_pT_Kstar"), particle.pt()); // SL: numerator and eff: denominator - + } } // loop over particles } // end of process PROCESS_SWITCH(kstarInOO, processGenJets, "Process Generated Particles Inclusive&Jets", false); @@ -1677,36 +1801,44 @@ struct kstarInOO { { if (cDebugLevel > 0) { ++ndRtest; - if (ndRtest % 10000 == 0) + if (ndRtest % 10000 == 0) { LOG(info) << "Processed dR test: " << ndRtest; + } } bool INELgt0 = false; for (auto& mcpjet : mcpjets) { - if (std::abs(mcpjet.eta()) > cfgEventMaxEta) + if (std::abs(mcpjet.eta()) > cfgEventMaxEta) { continue; - if (mcpjet.pt() <= 0.0) + } + if (mcpjet.pt() <= 0.0) { continue; + } INELgt0 = true; break; } // Selection event through mcpjet loop - if (!INELgt0) + if (!INELgt0) { return; - if (std::abs(collision.posZ()) > cfgEventVtxCut) + } + if (std::abs(collision.posZ()) > cfgEventVtxCut) { return; + } histos.fill(HIST("nEvents"), 0.5); for (auto& mcParticle : mcParticles) { - if (std::abs(mcParticle.eta()) > cfgTrackMaxEta) + if (std::abs(mcParticle.eta()) > cfgTrackMaxEta) { continue; - if (!mcParticle.has_daughters()) + } + if (!mcParticle.has_daughters()) { continue; - if (std::abs(mcParticle.pdgCode()) != Kstar0PDG) + } + if (std::abs(mcParticle.pdgCode()) != Kstar0PDG) { continue; + } - if (cfgJetdRHistos) + if (cfgJetdRHistos) { histos.fill(HIST("Gen_KstarPt_All_BR"), mcParticle.pt()); - + } // 4vector: K*0 ROOT::Math::PxPyPzEVector lResonance = ROOT::Math::PxPyPzEVector(mcParticle.px(), mcParticle.py(), mcParticle.pz(), mcParticle.e()); bool skip = false; @@ -1714,15 +1846,18 @@ struct kstarInOO { int daughter_pion = 0; for (auto& daughter : mcParticle.daughters_as()) { - if (std::abs(daughter.pdgCode()) == KaonPDG) + if (std::abs(daughter.pdgCode()) == KaonPDG) { ++daughter_kaon; - else if (std::abs(daughter.pdgCode()) == PionPDG) + } else if (std::abs(daughter.pdgCode()) == PionPDG) { ++daughter_pion; + } } - if (daughter_kaon != 1 || daughter_pion != 1) + if (daughter_kaon != 1 || daughter_pion != 1) { skip = true; - if (skip) + } + if (skip) { continue; + } if (cfgJetdRHistos) { histos.fill(HIST("Gen_Kstar_BR"), lResonance.M()); @@ -1735,8 +1870,9 @@ struct kstarInOO { ROOT::Math::PxPyPzEVector bestJet; for (auto& mcpjet : mcpjets) { - if (mcpjet.pt() < cfgJetpT) + if (mcpjet.pt() < cfgJetpT) { continue; + } if (cfgJetdRHistos) { histos.fill(HIST("mcpjet_eta"), mcpjet.eta()); @@ -1752,12 +1888,14 @@ struct kstarInOO { bestJet = ROOT::Math::PxPyPzEVector(mcpjet.px(), mcpjet.py(), mcpjet.pz(), mcpjet.energy()); } // bestR } // mcpJets - if (bestR > cfgJetdR) + if (bestR > cfgJetdR) { continue; + } if (bestJet.Pt() > 6.0 && bestJet.Pt() < 8.0) { - if (cfgJetdRHistos) + if (cfgJetdRHistos) { histos.fill(HIST("nJet_6_8"), bestJet.Pt()); + } } //================== @@ -1785,11 +1923,11 @@ struct kstarInOO { double deta_kaon = bestJet.Eta() - Daughter.Eta(); dR_kaon = TMath::Sqrt((dphi_kaon * dphi_kaon) + (deta_kaon * deta_kaon)); - if (dR_kaon <= cfgJetdR) + if (dR_kaon <= cfgJetdR) { isKaonInJet = true; - else + } else { missing_daughter += Daughter; - + } } else if (std::abs(daughter.pdgCode()) == PionPDG) { //=============== // K*0 and pion @@ -1802,10 +1940,11 @@ struct kstarInOO { double deta_pion = bestJet.Eta() - Daughter.Eta(); dR_pion = TMath::Sqrt((dphi_pion * dphi_pion) + (deta_pion * deta_pion)); - if (dR_pion <= cfgJetdR) + if (dR_pion <= cfgJetdR) { isPionInJet = true; - else + } else { missing_daughter += Daughter; + } } } // daughter @@ -1824,12 +1963,15 @@ struct kstarInOO { histos.fill(HIST("dR_taggedjet_all_6_8"), dR_pion, lResonance.Pt()); histos.fill(HIST("Kstar_pT_INJet_6_8"), lResonance.Pt()); } - if (bestJet.Pt() > 8.0) + if (bestJet.Pt() > 8.0) { histos.fill(HIST("JetpT_8to"), bestJet.Pt()); - if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) + } + if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) { histos.fill(HIST("Kstar_pT_INJet_8_10"), lResonance.Pt()); - if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) + } + if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) { histos.fill(HIST("Kstar_pT_INJet_10_12"), lResonance.Pt()); + } // Daughters out of jets if (!isKaonInJet || !isPionInJet) { @@ -1841,23 +1983,28 @@ struct kstarInOO { histos.fill(HIST("recoveredJetpT_6_8to8"), recoveredJet.Pt()); histos.fill(HIST("Kstar_pT_6_8to8_IN_recoveredJet"), lResonance.Pt()); } - if (recoveredJet.Pt() > 8.0 && recoveredJet.Pt() < 10.0) + if (recoveredJet.Pt() > 8.0 && recoveredJet.Pt() < 10.0) { histos.fill(HIST("Kstar_pT_6_8to8_10_IN_recoveredJet"), lResonance.Pt()); + } } // 6 < bestJetpT < 8 GeV/c - if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) + if (bestJet.Pt() > 8.0 && bestJet.Pt() < 10.0) { histos.fill(HIST("missed_kpi_INJets_8_10"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) + } + if (bestJet.Pt() > 10.0 && bestJet.Pt() < 12.0) { histos.fill(HIST("missed_kpi_INJets_10_12"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 12.0 && bestJet.Pt() < 15.0) + } + if (bestJet.Pt() > 12.0 && bestJet.Pt() < 15.0) { histos.fill(HIST("missed_kpi_INJets_12_15"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 15.0 && bestJet.Pt() < 25.0) + } + if (bestJet.Pt() > 15.0 && bestJet.Pt() < 25.0) { histos.fill(HIST("missed_kpi_INJets_15_25"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - if (bestJet.Pt() > 25.0) + } + if (bestJet.Pt() > 25.0) { histos.fill(HIST("missed_kpi_INJets_25_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - - if (bestJet.Pt() > 8.0) + } + if (bestJet.Pt() > 8.0) { histos.fill(HIST("missed_kpi_INJets_8_infinite"), (bestJet.Pt() - missing_daughter.Pt()) / bestJet.Pt(), lResonance.Pt()); - + } histos.fill(HIST("JetMigration"), bestJet.Pt(), recoveredJet.Pt()); } // Daughters out of jet } // K*0 InJet From 65071bb757ed9d5dc0392a031f2130d7f2add002 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 4 Aug 2026 11:08:51 +0900 Subject: [PATCH 33/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 0a8a0a329d8..459bc4c49c9 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -50,12 +50,11 @@ #include #include #include +#include #include #include #include -#include - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -522,7 +521,7 @@ struct kstarInOO { //====================================================================== template - std::pair eventSelection(const EventType event, const bool QA) + std::pair eventSelection(const EventType& event, const bool QA) { if (cfgEventCutQA && QA) { fillQA(false, event, 1); @@ -586,7 +585,7 @@ struct kstarInOO { }; template - std::pair JetEventSelection(const EventType event, const bool QA) + std::pair JetEventSelection(const EventType& event, const bool QA) { if (cfgEventCutQA && QA) { fillQA(false, event, 1); @@ -606,7 +605,7 @@ struct kstarInOO { }; template - bool trackSelection(const TracksType track, const bool QA) + bool trackSelection(const TracksType& track, const bool QA) { if (cfgTrackCutQA && QA) { fillQA(false, track, 2); @@ -741,8 +740,9 @@ struct kstarInOO { double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - if (cfgTrackCutQA && QA) + if (cfgTrackCutQA && QA) { fillQA(false, candidate, 4); + } // TPC if (cfgTrackSquarePIDCut) { @@ -962,10 +962,11 @@ struct kstarInOO { } // TrackSlicingMC template - double DistinguishJets(const JetType& jets, ROOT::Math::PxPyPzMVector lResonance) + double DistinguishJets(const JetType& jets, ROOT::Math::PxPyPzMVector& lResonance) { - if (cDebugLevel > 0) + if (cDebugLevel > 0) { LOG(info) << "Found multiple jets to the same phi."; + } double bestR = 0; double bestJetpT = 0; From 696d6502ff85d7a66760ae373641d482b4c69200 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 4 Aug 2026 11:19:59 +0900 Subject: [PATCH 34/34] added isMIDDaughters function --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 459bc4c49c9..0a3e99db80c 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -50,11 +50,12 @@ #include #include #include -#include #include #include #include +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions;