From ea4d2c2eeca711093f51382e83e403f8aafccaaa Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Thu, 29 Jan 2026 19:45:40 +0900 Subject: [PATCH 1/6] [PWGLF] Fixed and testing the processJetData part of KstarInOO.cxx --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 1008 ++++++++++++++++++++------ 1 file changed, 779 insertions(+), 229 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index f94d02d49d6..4c8c8098eb4 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -38,6 +38,7 @@ #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetReducedData.h" +#include "PWGJE/DataModel/TrackJetQa.h" #include @@ -121,7 +122,8 @@ struct kstarInOO { // MCGen Configurable cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; - + Configurable cfgReqMcEffPID{"cfgReqMcEffPID", false, "Request McEfficiency PID"}; + // Pair Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; @@ -140,16 +142,16 @@ struct kstarInOO { Configurable cfgJetDataHistos{"cfgJetDataHistos", false, "Enable Jet Data Histos"}; Configurable cfgJetMCHistos{"cfgJetMCHistos", false, "Enable Jet MC Histos"}; Configurable cfgCutonTrig{"cfgCutonTrig", false, "Enable Jet Cut on Trig"}; - Configurable cfgTestTriggers{"cfgTestTriggers", false, "Enable Jet Test Triggers"}; //====================== //|| //|| JET //|| //====================== - Configurable cfgJetpT{"cfgJetpT", 5.0, "Set Jet pT minimum"}; + Configurable cfgJetpT{"cfgJetpT", 8.0, "Set Jet pT minimum"}; Configurable cfgJetR{"cfgJetR", 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"}; Configurable cfgTriggerMasksTest1{"cfgTriggerMasksTest1", "", "possible JE Trigger masks Test1"}; Configurable cfgTriggerMasksTest2{"cfgTriggerMasksTest2", "", "possible JE Trigger masks Test2"}; @@ -248,6 +250,7 @@ struct kstarInOO { } if (cfgJetQAHistos) { + histos.add("nTriggerQA", "nTriggerQA", kTH1F, {{7, 0.0, 7.0}}); histos.add("JetpT", "Jet pT (GeV/c)", kTH1F, {{4000, 0., 200.}}); histos.add("JetEta", "Jet Eta", kTH1F, {{100, -1.0, 1.0}}); histos.add("JetPhi", "Jet Phi", kTH1F, {{80, -1.0, 7.0}}); @@ -257,11 +260,10 @@ struct kstarInOO { histos.add("jetTrackPhi", "Jet Track Phi", kTH1F, {{80, -1.0, 7.0}}); histos.add("nJetsPerEvent", "nJetsPerEvent", kTH1I, {{4, -0.5, 3.5}}); - histos.add("nGoodjets", "nGoodjets", kTH1I, {{4, -0.5, 3.5}}); + histos.add("nGoodJets", "nGoodJets", kTH1I, {{4, -0.5, 3.5}}); } if (cfgJetDataHistos) { - histos.add("nJetEvents", "nJetEvents", kTH1F, {{7, 0.0, 7.0}}); - histos.add("nTriggerQA", "nTriggerQA", kTH1F, {{7, 0.0, 7.0}}); + histos.add("nEvents", "nEvents", kTH1F, {{7, 0.0, 7.0}}); histos.add("hMB_USS_KPi", "hMB_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMB_USS_PiK", "hMB_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); @@ -274,7 +276,38 @@ struct kstarInOO { histos.add("hLSS_INSIDE_PiK", "hLSS_INSIDE_PiK", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); } if (cfgJetMCHistos) { - histos.add("nJetMCEvents", "nJetMCEvents", kTH1F, {{7, -.0, 7.0}}); + histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{7, -.0, 7.0}}); + histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{7, -.0, 7.0}}); + + histos.add("hMB_USS_KPi_MC", "hMB_USS_KPi_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMB_USS_PiK_MC", "hMB_USS_PiK_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMB_LSS_KPi_MC", "hMB_LSS_KPi_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hMB_LSS_PiK_MC", "hMB_LSS_PiK_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + + histos.add("hUSS_INSIDE_KPi_MC", "hUSS_INSIDE_KPi_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + histos.add("hUSS_INSIDE_PiK_MC", "hUSS_INSIDE_PiK_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + histos.add("hLSS_INSIDE_KPi_MC", "hLSS_INSIDE_KPi_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + histos.add("hLSS_INSIDE_PiK_MC", "hLSS_INSIDE_PiK_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + + histos.add("hUSS_True_MC", "hUSS_True_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_KPi_True_MC", "hUSS_KPi_True_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + histos.add("hUSS_PiK_True_MC", "hUSS_PiK_True_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + + histos.add("hUSS_TrueRec_INSIDE_MC", "hUSS_TrueRec_INSIDE_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + + histos.add("hEffRec_pT", "EffRec_pT (GeV/c)", kTH1F, {{1600, 0., 80.}}); + 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.}}); + histos.add("hEffRecTest4_pT", "EffRecTest4_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); + histos.add("hEffRecTest5_pT", "EffRecTest5_pT (GeV/c)", kTH1F, {{800, 0., 40.}}); + 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("hMotherPdg1", "hMotherPdg1", kTH1F, {{5000, 0., 5000.}}); + histos.add("hMotherPdg2", "hMotherPdg2", kTH1F, {{5000, 0., 5000.}}); } std::shared_ptr hCutFlow = histos.get(HIST("hEvent_Cut")); @@ -289,11 +322,12 @@ struct kstarInOO { "kNoCollInTimeRangeStandard", "kIsGoodITSLayersAll", Form("Occupancy < %.0f", cfgOccupancyMax.value), - "All passed events"}; + "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); @@ -319,12 +353,9 @@ struct kstarInOO { Filter JEMCPosZFilter = nabs(aod::jmccollision::posZ) < cfgEventVtxCut; Filter jetCuts = aod::jet::pt > cfgJetpT&& aod::jet::r == nround(cfgJetR.node() * 100.0f); - using JetSelectedMCCollisions = soa::Join; - using JetSelectedDataCollisions = soa::Join; - using JetTrackCandidates = soa::Join; - - using JetFilteredMCCollisions = soa::Filtered; - using JetFilteredDataCollisions = soa::Filtered; + using JetTrackCandidates = soa::Join; + using JetTrackCandidatesMC = soa::Join; + using JetFilteredJets = soa::Filtered>; // For Mixed Event @@ -343,83 +374,150 @@ struct kstarInOO { //|| Helper Templates //|| //================================== + + template + void fillQA(const bool pass, const objType& obj, const int objecttype = 0) + { + if (objecttype == 1){ + 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()); + } + } + } //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 (!pass){ + histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ()); + histos.fill(HIST("hIsPrim_BC"), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_BC"), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_BC"), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_BC"), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_BC"), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_BC"), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_BC"), obj.tpcChi2NCl()); + histos.fill(HIST("hITSChi2_BC"), obj.itsChi2NCl()); + histos.fill(HIST("QA_track_pT_BC"), obj.pt()); + } else { + histos.fill(HIST("hDCArToPv_AC"), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_AC"), obj.dcaZ()); + histos.fill(HIST("hIsPrim_AC"), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_AC"), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_AC"), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_AC"), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_AC"), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_AC"), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_AC"), obj.tpcChi2NCl()); + histos.fill(HIST("hITSChi2_AC"), obj.itsChi2NCl()); + histos.fill(HIST("QA_track_pT_AC"), obj.pt()); + } + } + } //trackSelection + if (objecttype == 4){ + if constexpr (requires {obj.pt();}){ + if (!pass){ + histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), obj.pt(), obj.tpcNSigmaKa()); + histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), obj.pt(), obj.tofNSigmaKa()); + histos.fill(HIST("QA_kaon_TPC_TOF_BC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa()); + } else { + histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), obj.pt(), obj.tpcNSigmaKa()); + histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), obj.pt(), obj.tofNSigmaKa()); + histos.fill(HIST("QA_kaon_TPC_TOF_AC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa()); + } + } + } //kaon pid Selection + if (objecttype == 5){ + if constexpr (requires {obj.pt();}){ + if (!pass){ + histos.fill(HIST("QA_nSigma_pion_TPC_BC"), obj.pt(), obj.tpcNSigmaPi()); + histos.fill(HIST("QA_nSigma_pion_TOF_BC"), obj.pt(), obj.tofNSigmaPi()); + histos.fill(HIST("QA_pion_TPC_TOF_BC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi()); + } else { + histos.fill(HIST("QA_nSigma_pion_TPC_AC"), obj.pt(), obj.tpcNSigmaPi()); + histos.fill(HIST("QA_nSigma_pion_TOF_AC"), obj.pt(), obj.tofNSigmaPi()); + histos.fill(HIST("QA_pion_TPC_TOF_AC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi()); + } + } + } //pion pid Selection + } + + + //====================================================================== + template - bool eventSelection(const EventType event) + std::pair eventSelection(const EventType event, const bool QA) { - if (cfgEventCutQA) { - histos.fill(HIST("hEvent_Cut"), 0); - histos.fill(HIST("hPosZ_BC"), event.posZ()); - histos.fill(HIST("hcentFT0C_BC"), event.centFT0C()); + if (cfgEventCutQA && QA) { + fillQA(false, event, 1); } + if (!event.sel8()) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 1); - + return {false, 1}; if (std::abs(event.posZ()) > cfgEventVtxCut) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 2); - + return {false, 2}; if (!event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 3); - + return {false, 3}; if (!event.selection_bit(aod::evsel::kNoSameBunchPileup)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 4); - + return {false, 4}; if (!event.selection_bit(aod::evsel::kNoTimeFrameBorder)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 5); - + return {false, 5}; if (!event.selection_bit(aod::evsel::kNoITSROFrameBorder)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 6); - + return {false, 6}; if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 7); - + return {false, 7}; if (!event.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 8); - + return {false, 8}; if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin)) - return false; - if (cfgEventCutQA) - histos.fill(HIST("hEvent_Cut"), 9); + return {false, 9}; + + if (cfgEventCutQA && QA) { + fillQA(true, event, 1); + } + return {true, 8}; + }; - if (cfgEventCutQA) { - histos.fill(HIST("hEvent_Cut"), 10); - histos.fill(HIST("hPosZ_AC"), event.posZ()); - histos.fill(HIST("hcentFT0C_AC"), event.centFT0C()); + template + std::pair JeteventSelection(const EventType event, const bool QA) + { + if (cfgEventCutQA && QA) { + fillQA(false, event, 2); } - return true; + + if (!jetderiveddatautilities::selectCollision(event, eventSelectionBits)) { // sel8 + return {false, 1}; + } + if (std::abs(event.posZ()) > cfgEventVtxCut) + return {false, 2}; + + if (cfgEventCutQA && QA) { + fillQA(true, event, 2); + } + return {true, 8}; }; template bool trackSelection(const TracksType track, const bool QA) { if (cfgTrackCutQA && QA) { - histos.fill(HIST("hDCArToPv_BC"), track.dcaXY()); - histos.fill(HIST("hDCAzToPv_BC"), track.dcaZ()); - histos.fill(HIST("hIsPrim_BC"), track.isPrimaryTrack()); - histos.fill(HIST("hIsGood_BC"), track.isGlobalTrackWoDCA()); - histos.fill(HIST("hIsPrimCont_BC"), track.isPVContributor()); - histos.fill(HIST("hFindableTPCClusters_BC"), track.tpcNClsFindable()); - histos.fill(HIST("hFindableTPCRows_BC"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hClustersVsRows_BC"), track.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("hTPCChi2_BC"), track.tpcChi2NCl()); - histos.fill(HIST("hITSChi2_BC"), track.itsChi2NCl()); - histos.fill(HIST("QA_track_pT_BC"), track.pt()); + fillQA(false, track, 3); } + if (cfgTrackGlobalSel && !track.isGlobalTrack()) return false; if (track.pt() < cfgTrackMinPt) @@ -448,17 +546,7 @@ struct kstarInOO { return false; if (cfgTrackCutQA && QA) { - histos.fill(HIST("hDCArToPv_AC"), track.dcaXY()); - histos.fill(HIST("hDCAzToPv_AC"), track.dcaZ()); - histos.fill(HIST("hIsPrim_AC"), track.isPrimaryTrack()); - histos.fill(HIST("hIsGood_AC"), track.isGlobalTrackWoDCA()); - histos.fill(HIST("hIsPrimCont_AC"), track.isPVContributor()); - histos.fill(HIST("hFindableTPCClusters_AC"), track.tpcNClsFindable()); - histos.fill(HIST("hFindableTPCRows_AC"), track.tpcNClsCrossedRows()); - histos.fill(HIST("hClustersVsRows_AC"), track.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("hTPCChi2_AC"), track.tpcChi2NCl()); - histos.fill(HIST("hITSChi2_AC"), track.itsChi2NCl()); - histos.fill(HIST("QA_track_pT_AC"), track.pt()); + fillQA(true, track, 3); } return true; }; @@ -466,14 +554,14 @@ struct kstarInOO { template bool trackPIDKaon(const TrackPID& candidate, const bool QA) { - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), candidate.pt(), candidate.tpcNSigmaKa()); - histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa()); - histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); - } double tpcpid = 0; double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; + + if (cfgTrackCutQA && QA) { + fillQA(false, candidate, 4); + } + // TPC if (cfgTrackSquarePIDCut) { if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) @@ -507,12 +595,11 @@ struct kstarInOO { tofPIDPassed = true; } } // circular cut + // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), candidate.pt(), candidate.tpcNSigmaKa()); - histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), candidate.pt(), candidate.tofNSigmaKa()); - histos.fill(HIST("QA_kaon_TPC_TOF_AC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa()); + fillQA(true, candidate, 4); } return true; } @@ -522,14 +609,14 @@ struct kstarInOO { template bool trackPIDPion(const TrackPID& candidate, const bool QA) { - if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_nSigma_pion_TPC_BC"), candidate.pt(), candidate.tpcNSigmaPi()); - histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi()); - histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); - } double tpcpid = 0; double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; + + if (cfgTrackCutQA && QA) { + fillQA(false, candidate, 5); + } + // TPC if (cfgTrackSquarePIDCut) { if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) @@ -567,15 +654,40 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { - histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi()); - histos.fill(HIST("QA_nSigma_pion_TOF_AC"), candidate.pt(), candidate.tofNSigmaPi()); - histos.fill(HIST("QA_pion_TPC_TOF_AC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi()); + fillQA(true, candidate, 5); } return true; } return false; } + template + ROOT::Math::PxPyPzMVector minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip) + { + if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) + return {}; + + if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) + return {}; + + if (trk1.globalIndex() >= trk2.globalIndex()) + return {}; + + ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance; + if (!flip) { + lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); + } else { + lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPi); + lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massKa); + } + lResonance = lDecayDaughter1 + lDecayDaughter2; + + if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) + return {}; + return {lResonance}; + } + template void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA) { @@ -585,26 +697,26 @@ struct kstarInOO { for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); - auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); + auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); + auto lResopiK = minvReconstruction(trk1, trk2, QA, true); - if (Minv_Kpi < 0) + if (lResoKpi.M() < 0) continue; double conjugate = trk1.sign() * trk2.sign(); if (cfgDataHistos) { if (!IsMix) { if (conjugate < 0) { - histos.fill(HIST("hUSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); - histos.fill(HIST("hUSS_PiK"), centrality, KstarPt_piK, Minv_piK); + histos.fill(HIST("hUSS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); + histos.fill(HIST("hUSS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); } else if (conjugate > 0) { - histos.fill(HIST("hLSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); - histos.fill(HIST("hLSS_PiK"), centrality, KstarPt_piK, Minv_piK); + histos.fill(HIST("hLSS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); + histos.fill(HIST("hLSS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); } } else { if (conjugate < 0) { - histos.fill(HIST("hUSS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); - histos.fill(HIST("hUSS_PiK_Mix"), centrality, KstarPt_piK, Minv_piK); + histos.fill(HIST("hUSS_KPi_Mix"), centrality, lResoKpi.Pt(), lResoKpi.M()); + histos.fill(HIST("hUSS_PiK_Mix"), centrality, lResopiK.Pt(), lResopiK.M()); } } } @@ -618,37 +730,38 @@ struct kstarInOO { auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); - std::vector mcMemory; - + for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA, false); - auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk1, trk2, QA, true); + auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); + auto lResopiK = minvReconstruction(trk1, trk2, QA, true); - if (Minv_Kpi < 0) + if (lResoKpi.M() < 0) continue; double conjugate = trk1.sign() * trk2.sign(); if (cfgMcHistos) { if (!IsMix) { if (conjugate < 0) { - histos.fill(HIST("hMC_USS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); - histos.fill(HIST("hMC_USS_PiK"), centrality, KstarPt_piK, Minv_piK); + histos.fill(HIST("hMC_USS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); + histos.fill(HIST("hMC_USS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_KPi"), centrality, KstarPt_Kpi, Minv_Kpi); - histos.fill(HIST("hMC_LSS_PiK"), centrality, KstarPt_piK, Minv_piK); + histos.fill(HIST("hMC_LSS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); + histos.fill(HIST("hMC_LSS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); } } else { if (conjugate < 0) { - histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, KstarPt_Kpi, Minv_Kpi); - histos.fill(HIST("hMC_USS_PiK_Mix"), centrality, KstarPt_piK, Minv_piK); + histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, lResoKpi.Pt(), lResoKpi.M()); + histos.fill(HIST("hMC_USS_PiK_Mix"), centrality, lResopiK.Pt(), lResopiK.M()); } } } //====================== // Gen MC + std::vector mcMemory; + auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); @@ -704,7 +817,7 @@ struct kstarInOO { if (track1_mass == track2_mass) { return; } - + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); if (exists1 || exists2) { @@ -714,9 +827,9 @@ struct kstarInOO { mcMemory.push_back(trk2.globalIndex()); } - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); + ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance; + lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), track1_mass); + lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), track2_mass); lResonance = lDecayDaughter1 + lDecayDaughter2; if (cfgMcHistos) { @@ -731,58 +844,136 @@ struct kstarInOO { } // for } // TrackSlicingMC - template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA, const bool flip) + + + template + double DistinguishJets(const JetType& jets, ROOT::Math::PxPyPzMVector lResonance) + { + if (cDebugLevel > 0) + std::cout << "Finded multiple jets to the same phi." << std::endl; + + double bestR = 0; + double bestJetpT = 0; + for (auto const& jet : jets){ + double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); + double etadiff = jet.eta() - lResonance.Eta(); + double R = TMath::Sqrt((phidiff * phidiff)+(etadiff * etadiff)); + if (R < cfgJetR && bestR == 0){ + bestR = R; + bestJetpT = jet.pt(); + } else if (R < bestR){ + bestR = R; + bestJetpT = jet.pt(); + } + }// jet + return bestJetpT; + } + + template + ROOT::Math::PxPyPzMVector JetminvReconstruction(aod::JetCollision const& collision, const TracksType& trk1, const TracksType& trk2, const JetType& jets, const bool QA, const bool flip) { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) - return {-1.0, -1.0}; + return {}; if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) - return {-1.0, -1.0}; + return {}; if (trk1.globalIndex() >= trk2.globalIndex()) - return {-1.0, -1.0}; - - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + return {}; + + ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance; if (!flip) { - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); } else { - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPi); + lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massKa); } lResonance = lDecayDaughter1 + lDecayDaughter2; if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) - return {-1.0, -1.0}; - return {lResonance.Pt(), lResonance.M()}; - } + return {}; - template - double DistinguishJets(const JetType& jets, const TLorentzVector lResonance) - { - if (cDebugLevel > 0) - std::cout << "Finded multiple jets to the same phi." << std::endl; + // auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); + // auto lResopiK = minvReconstruction(trk1, trk2, QA, true); + + //====================== + //| MinBias Event M_inv + //====================== + auto mult = collision.centFT0C(); + double conjugate = trk1.sign() * trk2.sign(); + if (cfgJetDataHistos) { + if (!flip){ + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_KPi"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hMB_LSS_KPi"), mult, lResonance.Pt(), lResonance.M()); + } + }else{ + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_PiK"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0){ + histos.fill(HIST("hMB_LSS_PiK"), mult, lResonance.Pt(), lResonance.M()); + } + } + }//cfgJetDataHistos - double bestR = 0; - double bestJetpT = 0; - for (auto const& jet : jets) { + //====================== + //| Inside jets M_inv + //====================== + bool jetFlag = false; + int goodjets = 0; + double jetpt = 0; + for (auto const& jet : jets){ double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((phidiff * phidiff) + (etadiff * etadiff)); - if (R < cfgJetR && bestR == 0) { - bestR = R; - bestJetpT = jet.pt(); - } else if (R < bestR) { - bestR = R; - bestJetpT = jet.pt(); - } - } // jet - return bestJetpT; - } + double R = TMath::Sqrt((etadiff*etadiff) + (phidiff*phidiff)); + if (R < cfgJetR){ + jetFlag = true; + jetpt = jet.pt(); + goodjets++; + } + } + if (cfgJetQAHistos){ + histos.fill(HIST("nGoodJets"), goodjets); + } + if (!cfgSingleJet){ + if (goodjets > 1){ + jetpt = DistinguishJets(jets, lResonance); + } + } + + if (jetFlag){ + if (cfgJetDataHistos) { + if (!flip){ + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + }else{ + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0){ + histos.fill(HIST("hLSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + } + }//cfgJetDataHistos + }//jetFlag + + if (lResonance.M() > 0.85 && lResonance.M() < 0.95) { + if (jetFlag) + return {}; + if (goodjets > 0) + return {}; + return {}; + } else { + return {}; + } + } //JetminvReconstruction template - std::pair JetminvReconstruction(aod::JetCollision const& collision, const TracksType& trk1, const TracksType& trk2, const JetType& jets, const bool QA, const bool flip) + std::pair JetminvReconstructionMC(o2::aod::JetCollision const& collision, const TracksType& trk1, const TracksType& trk2, const JetType& jets, const bool QA, const bool flip) { if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) return {-1.0, -1.0}; @@ -811,21 +1002,21 @@ struct kstarInOO { //====================== auto mult = collision.centFT0C(); double conjugate = trk1.sign() * trk2.sign(); - if (cfgJetDataHistos) { - if (!flip) { - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_KPi"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_KPi"), mult, lResonance.Pt(), lResonance.M()); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_PiK"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_PiK"), mult, lResonance.Pt(), lResonance.M()); - } + if (cfgJetMCHistos) { + if (!flip){ + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hMB_LSS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); + } + }else{ + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0){ + histos.fill(HIST("hMB_LSS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); + } } - } // cfgJetDataHistos + }//cfgJetMCHistos //====================== //| Inside jets M_inv @@ -833,61 +1024,157 @@ struct kstarInOO { bool jetFlag = false; int goodjets = 0; double jetpt = 0; - for (auto const& jet : jets) { + for (auto const& jet : jets){ double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); - if (R < cfgJetR) { - jetFlag = true; - jetpt = jet.pt(); - goodjets++; + double R = TMath::Sqrt((etadiff*etadiff) + (phidiff*phidiff)); + if (R < cfgJetR){ + jetFlag = true; + jetpt = jet.pt(); + goodjets++; } } - if (cfgJetQAHistos) { - histos.fill(HIST("nGoodjets"), goodjets); + if (cfgJetQAHistos){ + histos.fill(HIST("nGoodJets"), goodjets); } - if (!cfgSingleJet) { - if (goodjets > 1) { - jetpt = DistinguishJets(jets, lResonance); + if (!cfgSingleJet){ + if (goodjets > 1){ + jetpt = DistinguishJets(jets, lResonance); } } + + if (jetFlag){ + if (cfgJetMCHistos) { + if (!flip){ + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + }else{ + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0){ + histos.fill(HIST("hLSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + } + }//cfgJetDataHistos + }//jetFlag - if (jetFlag) { - if (cfgJetDataHistos) { - if (!flip) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } + //====================== + //| MinBias True M_inv + //====================== + if (trk1.has_mcParticle() && trk2.has_mcParticle()){ + auto particle1 = trk1.mcParticle(); + auto particle2 = trk2.mcParticle(); + + if (!particle1.has_mothers() || !particle2.has_mothers()){ + return {-1.0, -1.0}; + } + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& particle1_mom : particle1.template mothers_as()) { + mothers1.push_back(particle1_mom.globalIndex()); + mothers1PDG.push_back(particle1_mom.pdgCode()); + } + + 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 (mothers1PDG[0] != 313) + return {-1.0, -1.0}; // mother not K*0 + if (mothers2PDG[0] != 313) + return {-1.0, -1.0}; // mothers not K*0 + + if (mothers1[0] != mothers2[0]) + return {-1.0, -1.0}; // Kaon and pion not from the same K*0 + + if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) + return {-1.0, -1.0}; + if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) + return {-1.0, -1.0}; + + double track1_mass, track2_mass; + bool track1f{false}; // true means pion + + if (std::fabs(particle1.pdgCode()) == 211) { + track1f = true; + 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) { + return {-1.0, -1.0}; + } + int mcindex1 = trk1.globalIndex(); + int mcindex2 = trk2.globalIndex(); + std::vector mcMemory; + + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); + bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); + if (exists1 || exists2) { + return {-1.0, -1.0}; + } else { + mcMemory.push_back(trk1.globalIndex()); + mcMemory.push_back(trk2.globalIndex()); + } + + TLorentzVector lTrueDaughter1, lTrueDaughter2, lTrueReso; + lTrueDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); + lTrueDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); + lTrueReso = lTrueDaughter1 + lTrueDaughter2; + + if (cfgJetMCHistos) { + histos.fill(HIST("hUSS_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + if (track1f) { + histos.fill(HIST("hUSS_PiK_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); } else { - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } + histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); } - } // cfgJetDataHistos - } // jetFlag - + } + + //=========================== + // INSIDE REC True Closure + //=========================== + if (jetFlag) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + } + } + + } //has_mcParticle + if (lResonance.M() > 0.85 && lResonance.M() < 0.95) { if (jetFlag) - return {3.0, 3.0}; + return {3.0, 3.0}; if (goodjets > 0) - return {2.0, 2.0}; + return {2.0, 2.0}; return {1.0, 1.0}; } else { return {-1.0, -1.0}; } - } // JetminvReconstruction - + + } //JetMCminvReconstruction + //======================================================= //| //| JET DATA STUFF //| //======================================================= int nJetEvents = 0; - void processDataJets(aod::JetCollision const& collision, soa::Filtered> const& chargedjets, soa::Join const& jetTracks, TrackCandidates const&) + void processDataJets(o2::aod::JetCollision const& collision, JetFilteredJets const& chargedjets, JetTrackCandidates const& jetTracks, TrackCandidates const&) { if (cDebugLevel > 0) { nJetEvents++; @@ -896,10 +1183,10 @@ struct kstarInOO { } } if (cfgJetDataHistos) { - histos.fill(HIST("nJetEvents"), 0.5); // Raw event + histos.fill(HIST("nEvents"), 0.5); // Raw event } - - if (std::abs(collision.posZ()) > cfgEventVtxCut) + auto [goodEv, code] = JeteventSelection(collision, true); + if(!goodEv) return; // Trigger before we start jet finding @@ -910,25 +1197,25 @@ struct kstarInOO { bool VTtest3 = false; if (jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) { RT = true; - if (cfgJetDataHistos) { + if (cfgJetQAHistos) { histos.fill(HIST("nTriggerQA"), 0.5); } } if (jetderiveddatautilities::selectTrigger(collision, triggerMaskBitsTest1)) { VTtest1 = true; - if (cfgJetDataHistos) { + if (cfgJetQAHistos) { histos.fill(HIST("nTriggerQA"), 1.5); } } if (jetderiveddatautilities::selectTrigger(collision, triggerMaskBitsTest2)) { VTtest2 = true; - if (cfgJetDataHistos) { + if (cfgJetQAHistos) { histos.fill(HIST("nTriggerQA"), 2.5); } } if (jetderiveddatautilities::selectTrigger(collision, triggerMaskBitsTest3)) { VTtest3 = true; - if (cfgJetDataHistos) { + if (cfgJetQAHistos) { histos.fill(HIST("nTriggerQA"), 3.5); } } @@ -940,15 +1227,14 @@ struct kstarInOO { } // Trigger cut if (cfgJetDataHistos) { - histos.fill(HIST("nJetEvents"), 1.5); // Before passing the condition + histos.fill(HIST("nEvents"), 1.5); // Before passing the condition } if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } - if (cfgJetDataHistos) { - histos.fill(HIST("nJetEvents"), 2.5); // Events after event quality selection for Inclusive + histos.fill(HIST("nEvents"), 2.5); // Events after event quality selection for Inclusive } std::vector jetpT{}; @@ -973,23 +1259,28 @@ struct kstarInOO { histos.fill(HIST("nJetsPerEvent"), nJets); } - if (!HasJets) - return; + //==================== + //|| Has Jets + //==================== + if(cfgReqJets){ + if (!HasJets) + return; + } if (cfgJetDataHistos) { - histos.fill(HIST("nJetEvents"), 3.5); // Has jets + histos.fill(HIST("nEvents"), 3.5); // Has jets } - + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(jetTracks, jetTracks))) { - auto trk1 = track1.track_as>(); - auto trk2 = track2.track_as>(); + auto trk1 = track1.track_as(); + auto trk2 = track2.track_as(); JetminvReconstruction(collision, trk1, trk2, chargedjets, true, false); JetminvReconstruction(collision, trk1, trk2, chargedjets, true, true); - } // track loop - + } + bool INELgt0 = false; for (auto& jetTrack : jetTracks) { - auto originTrack = jetTrack.track_as>(); + auto originTrack = jetTrack.track_as(); if (!trackSelection(originTrack, true)) continue; INELgt0 = true; @@ -1005,6 +1296,265 @@ struct kstarInOO { } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); + //======================================================= + //| + //| JET MC STUFF + //| + //======================================================= + int nJetMCEvents = 0; + void processMCJets(o2::aod::JetCollision const& collision, soa::Filtered const& mcdjets, JetTrackCandidatesMC const& jetTracks, TrackCandidatesMC const&, aod::McParticles const&) + { + if (cDebugLevel > 0){ + nJetMCEvents++; + if ((nJetMCEvents+1)%10000 == 0){ + std::cout << "Processed Jet MC Events: " << nJetMCEvents << std::endl; + } + } + + if (cfgJetMCHistos){ + histos.fill(HIST("nEvents_MC"), 0.5); // Raw event + } + + + if (std::abs(collision.posZ()) > cfgEventVtxCut) + return; + + if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) + return; + + if (cfgJetMCHistos) { + histos.fill(HIST("nEvents_MC"), 1.5); // Before passing the condition + } + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)){ + return; + } + + bool INELgt0 = false; + for (auto& jetTrack : jetTracks){ + if (std::fabs(jetTrack.eta())< cfgTrackMaxEta){ + INELgt0 = true; + break; + } + }//jetTrack loop + if (!INELgt0) + return; + + if (cfgJetMCHistos){ + histos.fill(HIST("nEvents_MC"), 2.5); // Events after event quality selection for Inclusive + } + + std::vector mcdjetpT{}; + std::vector mcdjetEta{}; + std::vector mcdjetPhi{}; + + bool HasJets=false; + int nJets=0; + for (auto mcdjet : mcdjets){ + mcdjetpT.push_back(mcdjet.pt()); + mcdjetEta.push_back(mcdjet.eta()); + mcdjetPhi.push_back(mcdjet.phi()); + 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){ + HasJets=true; + } + } + if (cfgJetQAHistos) { + histos.fill(HIST("nJetsPerEvent"), nJets); + } + + //==================== + //|| Has Jets + //==================== + if(cfgReqJets){ + if (!HasJets){ + return; + } + } + + if (cfgJetMCHistos){ + histos.fill(HIST("nEvents_MC"), 3.5); // Has jets + } + + for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) { + auto trk1 = track1.track_as(); + auto trk2 = track2.track_as(); + + // Each section, test pT. which section we lost the entries + ROOT::Math::PxPyPzMVector lDecayDaughterTest1, lDecayDaughterTest2, lResonanceTest1; + lDecayDaughterTest1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughterTest2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); + lResonanceTest1 = lDecayDaughterTest1 + lDecayDaughterTest2; + + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + continue; + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest1_pT"),lResonanceTest1.Pt()); + } + + if (!trackSelection(trk1, true) || !trackSelection(trk2, false)) + continue; + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest2_pT"),lResonanceTest1.Pt()); + } + + if(cfgReqMcEffPID){ + if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) + continue; + } + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest3_pT"),lResonanceTest1.Pt()); + } + + auto particle1 = trk1.mcParticle(); + auto particle2 = trk2.mcParticle(); + //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + if (!particle1.has_mothers() || !particle2.has_mothers()){ + continue; + } + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest4_pT"),lResonanceTest1.Pt()); + } + //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& particle1_mom : particle1.template mothers_as()) { + mothers1.push_back(particle1_mom.globalIndex()); + mothers1PDG.push_back(particle1_mom.pdgCode()); + } + + //std::cout< 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){ + histos.fill(HIST("hMotherPdg2"),std::fabs(mothers2PDG[0])); + } + + if (mothers1[0] != mothers2[0]) + continue; // Kaon and pion not from the same K*0 + + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest5_pT"),lResonanceTest1.Pt()); + } + + if (std::fabs(particle1.pdgCode()) != 321) //kaon + continue; + + + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest6_pT"),lResonanceTest1.Pt()); + } + + if (std::fabs(particle2.pdgCode()) != 211) //pion + continue; + + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest7_pT"),lResonanceTest1.Pt()); + } + + if (std::fabs(mothers1PDG[0]) != 313) + continue; // mother not K*0 + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRecTest8_pT"),lResonanceTest1.Pt()); + } + + if (std::fabs(mothers2PDG[0]) != 313) + continue; // mothers not K*0 + + + if (cfgJetMCHistos){ + histos.fill(HIST("hEffRec_pT"),lResonanceTest1.Pt()); + } + }//track loop + }//process loop + PROCESS_SWITCH(kstarInOO, processMCJets, "process MC Jets", false); + + + //====================================================== + //| + //| Efficiency JET MC STUFF + //| + //====================================================== + int nprocessEffiEvents = 0; + void processEff(o2::aod::JetMcCollision const& collision, soa::SmallGroups> const& recocolls, aod::JetParticles const& mcParticles, soa::Filtered const& mcpjets) + { + if (cDebugLevel > 0) { + ++nprocessEffiEvents; + if (nprocessEffiEvents % 10000 == 0) { + std::cout << "Processed MC (GEN) Events: " << nprocessEffiEvents << std::endl; + } + } + + if (fabs(collision.posZ()) > cfgEventVtxCut) + return; + if (recocolls.size() <= 0) { // not reconstructed + return; + } + + for (auto& recocoll : recocolls) { // poorly reconstructed + auto goodEv = jetderiveddatautilities::selectCollision(recocoll, eventSelectionBits); + if(goodEv){ + goodEv = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); + } + if(cfgJetMCHistos){ + histos.fill(HIST("nEvents_MC_True"), 0.5); + } + if (!goodEv) + return; + } + + for (auto& particle : mcParticles) { + if (particle.pdgCode() != 313) + continue; + if (std::fabs(particle.eta()) > cfgTrackMaxEta) + continue; + if (particle.pt() < cfgTrackMinPt) + 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(cfgJetMCHistos){ + histos.fill(HIST("hEffGen_pT"), particle.pt()); + } + } // loop over particles + + } // end of process + PROCESS_SWITCH(kstarInOO, processEff, "Process Particles", false); + //======================================================= //| //| DATA STUFF (SE) @@ -1020,7 +1570,7 @@ struct kstarInOO { } } - auto goodEv = eventSelection(collision); + auto [goodEv, code] = eventSelection(collision, true); if (cfgDataHistos) { histos.fill(HIST("nEvents"), 0.5); } @@ -1064,8 +1614,8 @@ struct kstarInOO { std::cout << "Processed DATA Mixed Events : " << nEventsMix << std::endl; } } - auto goodEv1 = eventSelection(collision1); - auto goodEv2 = eventSelection(collision2); + auto [goodEv1, code1] = eventSelection(collision1, false); + auto [goodEv2, code2] = eventSelection(collision2, false); bool VtxMixFlag = false; bool CentMixFlag = false; // bool OccupanacyMixFlag = false; @@ -1102,7 +1652,7 @@ struct kstarInOO { std::cout << "process_SameEvent_MC: " << nEventsMC << std::endl; } } - auto goodEv = eventSelection(collision); + auto [goodEv, code] = eventSelection(collision, true); if (cfgMcHistos) { histos.fill(HIST("nEvents_MC"), 0.5); } @@ -1145,8 +1695,8 @@ struct kstarInOO { std::cout << "Processed Mixed Events: " << nEventsMCMix << std::endl; } } - auto goodEv1 = eventSelection(collision1); - auto goodEv2 = eventSelection(collision2); + auto [goodEv1, code1] = eventSelection(collision1, false); + auto [goodEv2, code2] = eventSelection(collision2, false); if (!goodEv1 || !goodEv2) { continue; } @@ -1179,7 +1729,7 @@ struct kstarInOO { double centrality = -1; for (auto& recocoll : recocolls) { centrality = recocoll.centFT0C(); - auto goodEv = eventSelection(recocoll); + auto [goodEv, code] = eventSelection(recocoll, true); if (cfgMcHistos) { histos.fill(HIST("nEvents_MC_True"), 0.5); @@ -1204,7 +1754,7 @@ struct kstarInOO { } // loop over particles } // processMCTrue PROCESS_SWITCH(kstarInOO, processMCTrue, "process MC True", false); - + void processEventsDummy(EventCandidates::iterator const&, TrackCandidates const&) { return; From 5ef1faa1f58e221efea4d42be4e0e05dab023eb8 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Thu, 29 Jan 2026 19:51:40 +0900 Subject: [PATCH 2/6] [PWGLF] Fixed and testing the processJetData part of KstarInOO.cxx --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 592 +++++++++++++-------------- 1 file changed, 291 insertions(+), 301 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 4c8c8098eb4..78a24759475 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -123,7 +123,7 @@ struct kstarInOO { // MCGen Configurable cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; Configurable cfgReqMcEffPID{"cfgReqMcEffPID", false, "Request McEfficiency PID"}; - + // Pair Configurable cfgMinvNBins{"cfgMinvNBins", 300, "Number of bins for Minv axis"}; Configurable cfgMinvMin{"cfgMinvMin", 0.60, "Minimum Minv value"}; @@ -322,12 +322,11 @@ struct kstarInOO { "kNoCollInTimeRangeStandard", "kIsGoodITSLayersAll", Form("Occupancy < %.0f", cfgOccupancyMax.value), - "All passed events" - }; + "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); @@ -355,7 +354,7 @@ struct kstarInOO { using JetTrackCandidates = soa::Join; using JetTrackCandidatesMC = soa::Join; - + using JetFilteredJets = soa::Filtered>; // For Mixed Event @@ -378,95 +377,94 @@ struct kstarInOO { template void fillQA(const bool pass, const objType& obj, const int objecttype = 0) { - if (objecttype == 1){ - 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()); - } - } - } //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()); - } + if (objecttype == 1) { + 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()); + } + } + } // 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 (!pass){ - histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY()); - histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ()); - histos.fill(HIST("hIsPrim_BC"), obj.isPrimaryTrack()); - histos.fill(HIST("hIsGood_BC"), obj.isGlobalTrackWoDCA()); - histos.fill(HIST("hIsPrimCont_BC"), obj.isPVContributor()); - histos.fill(HIST("hFindableTPCClusters_BC"), obj.tpcNClsFindable()); - histos.fill(HIST("hFindableTPCRows_BC"), obj.tpcNClsCrossedRows()); - histos.fill(HIST("hClustersVsRows_BC"), obj.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("hTPCChi2_BC"), obj.tpcChi2NCl()); - histos.fill(HIST("hITSChi2_BC"), obj.itsChi2NCl()); - histos.fill(HIST("QA_track_pT_BC"), obj.pt()); - } else { - histos.fill(HIST("hDCArToPv_AC"), obj.dcaXY()); - histos.fill(HIST("hDCAzToPv_AC"), obj.dcaZ()); - histos.fill(HIST("hIsPrim_AC"), obj.isPrimaryTrack()); - histos.fill(HIST("hIsGood_AC"), obj.isGlobalTrackWoDCA()); - histos.fill(HIST("hIsPrimCont_AC"), obj.isPVContributor()); - histos.fill(HIST("hFindableTPCClusters_AC"), obj.tpcNClsFindable()); - histos.fill(HIST("hFindableTPCRows_AC"), obj.tpcNClsCrossedRows()); - histos.fill(HIST("hClustersVsRows_AC"), obj.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("hTPCChi2_AC"), obj.tpcChi2NCl()); - histos.fill(HIST("hITSChi2_AC"), obj.itsChi2NCl()); - histos.fill(HIST("QA_track_pT_AC"), obj.pt()); - } - } - } //trackSelection - if (objecttype == 4){ - if constexpr (requires {obj.pt();}){ - if (!pass){ - histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), obj.pt(), obj.tpcNSigmaKa()); - histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), obj.pt(), obj.tofNSigmaKa()); - histos.fill(HIST("QA_kaon_TPC_TOF_BC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa()); - } else { - histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), obj.pt(), obj.tpcNSigmaKa()); - histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), obj.pt(), obj.tofNSigmaKa()); - histos.fill(HIST("QA_kaon_TPC_TOF_AC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa()); - } - } - } //kaon pid Selection - if (objecttype == 5){ - if constexpr (requires {obj.pt();}){ - if (!pass){ - histos.fill(HIST("QA_nSigma_pion_TPC_BC"), obj.pt(), obj.tpcNSigmaPi()); - histos.fill(HIST("QA_nSigma_pion_TOF_BC"), obj.pt(), obj.tofNSigmaPi()); - histos.fill(HIST("QA_pion_TPC_TOF_BC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi()); - } else { - histos.fill(HIST("QA_nSigma_pion_TPC_AC"), obj.pt(), obj.tpcNSigmaPi()); - histos.fill(HIST("QA_nSigma_pion_TOF_AC"), obj.pt(), obj.tofNSigmaPi()); - histos.fill(HIST("QA_pion_TPC_TOF_AC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi()); - } - } - } //pion pid Selection + if constexpr (requires { obj.tpcCrossedRowsOverFindableCls(); }) { + if (objecttype == 3) { + if (!pass) { + histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ()); + histos.fill(HIST("hIsPrim_BC"), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_BC"), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_BC"), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_BC"), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_BC"), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_BC"), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_BC"), obj.tpcChi2NCl()); + histos.fill(HIST("hITSChi2_BC"), obj.itsChi2NCl()); + histos.fill(HIST("QA_track_pT_BC"), obj.pt()); + } else { + histos.fill(HIST("hDCArToPv_AC"), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_AC"), obj.dcaZ()); + histos.fill(HIST("hIsPrim_AC"), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_AC"), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_AC"), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_AC"), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_AC"), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_AC"), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_AC"), obj.tpcChi2NCl()); + histos.fill(HIST("hITSChi2_AC"), obj.itsChi2NCl()); + histos.fill(HIST("QA_track_pT_AC"), obj.pt()); + } + } + } // trackSelection + if (objecttype == 4) { + if constexpr (requires { obj.pt(); }) { + if (!pass) { + histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), obj.pt(), obj.tpcNSigmaKa()); + histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), obj.pt(), obj.tofNSigmaKa()); + histos.fill(HIST("QA_kaon_TPC_TOF_BC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa()); + } else { + histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), obj.pt(), obj.tpcNSigmaKa()); + histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), obj.pt(), obj.tofNSigmaKa()); + histos.fill(HIST("QA_kaon_TPC_TOF_AC"), obj.tpcNSigmaKa(), obj.tofNSigmaKa()); + } + } + } // kaon pid Selection + if (objecttype == 5) { + if constexpr (requires { obj.pt(); }) { + if (!pass) { + histos.fill(HIST("QA_nSigma_pion_TPC_BC"), obj.pt(), obj.tpcNSigmaPi()); + histos.fill(HIST("QA_nSigma_pion_TOF_BC"), obj.pt(), obj.tofNSigmaPi()); + histos.fill(HIST("QA_pion_TPC_TOF_BC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi()); + } else { + histos.fill(HIST("QA_nSigma_pion_TPC_AC"), obj.pt(), obj.tpcNSigmaPi()); + histos.fill(HIST("QA_nSigma_pion_TOF_AC"), obj.pt(), obj.tofNSigmaPi()); + histos.fill(HIST("QA_pion_TPC_TOF_AC"), obj.tpcNSigmaPi(), obj.tofNSigmaPi()); + } + } + } // pion pid Selection } - //====================================================================== - + template std::pair eventSelection(const EventType event, const bool QA) { if (cfgEventCutQA && QA) { fillQA(false, event, 1); } - + if (!event.sel8()) return {false, 1}; if (std::abs(event.posZ()) > cfgEventVtxCut) @@ -485,7 +483,7 @@ struct kstarInOO { return {false, 8}; if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin)) return {false, 9}; - + if (cfgEventCutQA && QA) { fillQA(true, event, 1); } @@ -504,7 +502,7 @@ struct kstarInOO { } if (std::abs(event.posZ()) > cfgEventVtxCut) return {false, 2}; - + if (cfgEventCutQA && QA) { fillQA(true, event, 2); } @@ -517,7 +515,7 @@ struct kstarInOO { if (cfgTrackCutQA && QA) { fillQA(false, track, 3); } - + if (cfgTrackGlobalSel && !track.isGlobalTrack()) return false; if (track.pt() < cfgTrackMinPt) @@ -557,11 +555,11 @@ struct kstarInOO { double tpcpid = 0; double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - + if (cfgTrackCutQA && QA) { fillQA(false, candidate, 4); } - + // TPC if (cfgTrackSquarePIDCut) { if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig) @@ -595,11 +593,11 @@ struct kstarInOO { tofPIDPassed = true; } } // circular cut - + // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { - fillQA(true, candidate, 4); + fillQA(true, candidate, 4); } return true; } @@ -612,11 +610,11 @@ struct kstarInOO { double tpcpid = 0; double tofpid = 0; bool tpcPIDPassed{false}, tofPIDPassed{false}; - + if (cfgTrackCutQA && QA) { fillQA(false, candidate, 5); } - + // TPC if (cfgTrackSquarePIDCut) { if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig) @@ -654,7 +652,7 @@ struct kstarInOO { // TPC & TOF if (tpcPIDPassed && tofPIDPassed) { if (cfgTrackCutQA && QA) { - fillQA(true, candidate, 5); + fillQA(true, candidate, 5); } return true; } @@ -730,7 +728,6 @@ struct kstarInOO { auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); - for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; @@ -761,7 +758,7 @@ struct kstarInOO { //====================== // Gen MC std::vector mcMemory; - + auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); @@ -817,7 +814,7 @@ struct kstarInOO { if (track1_mass == track2_mass) { return; } - + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); if (exists1 || exists2) { @@ -844,8 +841,6 @@ struct kstarInOO { } // for } // TrackSlicingMC - - template double DistinguishJets(const JetType& jets, ROOT::Math::PxPyPzMVector lResonance) { @@ -854,18 +849,18 @@ struct kstarInOO { double bestR = 0; double bestJetpT = 0; - for (auto const& jet : jets){ + for (auto const& jet : jets) { double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((phidiff * phidiff)+(etadiff * etadiff)); - if (R < cfgJetR && bestR == 0){ - bestR = R; - bestJetpT = jet.pt(); - } else if (R < bestR){ - bestR = R; - bestJetpT = jet.pt(); - } - }// jet + double R = TMath::Sqrt((phidiff * phidiff) + (etadiff * etadiff)); + if (R < cfgJetR && bestR == 0) { + bestR = R; + bestJetpT = jet.pt(); + } else if (R < bestR) { + bestR = R; + bestJetpT = jet.pt(); + } + } // jet return bestJetpT; } @@ -880,7 +875,7 @@ struct kstarInOO { if (trk1.globalIndex() >= trk2.globalIndex()) return {}; - + ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance; if (!flip) { lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa); @@ -896,27 +891,27 @@ struct kstarInOO { // auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); // auto lResopiK = minvReconstruction(trk1, trk2, QA, true); - + //====================== //| MinBias Event M_inv //====================== auto mult = collision.centFT0C(); double conjugate = trk1.sign() * trk2.sign(); if (cfgJetDataHistos) { - if (!flip){ - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_KPi"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_KPi"), mult, lResonance.Pt(), lResonance.M()); - } - }else{ - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_PiK"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0){ - histos.fill(HIST("hMB_LSS_PiK"), mult, lResonance.Pt(), lResonance.M()); - } - } - }//cfgJetDataHistos + if (!flip) { + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_KPi"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hMB_LSS_KPi"), mult, lResonance.Pt(), lResonance.M()); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_PiK"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hMB_LSS_PiK"), mult, lResonance.Pt(), lResonance.M()); + } + } + } // cfgJetDataHistos //====================== //| Inside jets M_inv @@ -924,53 +919,53 @@ struct kstarInOO { bool jetFlag = false; int goodjets = 0; double jetpt = 0; - for (auto const& jet : jets){ + for (auto const& jet : jets) { double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((etadiff*etadiff) + (phidiff*phidiff)); - if (R < cfgJetR){ - jetFlag = true; - jetpt = jet.pt(); - goodjets++; + double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgJetR) { + jetFlag = true; + jetpt = jet.pt(); + goodjets++; } } - if (cfgJetQAHistos){ + if (cfgJetQAHistos) { histos.fill(HIST("nGoodJets"), goodjets); } - if (!cfgSingleJet){ - if (goodjets > 1){ - jetpt = DistinguishJets(jets, lResonance); + if (!cfgSingleJet) { + if (goodjets > 1) { + jetpt = DistinguishJets(jets, lResonance); } } - - if (jetFlag){ + + if (jetFlag) { if (cfgJetDataHistos) { - if (!flip){ - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } - }else{ - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0){ - histos.fill(HIST("hLSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } - } - }//cfgJetDataHistos - }//jetFlag + if (!flip) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + } + } // cfgJetDataHistos + } // jetFlag if (lResonance.M() > 0.85 && lResonance.M() < 0.95) { if (jetFlag) - return {}; + return {}; if (goodjets > 0) - return {}; + return {}; return {}; } else { return {}; } - } //JetminvReconstruction + } // JetminvReconstruction template std::pair JetminvReconstructionMC(o2::aod::JetCollision const& collision, const TracksType& trk1, const TracksType& trk2, const JetType& jets, const bool QA, const bool flip) @@ -1003,20 +998,20 @@ struct kstarInOO { auto mult = collision.centFT0C(); double conjugate = trk1.sign() * trk2.sign(); if (cfgJetMCHistos) { - if (!flip){ - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); - } - }else{ - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0){ - histos.fill(HIST("hMB_LSS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); - } - } - }//cfgJetMCHistos + if (!flip) { + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hMB_LSS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMB_USS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hMB_LSS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); + } + } + } // cfgJetMCHistos //====================== //| Inside jets M_inv @@ -1024,52 +1019,52 @@ struct kstarInOO { bool jetFlag = false; int goodjets = 0; double jetpt = 0; - for (auto const& jet : jets){ + for (auto const& jet : jets) { double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((etadiff*etadiff) + (phidiff*phidiff)); - if (R < cfgJetR){ - jetFlag = true; - jetpt = jet.pt(); - goodjets++; + double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); + if (R < cfgJetR) { + jetFlag = true; + jetpt = jet.pt(); + goodjets++; } } - if (cfgJetQAHistos){ + if (cfgJetQAHistos) { histos.fill(HIST("nGoodJets"), goodjets); } - if (!cfgSingleJet){ - if (goodjets > 1){ - jetpt = DistinguishJets(jets, lResonance); + if (!cfgSingleJet) { + if (goodjets > 1) { + jetpt = DistinguishJets(jets, lResonance); } } - - if (jetFlag){ + + if (jetFlag) { if (cfgJetMCHistos) { - if (!flip){ - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } - }else{ - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0){ - histos.fill(HIST("hLSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } - } - }//cfgJetDataHistos - }//jetFlag + if (!flip) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hUSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + } + } // cfgJetDataHistos + } // jetFlag //====================== //| MinBias True M_inv //====================== - if (trk1.has_mcParticle() && trk2.has_mcParticle()){ + if (trk1.has_mcParticle() && trk2.has_mcParticle()) { auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); - if (!particle1.has_mothers() || !particle2.has_mothers()){ - return {-1.0, -1.0}; + if (!particle1.has_mothers() || !particle2.has_mothers()) { + return {-1.0, -1.0}; } std::vector mothers1{}; @@ -1121,7 +1116,7 @@ struct kstarInOO { int mcindex1 = trk1.globalIndex(); int mcindex2 = trk2.globalIndex(); std::vector mcMemory; - + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); if (exists1 || exists2) { @@ -1135,7 +1130,7 @@ struct kstarInOO { lTrueDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); lTrueDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); lTrueReso = lTrueDaughter1 + lTrueDaughter2; - + if (cfgJetMCHistos) { histos.fill(HIST("hUSS_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); if (track1f) { @@ -1144,30 +1139,30 @@ struct kstarInOO { histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); } } - + //=========================== // INSIDE REC True Closure //=========================== if (jetFlag) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + } } - - } //has_mcParticle - + + } // has_mcParticle + if (lResonance.M() > 0.85 && lResonance.M() < 0.95) { if (jetFlag) - return {3.0, 3.0}; + return {3.0, 3.0}; if (goodjets > 0) - return {2.0, 2.0}; + return {2.0, 2.0}; return {1.0, 1.0}; } else { return {-1.0, -1.0}; } - - } //JetMCminvReconstruction - + + } // JetMCminvReconstruction + //======================================================= //| //| JET DATA STUFF @@ -1186,7 +1181,7 @@ struct kstarInOO { histos.fill(HIST("nEvents"), 0.5); // Raw event } auto [goodEv, code] = JeteventSelection(collision, true); - if(!goodEv) + if (!goodEv) return; // Trigger before we start jet finding @@ -1262,14 +1257,14 @@ struct kstarInOO { //==================== //|| Has Jets //==================== - if(cfgReqJets){ + if (cfgReqJets) { if (!HasJets) - return; + return; } if (cfgJetDataHistos) { histos.fill(HIST("nEvents"), 3.5); // Has jets } - + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(jetTracks, jetTracks))) { auto trk1 = track1.track_as(); auto trk2 = track2.track_as(); @@ -1277,7 +1272,7 @@ struct kstarInOO { JetminvReconstruction(collision, trk1, trk2, chargedjets, true, false); JetminvReconstruction(collision, trk1, trk2, chargedjets, true, true); } - + bool INELgt0 = false; for (auto& jetTrack : jetTracks) { auto originTrack = jetTrack.track_as(); @@ -1304,64 +1299,63 @@ struct kstarInOO { int nJetMCEvents = 0; void processMCJets(o2::aod::JetCollision const& collision, soa::Filtered const& mcdjets, JetTrackCandidatesMC const& jetTracks, TrackCandidatesMC const&, aod::McParticles const&) { - if (cDebugLevel > 0){ + if (cDebugLevel > 0) { nJetMCEvents++; - if ((nJetMCEvents+1)%10000 == 0){ - std::cout << "Processed Jet MC Events: " << nJetMCEvents << std::endl; + if ((nJetMCEvents + 1) % 10000 == 0) { + std::cout << "Processed Jet MC Events: " << nJetMCEvents << std::endl; } } - if (cfgJetMCHistos){ + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_MC"), 0.5); // Raw event } - - + if (std::abs(collision.posZ()) > cfgEventVtxCut) return; if (!jetderiveddatautilities::selectTrigger(collision, RealTriggerMaskBits)) return; - + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_MC"), 1.5); // Before passing the condition } - - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)){ + + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { return; } bool INELgt0 = false; - for (auto& jetTrack : jetTracks){ - if (std::fabs(jetTrack.eta())< cfgTrackMaxEta){ - INELgt0 = true; - break; + for (auto& jetTrack : jetTracks) { + if (std::fabs(jetTrack.eta()) < cfgTrackMaxEta) { + INELgt0 = true; + break; } - }//jetTrack loop + } // jetTrack loop if (!INELgt0) return; - if (cfgJetMCHistos){ + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_MC"), 2.5); // Events after event quality selection for Inclusive } std::vector mcdjetpT{}; std::vector mcdjetEta{}; std::vector mcdjetPhi{}; - - bool HasJets=false; - int nJets=0; - for (auto mcdjet : mcdjets){ + + bool HasJets = false; + int nJets = 0; + for (auto mcdjet : mcdjets) { mcdjetpT.push_back(mcdjet.pt()); mcdjetEta.push_back(mcdjet.eta()); mcdjetPhi.push_back(mcdjet.phi()); nJets++; - if (cfgJetQAHistos){ - histos.fill(HIST("JetpT"), mcdjet.pt()); - histos.fill(HIST("JetEta"), mcdjet.eta()); - histos.fill(HIST("JetPhi"), mcdjet.phi()); + if (cfgJetQAHistos) { + histos.fill(HIST("JetpT"), mcdjet.pt()); + histos.fill(HIST("JetEta"), mcdjet.eta()); + histos.fill(HIST("JetPhi"), mcdjet.phi()); } - if (mcdjet.pt() > cfgJetpT){ - HasJets=true; + if (mcdjet.pt() > cfgJetpT) { + HasJets = true; } } if (cfgJetQAHistos) { @@ -1371,20 +1365,20 @@ struct kstarInOO { //==================== //|| Has Jets //==================== - if(cfgReqJets){ - if (!HasJets){ - return; + if (cfgReqJets) { + if (!HasJets) { + return; } } - - if (cfgJetMCHistos){ + + if (cfgJetMCHistos) { histos.fill(HIST("nEvents_MC"), 3.5); // Has jets } for (auto& [track1, track2] : combinations(o2::soa::CombinationsUpperIndexPolicy(jetTracks, jetTracks))) { auto trk1 = track1.track_as(); auto trk2 = track2.track_as(); - + // Each section, test pT. which section we lost the entries ROOT::Math::PxPyPzMVector lDecayDaughterTest1, lDecayDaughterTest2, lResonanceTest1; lDecayDaughterTest1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa); @@ -1393,37 +1387,37 @@ struct kstarInOO { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest1_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest1_pT"), lResonanceTest1.Pt()); } if (!trackSelection(trk1, true) || !trackSelection(trk2, false)) - continue; - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest2_pT"),lResonanceTest1.Pt()); + continue; + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest2_pT"), lResonanceTest1.Pt()); } - if(cfgReqMcEffPID){ - if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) - continue; + if (cfgReqMcEffPID) { + if (!trackPIDKaon(trk1, true) || !trackPIDPion(trk2, true)) + continue; } - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest3_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest3_pT"), lResonanceTest1.Pt()); } - + auto particle1 = trk1.mcParticle(); auto particle2 = trk2.mcParticle(); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// - if (!particle1.has_mothers() || !particle2.has_mothers()){ - continue; + if (!particle1.has_mothers() || !particle2.has_mothers()) { + continue; } - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest4_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest4_pT"), lResonanceTest1.Pt()); } //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// - + std::vector mothers1{}; std::vector mothers1PDG{}; for (auto& particle1_mom : particle1.template mothers_as()) { @@ -1431,9 +1425,9 @@ struct kstarInOO { mothers1PDG.push_back(particle1_mom.pdgCode()); } - //std::cout< mothers2{}; std::vector mothers2PDG{}; @@ -1441,50 +1435,47 @@ struct kstarInOO { mothers2.push_back(particle2_mom.globalIndex()); mothers2PDG.push_back(particle2_mom.pdgCode()); } - if (cfgJetMCHistos){ - histos.fill(HIST("hMotherPdg2"),std::fabs(mothers2PDG[0])); + if (cfgJetMCHistos) { + histos.fill(HIST("hMotherPdg2"), std::fabs(mothers2PDG[0])); } - + if (mothers1[0] != mothers2[0]) continue; // Kaon and pion not from the same K*0 - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest5_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest5_pT"), lResonanceTest1.Pt()); } - if (std::fabs(particle1.pdgCode()) != 321) //kaon - continue; - + if (std::fabs(particle1.pdgCode()) != 321) // kaon + continue; - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest6_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest6_pT"), lResonanceTest1.Pt()); } - - if (std::fabs(particle2.pdgCode()) != 211) //pion + + if (std::fabs(particle2.pdgCode()) != 211) // pion continue; - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest7_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest7_pT"), lResonanceTest1.Pt()); } if (std::fabs(mothers1PDG[0]) != 313) - continue; // mother not K*0 - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRecTest8_pT"),lResonanceTest1.Pt()); + continue; // mother not K*0 + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRecTest8_pT"), lResonanceTest1.Pt()); } - + if (std::fabs(mothers2PDG[0]) != 313) continue; // mothers not K*0 - - if (cfgJetMCHistos){ - histos.fill(HIST("hEffRec_pT"),lResonanceTest1.Pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffRec_pT"), lResonanceTest1.Pt()); } - }//track loop - }//process loop + } // track loop + } // process loop PROCESS_SWITCH(kstarInOO, processMCJets, "process MC Jets", false); - //====================================================== //| //| Efficiency JET MC STUFF @@ -1508,11 +1499,11 @@ struct kstarInOO { for (auto& recocoll : recocolls) { // poorly reconstructed auto goodEv = jetderiveddatautilities::selectCollision(recocoll, eventSelectionBits); - if(goodEv){ - goodEv = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); + if (goodEv) { + goodEv = jetderiveddatautilities::selectTrigger(recocoll, RealTriggerMaskBits); } - if(cfgJetMCHistos){ - histos.fill(HIST("nEvents_MC_True"), 0.5); + if (cfgJetMCHistos) { + histos.fill(HIST("nEvents_MC_True"), 0.5); } if (!goodEv) return; @@ -1524,10 +1515,9 @@ struct kstarInOO { if (std::fabs(particle.eta()) > cfgTrackMaxEta) continue; if (particle.pt() < cfgTrackMinPt) - continue; - + continue; - /* // Not Yet + /* // Not Yet if (cfg_Force_BR) { bool baddecay = false; for (auto& phidaughter : particle.daughters_as()) { @@ -1547,8 +1537,8 @@ struct kstarInOO { continue; } // enforce BR restriction */ - if(cfgJetMCHistos){ - histos.fill(HIST("hEffGen_pT"), particle.pt()); + if (cfgJetMCHistos) { + histos.fill(HIST("hEffGen_pT"), particle.pt()); } } // loop over particles @@ -1754,7 +1744,7 @@ struct kstarInOO { } // loop over particles } // processMCTrue PROCESS_SWITCH(kstarInOO, processMCTrue, "process MC True", false); - + void processEventsDummy(EventCandidates::iterator const&, TrackCandidates const&) { return; From 6478597484e765eef18b87505be2f604a87a8c1a Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Fri, 30 Jan 2026 10:44:39 +0900 Subject: [PATCH 3/6] [PWGLF] Fixed and testing the processJetData part of KstarInOO.cxx --- 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 78a24759475..31d52ceee2a 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -373,7 +373,6 @@ struct kstarInOO { //|| Helper Templates //|| //================================== - template void fillQA(const bool pass, const objType& obj, const int objecttype = 0) { @@ -1482,7 +1481,7 @@ struct kstarInOO { //| //====================================================== int nprocessEffiEvents = 0; - void processEff(o2::aod::JetMcCollision const& collision, soa::SmallGroups> const& recocolls, aod::JetParticles const& mcParticles, soa::Filtered const& mcpjets) + void processEff(o2::aod::JetMcCollision const& collision, soa::SmallGroups> const& recocolls, aod::JetParticles const& mcParticles) { if (cDebugLevel > 0) { ++nprocessEffiEvents; @@ -1537,6 +1536,7 @@ struct kstarInOO { continue; } // enforce BR restriction */ + if (cfgJetMCHistos) { histos.fill(HIST("hEffGen_pT"), particle.pt()); } From 3326a8916c9912e9a16b92a8728b72ddb0a4c153 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 3 Feb 2026 13:13:29 +0900 Subject: [PATCH 4/6] [PWGLF] Fixed and the processJetData part of KstarInOO.cxx --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 689 +++++++++++---------------- 1 file changed, 288 insertions(+), 401 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 31d52ceee2a..8892f931bdf 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -136,13 +136,17 @@ struct kstarInOO { Configurable cfgTrackCutQA{"cfgTrackCutQA", false, "Enable Track QA Hists"}; Configurable cfgJetQAHistos{"cfgJetQAHistos", false, "Enable Jet QA Histos"}; - Configurable cfgDataHistos{"cfgDataHistos", false, "Enable Data Hists"}; Configurable cfgMcHistos{"cfgMcHistos", false, "Enable MC Hists"}; + Configurable cfgMixedHistos{"cfgMixedHistos", false, "Enable Mixed Histos"}; + + Configurable cfgJetHistos{"cfgJetHistos", false, "Enable Jet Histos"}; - Configurable cfgJetDataHistos{"cfgJetDataHistos", false, "Enable Jet Data Histos"}; 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"}; + //====================== //|| //|| JET @@ -182,7 +186,6 @@ struct kstarInOO { histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{110, 0.0, 110.0}}); histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{110, 0.0, 110.0}}); } - if (cfgTrackCutQA) { histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {axisDCAxy}); histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {axisDCAz}); @@ -221,34 +224,15 @@ struct kstarInOO { histos.add("QA_track_pT_AC", "QA_track_pT_AC", kTH1F, {{13, 0.0, 13.0}}); } - if (cfgDataHistos) { - histos.add("nEvents", "nEvents", kTH1F, {{4, 0.0, 4.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("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hUSS_KPi_Mix", "hUSS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hUSS_PiK_Mix", "hUSS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - } - if (cfgMcHistos) { histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}}); histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis}); histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_KPi", "hMC_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_PiK", "hMC_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_KPi", "hMC_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_LSS_PiK", "hMC_LSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - - histos.add("hMC_USS_KPi_Mix", "hMC_USS_KPi_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_PiK_Mix", "hMC_USS_PiK_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMC_USS_KPi_True", "hMC_USS_KPi_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hMC_USS_PiK_True", "hMC_USS_PiK_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); } - if (cfgJetQAHistos) { histos.add("nTriggerQA", "nTriggerQA", kTH1F, {{7, 0.0, 7.0}}); histos.add("JetpT", "Jet pT (GeV/c)", kTH1F, {{4000, 0., 200.}}); @@ -262,33 +246,10 @@ struct kstarInOO { histos.add("nJetsPerEvent", "nJetsPerEvent", kTH1I, {{4, -0.5, 3.5}}); histos.add("nGoodJets", "nGoodJets", kTH1I, {{4, -0.5, 3.5}}); } - if (cfgJetDataHistos) { - histos.add("nEvents", "nEvents", kTH1F, {{7, 0.0, 7.0}}); - - histos.add("hMB_USS_KPi", "hMB_USS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMB_USS_PiK", "hMB_USS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMB_LSS_KPi", "hMB_LSS_KPi", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMB_LSS_PiK", "hMB_LSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - - histos.add("hUSS_INSIDE_KPi", "hUSS_INSIDE_KPi", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hUSS_INSIDE_PiK", "hUSS_INSIDE_PiK", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hLSS_INSIDE_KPi", "hLSS_INSIDE_KPi", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hLSS_INSIDE_PiK", "hLSS_INSIDE_PiK", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - } if (cfgJetMCHistos) { histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{7, -.0, 7.0}}); histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{7, -.0, 7.0}}); - histos.add("hMB_USS_KPi_MC", "hMB_USS_KPi_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMB_USS_PiK_MC", "hMB_USS_PiK_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMB_LSS_KPi_MC", "hMB_LSS_KPi_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - histos.add("hMB_LSS_PiK_MC", "hMB_LSS_PiK_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); - - histos.add("hUSS_INSIDE_KPi_MC", "hUSS_INSIDE_KPi_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hUSS_INSIDE_PiK_MC", "hUSS_INSIDE_PiK_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hLSS_INSIDE_KPi_MC", "hLSS_INSIDE_KPi_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hLSS_INSIDE_PiK_MC", "hLSS_INSIDE_PiK_MC", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); - histos.add("hUSS_True_MC", "hUSS_True_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_KPi_True_MC", "hUSS_KPi_True_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); histos.add("hUSS_PiK_True_MC", "hUSS_PiK_True_MC", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); @@ -310,6 +271,24 @@ struct kstarInOO { histos.add("hMotherPdg2", "hMotherPdg2", kTH1F, {{5000, 0., 5000.}}); } + //////////////////////////////////// + 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("hLSS_PiK", "hLSS_PiK", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis}); + + 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}); + } + if (cfgJetHistos) { + histos.add("hUSS_KPi_INSIDE", "hUSS_KPi_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + histos.add("hUSS_PiK_INSIDE", "hUSS_PiK_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + histos.add("hLSS_KPi_INSIDE", "hLSS_KPi_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + histos.add("hLSS_PiK_INSIDE", "hLSS_PiK_INSIDE", kTHnSparseF, {cfgCentAxis, dRAxis, ptAxis, minvAxis}); + } + std::shared_ptr hCutFlow = histos.get(HIST("hEvent_Cut")); std::vector eventCutLabels = { "All Events", @@ -455,6 +434,55 @@ struct kstarInOO { } // pion pid Selection } + enum class objectType { MB, + Jets }; + template + void fillMinv(objectType type, const TrackType& trk1, const TrackType& trk2, const ROOT::Math::PxPyPzMVector& lReso, double centrality, double jetpt, bool IsMix, 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; + } // switch + } // fillMinv //====================================================================== template @@ -693,30 +721,13 @@ struct kstarInOO { auto centrality = collision1.centFT0C(); 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) + continue; - auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); - auto lResopiK = minvReconstruction(trk1, trk2, QA, true); - - if (lResoKpi.M() < 0) - continue; - - double conjugate = trk1.sign() * trk2.sign(); - if (cfgDataHistos) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); - histos.fill(HIST("hUSS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); - histos.fill(HIST("hLSS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hUSS_KPi_Mix"), centrality, lResoKpi.Pt(), lResoKpi.M()); - histos.fill(HIST("hUSS_PiK_Mix"), centrality, lResopiK.Pt(), lResopiK.M()); - } - } - } + fillMinv(MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + } // flip } // for } // TrackSlicing @@ -731,29 +742,13 @@ struct kstarInOO { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; - auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); - auto lResopiK = minvReconstruction(trk1, trk2, QA, true); - - if (lResoKpi.M() < 0) - continue; + for (bool flip : {false, true}) { + auto lReso = minvReconstruction(trk1, trk2, QA, flip); + if (lReso.M() < 0) + continue; - double conjugate = trk1.sign() * trk2.sign(); - if (cfgMcHistos) { - if (!IsMix) { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); - histos.fill(HIST("hMC_USS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMC_LSS_KPi"), centrality, lResoKpi.Pt(), lResoKpi.M()); - histos.fill(HIST("hMC_LSS_PiK"), centrality, lResopiK.Pt(), lResopiK.M()); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMC_USS_KPi_Mix"), centrality, lResoKpi.Pt(), lResoKpi.M()); - histos.fill(HIST("hMC_USS_PiK_Mix"), centrality, lResopiK.Pt(), lResopiK.M()); - } - } - } + fillMinv(MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + } // flip //====================== // Gen MC std::vector mcMemory; @@ -864,302 +859,201 @@ struct kstarInOO { } template - ROOT::Math::PxPyPzMVector JetminvReconstruction(aod::JetCollision const& collision, const TracksType& trk1, const TracksType& trk2, const JetType& jets, const bool QA, const bool flip) + ROOT::Math::PxPyPzMVector JetTrackSlicing(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA) { - if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) - return {}; - - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) - return {}; - - if (trk1.globalIndex() >= trk2.globalIndex()) - return {}; - - ROOT::Math::PxPyPzMVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!flip) { - lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPi); - } else { - lDecayDaughter1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPi); - lDecayDaughter2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massKa); - } - lResonance = lDecayDaughter1 + lDecayDaughter2; - - if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) - return {}; - - // auto lResoKpi = minvReconstruction(trk1, trk2, QA, false); - // auto lResopiK = minvReconstruction(trk1, trk2, QA, true); - //====================== //| MinBias Event M_inv //====================== - auto mult = collision.centFT0C(); - double conjugate = trk1.sign() * trk2.sign(); - if (cfgJetDataHistos) { - if (!flip) { - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_KPi"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_KPi"), mult, lResonance.Pt(), lResonance.M()); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_PiK"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_PiK"), mult, lResonance.Pt(), lResonance.M()); - } - } - } // cfgJetDataHistos - - //====================== - //| Inside jets M_inv - //====================== - bool jetFlag = false; - int goodjets = 0; - double jetpt = 0; - for (auto const& jet : jets) { - double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); - double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); - if (R < cfgJetR) { - jetFlag = true; - jetpt = jet.pt(); - goodjets++; - } - } - if (cfgJetQAHistos) { - histos.fill(HIST("nGoodJets"), goodjets); - } - if (!cfgSingleJet) { - if (goodjets > 1) { - jetpt = DistinguishJets(jets, lResonance); - } - } + auto centrality = collision.centFT0C(); + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(jetTracks, jetTracks))) { + auto trk1 = track1.template track_as(); + auto trk2 = track2.template track_as(); + + for (bool flip : {false, true}) { + auto lResonance = minvReconstruction(trk1, trk2, QA, flip); + if (lResonance.M() < 0) + continue; - if (jetFlag) { - if (cfgJetDataHistos) { - if (!flip) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_KPi"), mult, jetpt, lResonance.Pt(), lResonance.M()); + fillMinv(MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); + + //====================== + //| Inside jets M_inv + //====================== + bool jetFlag = false; + int goodjets = 0; + double jetpt = 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)); + if (R < cfgJetR) { + jetFlag = true; + jetpt = jet.pt(); + goodjets++; } - } else { - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_PiK"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + if (cfgJetQAHistos) { + histos.fill(HIST("nGoodJets"), goodjets); + } + if (!cfgSingleJet) { + if (goodjets > 1) { + jetpt = DistinguishJets(chargedjets, lResonance); } } - } // cfgJetDataHistos - } // jetFlag - - if (lResonance.M() > 0.85 && lResonance.M() < 0.95) { - if (jetFlag) - return {}; - if (goodjets > 0) - return {}; - return {}; - } else { - return {}; - } - } // JetminvReconstruction + + if (jetFlag) { + fillMinv(Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); + } // jetFlag + } // flip + } // Track + return {}; + } // JetTrackSlicing template - std::pair JetminvReconstructionMC(o2::aod::JetCollision const& collision, const TracksType& trk1, const TracksType& trk2, const JetType& jets, const bool QA, const bool flip) + ROOT::Math::PxPyPzMVector JetTrackSlicingMC(aod::JetCollision const& collision, TracksType const& jetTracks, const JetType& chargedjets, const bool IsMix, const bool QA) { - if (!trackSelection(trk1, false) || !trackSelection(trk2, false)) - return {-1.0, -1.0}; - - if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA)) - return {-1.0, -1.0}; - - if (trk1.globalIndex() >= trk2.globalIndex()) - return {-1.0, -1.0}; - - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!flip) { - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); - } else { - lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); - } - lResonance = lDecayDaughter1 + lDecayDaughter2; - - if (std::abs(lResonance.Eta()) > cfgTrackMaxEta) - return {-1.0, -1.0}; - //====================== //| MinBias Event M_inv //====================== - auto mult = collision.centFT0C(); - double conjugate = trk1.sign() * trk2.sign(); - if (cfgJetMCHistos) { - if (!flip) { - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_KPi_MC"), mult, lResonance.Pt(), lResonance.M()); - } - } else { - if (conjugate < 0) { - histos.fill(HIST("hMB_USS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hMB_LSS_PiK_MC"), mult, lResonance.Pt(), lResonance.M()); - } - } - } // cfgJetMCHistos - - //====================== - //| Inside jets M_inv - //====================== - bool jetFlag = false; - int goodjets = 0; - double jetpt = 0; - for (auto const& jet : jets) { - double phidiff = TVector2::Phi_mpi_pi(jet.phi() - lResonance.Phi()); - double etadiff = jet.eta() - lResonance.Eta(); - double R = TMath::Sqrt((etadiff * etadiff) + (phidiff * phidiff)); - if (R < cfgJetR) { - jetFlag = true; - jetpt = jet.pt(); - goodjets++; - } - } - if (cfgJetQAHistos) { - histos.fill(HIST("nGoodJets"), goodjets); - } - if (!cfgSingleJet) { - if (goodjets > 1) { - jetpt = DistinguishJets(jets, lResonance); - } - } + auto centrality = collision.centFT0C(); + for (const auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(jetTracks, jetTracks))) { + auto trk1 = track1.template track_as(); + auto trk2 = track2.template track_as(); + + for (bool flip : {false, true}) { + auto lResonance = minvReconstruction(trk1, trk2, QA, flip); + if (lResonance.M() < 0) + continue; - if (jetFlag) { - if (cfgJetMCHistos) { - if (!flip) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_KPi_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); + + //====================== + //| Inside jets M_inv + //====================== + bool jetFlag = false; + int goodjets = 0; + double jetpt = 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)); + if (R < cfgJetR) { + jetFlag = true; + jetpt = jet.pt(); + goodjets++; } - } else { - if (conjugate < 0) { - histos.fill(HIST("hUSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); - } else if (conjugate > 0) { - histos.fill(HIST("hLSS_INSIDE_PiK_MC"), mult, jetpt, lResonance.Pt(), lResonance.M()); + } + if (cfgJetQAHistos) { + histos.fill(HIST("nGoodJets"), goodjets); + } + if (!cfgSingleJet) { + if (goodjets > 1) { + jetpt = DistinguishJets(chargedjets, lResonance); } } - } // cfgJetDataHistos - } // jetFlag - //====================== - //| MinBias True M_inv - //====================== - if (trk1.has_mcParticle() && trk2.has_mcParticle()) { - auto particle1 = trk1.mcParticle(); - auto particle2 = trk2.mcParticle(); + if (jetFlag) { + fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); + } // jetFlag - if (!particle1.has_mothers() || !particle2.has_mothers()) { - return {-1.0, -1.0}; - } - - std::vector mothers1{}; - std::vector mothers1PDG{}; - for (auto& particle1_mom : particle1.template mothers_as()) { - mothers1.push_back(particle1_mom.globalIndex()); - mothers1PDG.push_back(particle1_mom.pdgCode()); - } + //====================== + //| MinBias True M_inv + //====================== + if (trk1.has_mcParticle() && trk2.has_mcParticle()) { + auto particle1 = trk1.mcParticle(); + auto particle2 = trk2.mcParticle(); - 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 (mothers1PDG[0] != 313) - return {-1.0, -1.0}; // mother not K*0 - if (mothers2PDG[0] != 313) - return {-1.0, -1.0}; // mothers not K*0 - - if (mothers1[0] != mothers2[0]) - return {-1.0, -1.0}; // Kaon and pion not from the same K*0 - - if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) - return {-1.0, -1.0}; - if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) - return {-1.0, -1.0}; + if (!particle1.has_mothers() || !particle2.has_mothers()) { + return {}; + } - double track1_mass, track2_mass; - bool track1f{false}; // true means pion + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& particle1_mom : particle1.template mothers_as()) { + mothers1.push_back(particle1_mom.globalIndex()); + mothers1PDG.push_back(particle1_mom.pdgCode()); + } - if (std::fabs(particle1.pdgCode()) == 211) { - track1f = true; - track1_mass = massPi; - } else { - track1_mass = massKa; - } + 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 (std::fabs(particle2.pdgCode()) == 211) { - track2_mass = massPi; - } else { - track2_mass = massKa; - } + if (mothers1PDG[0] != 313) + return {}; // mother not K*0 + if (mothers2PDG[0] != 313) + return {}; // mothers not K*0 - if (track1_mass == track2_mass) { - return {-1.0, -1.0}; - } - int mcindex1 = trk1.globalIndex(); - int mcindex2 = trk2.globalIndex(); - std::vector mcMemory; + if (mothers1[0] != mothers2[0]) + return {}; // Kaon and pion not from the same K*0 - bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); - bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); - if (exists1 || exists2) { - return {-1.0, -1.0}; - } else { - mcMemory.push_back(trk1.globalIndex()); - mcMemory.push_back(trk2.globalIndex()); - } + if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) + return {}; + if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) + return {}; - TLorentzVector lTrueDaughter1, lTrueDaughter2, lTrueReso; - lTrueDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), track1_mass); - lTrueDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), track2_mass); - lTrueReso = lTrueDaughter1 + lTrueDaughter2; + double track1_mass, track2_mass; + bool track1f{false}; // true means pion - if (cfgJetMCHistos) { - histos.fill(HIST("hUSS_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - if (track1f) { - histos.fill(HIST("hUSS_PiK_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } else { - histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } - } + if (std::fabs(particle1.pdgCode()) == 211) { + track1f = true; + track1_mass = massPi; + } else { + track1_mass = massKa; + } - //=========================== - // INSIDE REC True Closure - //=========================== - if (jetFlag) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } - } + if (std::fabs(particle2.pdgCode()) == 211) { + track2_mass = massPi; + } else { + track2_mass = massKa; + } - } // has_mcParticle + if (track1_mass == track2_mass) { + return {}; + } + int mcindex1 = trk1.globalIndex(); + int mcindex2 = trk2.globalIndex(); + std::vector mcMemory; + + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); + bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); + if (exists1 || exists2) { + return {}; + } else { + mcMemory.push_back(trk1.globalIndex()); + mcMemory.push_back(trk2.globalIndex()); + } - if (lResonance.M() > 0.85 && lResonance.M() < 0.95) { - if (jetFlag) - return {3.0, 3.0}; - if (goodjets > 0) - return {2.0, 2.0}; - return {1.0, 1.0}; - } else { - return {-1.0, -1.0}; - } + 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); + lTrueReso = lTrueDaughter1 + lTrueDaughter2; + + auto mult = collision.centFT0C(); + double conjugate = trk1.sign() * trk2.sign(); + if (cfgJetMCHistos) { + histos.fill(HIST("hUSS_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + if (track1f) { + histos.fill(HIST("hUSS_PiK_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + } else { + histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + } + } + //=========================== + // INSIDE REC True Closure + //=========================== + if (jetFlag) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + } + } + } // has_mcParticle + } // filp + } // Tracks loop + return {}; } // JetMCminvReconstruction //======================================================= @@ -1176,12 +1070,8 @@ struct kstarInOO { std::cout << "Processed Jet Data Events: " << nJetEvents << std::endl; } } - if (cfgJetDataHistos) { - histos.fill(HIST("nEvents"), 0.5); // Raw event - } - auto [goodEv, code] = JeteventSelection(collision, true); - if (!goodEv) - return; + + histos.fill(HIST("nEvents"), 0.5); // Raw event // Trigger before we start jet finding if (cfgCutonTrig) { @@ -1220,17 +1110,22 @@ struct kstarInOO { } } // Trigger cut - if (cfgJetDataHistos) { - histos.fill(HIST("nEvents"), 1.5); // Before passing the condition - } + histos.fill(HIST("nEvents"), 1.5); // Before passing the condition - if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { - return; + if (cfgManualEvSel) { + auto [goodEv, code] = JeteventSelection(collision, true); + if (!goodEv) + return; } - if (cfgJetDataHistos) { - histos.fill(HIST("nEvents"), 2.5); // Events after event quality selection for Inclusive + + if (cfgJetEvSel) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelectionBits)) { + return; + } } + histos.fill(HIST("nEvents"), 2.5); // Events after event quality selection for Inclusive + std::vector jetpT{}; std::vector jetEta{}; std::vector jetPhi{}; @@ -1260,17 +1155,8 @@ struct kstarInOO { if (!HasJets) return; } - if (cfgJetDataHistos) { - histos.fill(HIST("nEvents"), 3.5); // Has jets - } - for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(jetTracks, jetTracks))) { - auto trk1 = track1.track_as(); - auto trk2 = track2.track_as(); - - JetminvReconstruction(collision, trk1, trk2, chargedjets, true, false); - JetminvReconstruction(collision, trk1, trk2, chargedjets, true, true); - } + histos.fill(HIST("nEvents"), 3.5); // Has jets bool INELgt0 = false; for (auto& jetTrack : jetTracks) { @@ -1287,6 +1173,9 @@ struct kstarInOO { } // jetTrack loop if (!INELgt0) return; + + JetTrackSlicing(collision, jetTracks, chargedjets, false, true); + } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1517,24 +1406,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) { @@ -1561,9 +1450,8 @@ struct kstarInOO { } auto [goodEv, code] = eventSelection(collision, true); - if (cfgDataHistos) { - histos.fill(HIST("nEvents"), 0.5); - } + histos.fill(HIST("nEvents"), 0.5); + if (!goodEv) return; @@ -1578,9 +1466,8 @@ struct kstarInOO { if (!INELgt0) return; - if (cfgDataHistos) { - histos.fill(HIST("nEvents"), 1.5); - } + histos.fill(HIST("nEvents"), 1.5); + TrackSlicing(collision, tracks, collision, tracks, false, true); } // processSameEvents From 5774e8dc2a300bd1c7da06084954d4e7006c40a5 Mon Sep 17 00:00:00 2001 From: jimun_lee Date: Tue, 3 Feb 2026 14:25:21 +0900 Subject: [PATCH 5/6] [PWGLF] Fixed the processJetData part of KstarInOO.cxx --- PWGLF/Tasks/Resonances/kstarInOO.cxx | 171 +++++++++++++-------------- 1 file changed, 84 insertions(+), 87 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 8892f931bdf..a731dead6a9 100644 --- a/PWGLF/Tasks/Resonances/kstarInOO.cxx +++ b/PWGLF/Tasks/Resonances/kstarInOO.cxx @@ -726,7 +726,7 @@ struct kstarInOO { if (lReso.M() < 0) continue; - fillMinv(MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + fillMinv(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); } // flip } // for } // TrackSlicing @@ -747,7 +747,7 @@ struct kstarInOO { if (lReso.M() < 0) continue; - fillMinv(MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + fillMinv(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); } // flip //====================== // Gen MC @@ -859,7 +859,7 @@ struct kstarInOO { } template - ROOT::Math::PxPyPzMVector 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 IsMix, const bool QA) { //====================== //| MinBias Event M_inv @@ -874,7 +874,7 @@ struct kstarInOO { if (lResonance.M() < 0) continue; - fillMinv(MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); + fillMinv(objectType::MB, trk1, trk2, lResonance, centrality, -1.0, IsMix, flip); //====================== //| Inside jets M_inv @@ -902,11 +902,10 @@ struct kstarInOO { } if (jetFlag) { - fillMinv(Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); + fillMinv(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); } // jetFlag } // flip } // Track - return {}; } // JetTrackSlicing template @@ -920,6 +919,9 @@ struct kstarInOO { auto trk1 = track1.template track_as(); auto trk2 = track2.template track_as(); + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + continue; + for (bool flip : {false, true}) { auto lResonance = minvReconstruction(trk1, trk2, QA, flip); if (lResonance.M() < 0) @@ -959,98 +961,97 @@ struct kstarInOO { //====================== //| MinBias True M_inv //====================== - if (trk1.has_mcParticle() && trk2.has_mcParticle()) { - auto particle1 = trk1.mcParticle(); - auto particle2 = trk2.mcParticle(); + auto particle1 = trk1.mcParticle(); + auto particle2 = trk2.mcParticle(); - if (!particle1.has_mothers() || !particle2.has_mothers()) { - return {}; - } + if (!particle1.has_mothers() || !particle2.has_mothers()) { + return {}; + } - std::vector mothers1{}; - std::vector mothers1PDG{}; - for (auto& particle1_mom : particle1.template mothers_as()) { - mothers1.push_back(particle1_mom.globalIndex()); - mothers1PDG.push_back(particle1_mom.pdgCode()); - } + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& particle1_mom : particle1.template mothers_as()) { + mothers1.push_back(particle1_mom.globalIndex()); + mothers1PDG.push_back(particle1_mom.pdgCode()); + } - 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()); - } + 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 (mothers1PDG[0] != 313) - return {}; // mother not K*0 - if (mothers2PDG[0] != 313) - return {}; // mothers not K*0 + if (mothers1PDG[0] != 313) + 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 + 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) - return {}; - if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) - return {}; + if (std::fabs(particle1.pdgCode()) != 211 && std::fabs(particle1.pdgCode()) != 321) + return {}; + if (std::fabs(particle2.pdgCode()) != 211 && std::fabs(particle2.pdgCode()) != 321) + return {}; - double track1_mass, track2_mass; - bool track1f{false}; // true means pion + double track1_mass, track2_mass; + bool track1f{false}; // true means pion - if (std::fabs(particle1.pdgCode()) == 211) { - track1f = true; - track1_mass = massPi; - } else { - track1_mass = massKa; - } + if (std::fabs(particle1.pdgCode()) == 211) { + track1f = true; + 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) { - return {}; - } - int mcindex1 = trk1.globalIndex(); - int mcindex2 = trk2.globalIndex(); - std::vector mcMemory; - - bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); - bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); - if (exists1 || exists2) { - return {}; + if (track1_mass == track2_mass) { + return {}; + } + int mcindex1 = trk1.globalIndex(); + int mcindex2 = trk2.globalIndex(); + std::vector mcMemory; + + bool exists1 = std::find(mcMemory.begin(), mcMemory.end(), mcindex1) != mcMemory.end(); + bool exists2 = std::find(mcMemory.begin(), mcMemory.end(), mcindex2) != mcMemory.end(); + if (exists1 || exists2) { + return {}; + } else { + mcMemory.push_back(trk1.globalIndex()); + mcMemory.push_back(trk2.globalIndex()); + } + + 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); + lTrueReso = lTrueDaughter1 + lTrueDaughter2; + + auto mult = collision.centFT0C(); + double conjugate = trk1.sign() * trk2.sign(); + if (cfgJetMCHistos) { + histos.fill(HIST("hUSS_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + if (track1f) { + histos.fill(HIST("hUSS_PiK_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); } else { - mcMemory.push_back(trk1.globalIndex()); - mcMemory.push_back(trk2.globalIndex()); + histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); } + } - 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); - lTrueReso = lTrueDaughter1 + lTrueDaughter2; - - auto mult = collision.centFT0C(); - double conjugate = trk1.sign() * trk2.sign(); - if (cfgJetMCHistos) { - histos.fill(HIST("hUSS_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - if (track1f) { - histos.fill(HIST("hUSS_PiK_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } else { - histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } + //=========================== + // INSIDE REC True Closure + //=========================== + if (jetFlag) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); } + } - //=========================== - // INSIDE REC True Closure - //=========================== - if (jetFlag) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); - } - } - } // has_mcParticle } // filp } // Tracks loop return {}; @@ -1123,7 +1124,6 @@ struct kstarInOO { return; } } - histos.fill(HIST("nEvents"), 2.5); // Events after event quality selection for Inclusive std::vector jetpT{}; @@ -1155,7 +1155,6 @@ struct kstarInOO { if (!HasJets) return; } - histos.fill(HIST("nEvents"), 3.5); // Has jets bool INELgt0 = false; @@ -1313,7 +1312,6 @@ struct kstarInOO { mothers1PDG.push_back(particle1_mom.pdgCode()); } - // std::cout< Date: Wed, 4 Feb 2026 11:44:41 +0900 Subject: [PATCH 6/6] ci: rerun tests