diff --git a/PWGLF/Tasks/Resonances/kstarInOO.cxx b/PWGLF/Tasks/Resonances/kstarInOO.cxx index 31d52ceee2a..a731dead6a9 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(objectType::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(objectType::MB, trk1, trk2, lReso, centrality, -1.0, IsMix, flip); + } // flip //====================== // Gen MC std::vector mcMemory; @@ -864,302 +859,202 @@ 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) + void 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(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"), 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(objectType::Jets, trk1, trk2, lResonance, centrality, jetpt, IsMix, flip); + } // jetFlag + } // flip + } // Track + } // 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 + 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(); - //====================== - //| 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); - } - } + if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) + 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()); + for (bool flip : {false, true}) { + auto lResonance = minvReconstruction(trk1, trk2, QA, flip); + if (lResonance.M() < 0) + continue; + + 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}; - } + //====================== + //| MinBias True M_inv + //====================== + auto particle1 = trk1.mcParticle(); + auto particle2 = trk2.mcParticle(); - 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 (!particle1.has_mothers() || !particle2.has_mothers()) { + return {}; + } - 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 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 (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 + 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 (mothers1[0] != mothers2[0]) - return {-1.0, -1.0}; // Kaon and pion not from the same K*0 + if (mothers1PDG[0] != 313) + return {}; // mother not K*0 + if (mothers2PDG[0] != 313) + return {}; // mothers not 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 (mothers1[0] != mothers2[0]) + return {}; // Kaon and pion not from the same K*0 - double track1_mass, track2_mass; - bool track1f{false}; // true means pion + 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) { - 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; + double track1_mass, track2_mass; + bool track1f{false}; // true means pion - 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 (std::fabs(particle1.pdgCode()) == 211) { + track1f = true; + track1_mass = massPi; + } else { + track1_mass = massKa; + } - 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()); + if (std::fabs(particle2.pdgCode()) == 211) { + track2_mass = massPi; } else { - histos.fill(HIST("hUSS_KPi_True_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + track2_mass = massKa; } - } - //=========================== - // INSIDE REC True Closure - //=========================== - if (jetFlag) { - if (conjugate < 0) { - histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + 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()); } - } - } // has_mcParticle + 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()); + } + } - 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}; - } + //=========================== + // INSIDE REC True Closure + //=========================== + if (jetFlag) { + if (conjugate < 0) { + histos.fill(HIST("hUSS_TrueRec_INSIDE_MC"), mult, lTrueReso.Pt(), lTrueReso.M()); + } + } + } // filp + } // Tracks loop + return {}; } // JetMCminvReconstruction //======================================================= @@ -1176,12 +1071,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,16 +1111,20 @@ 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{}; @@ -1260,17 +1155,7 @@ 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 +1172,9 @@ struct kstarInOO { } // jetTrack loop if (!INELgt0) return; + + JetTrackSlicing(collision, jetTracks, chargedjets, false, true); + } // ProcessDataJets PROCESS_SWITCH(kstarInOO, processDataJets, "process Data Jets", false); @@ -1424,7 +1312,6 @@ struct kstarInOO { mothers1PDG.push_back(particle1_mom.pdgCode()); } - // std::cout<()) { - 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 +1448,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; @@ -1577,10 +1463,8 @@ struct kstarInOO { } if (!INELgt0) return; + histos.fill(HIST("nEvents"), 1.5); - if (cfgDataHistos) { - histos.fill(HIST("nEvents"), 1.5); - } TrackSlicing(collision, tracks, collision, tracks, false, true); } // processSameEvents