From 8abf6cb753bd1992a50ebd016eb1cd0a73ee01f6 Mon Sep 17 00:00:00 2001 From: murioni Date: Tue, 28 Jan 2025 11:51:48 +0100 Subject: [PATCH 1/5] adding manual cuts on track quality --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 36 ++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index 71abc9c6161..abd96a130ef 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -87,7 +87,10 @@ struct k892analysis_PbPb { Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor - + Configurable cfgUseITSTPCrefit{"cfgUseITSTPCrefit", true, "Use ITS and TPC refit"}; + Configurable cfgITSChi2Ncl{"cfgITSChi2Ncl", 999.0, "ITS Chi2/NCl"}; + Configurable cfgTPCChi2Ncl{"cfgTPCChi2Ncl", 999.0, "TPC Chi2/NCl"}; + Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; @@ -180,10 +183,14 @@ struct k892analysis_PbPb { if (additionalQAplots) { // TPC ncluster distirbutions - histos.add("TPCncluster/TPCnclusterpi", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); - histos.add("TPCncluster/TPCnclusterka", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); - histos.add("TPCncluster/TPCnclusterPhipi", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); - histos.add("TPCncluster/TPCnclusterPhika", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + histos.add("Ncluster/TPCnclusterpi", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); + histos.add("Ncluster/TPCnclusterka", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); + histos.add("Ncluster/TPCnclusterPhipi", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + histos.add("Ncluster/TPCnclusterPhika", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + + histos.add("Ncluster/TPCChi2ncluster", "TPC Chi2ncluster distribution", kTH1F, {{100, 0, 10, "TPC Chi2nCluster"}}); + histos.add("Ncluster/ITSChi2ncluster", "ITS Chi2ncluster distribution", kTH1F, {{100, 0, 40, "ITS Chi2nCluster"}}); + histos.add("Ncluster/ITSncluster", "ITS ncluster distribution", kTH1F, {{10, 0, 10, "ITS nCluster"}}); } // DCA QA @@ -275,6 +282,10 @@ struct k892analysis_PbPb { return false; if (track.tpcNClsFound() < cfgTPCcluster) return false; + if (track.itsChi2NCl() > cfgITSChi2Ncl) + return false; + if (track.tpcChi2NCl() > cfgTPCChi2Ncl) + return false; if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) return false; if (cfgPVContributor && !track.isPVContributor()) @@ -285,7 +296,9 @@ struct k892analysis_PbPb { return false; if (cfgGlobalTrack && !track.isGlobalTrack()) return false; - + if(cfgUseITSTPCrefit && (!(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit))) + return false; + return true; } @@ -406,10 +419,13 @@ struct k892analysis_PbPb { if (additionalQAplots && !IsMix && !IsRot) { // TPCncluster distributions - histos.fill(HIST("TPCncluster/TPCnclusterpi"), trk1.tpcNClsFound()); - histos.fill(HIST("TPCncluster/TPCnclusterka"), trk2.tpcNClsFound()); - histos.fill(HIST("TPCncluster/TPCnclusterPhipi"), trk1.tpcNClsFound(), trk1.phi()); - histos.fill(HIST("TPCncluster/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2.phi()); + histos.fill(HIST("Ncluster/TPCnclusterpi"), trk1.tpcNClsFound()); + histos.fill(HIST("Ncluster/TPCnclusterka"), trk2.tpcNClsFound()); + histos.fill(HIST("Ncluster/TPCnclusterPhipi"), trk1.tpcNClsFound(), trk1.phi()); + histos.fill(HIST("Ncluster/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2.phi()); + histos.fill(HIST("Ncluster/TPCChi2ncluster"), trk1.tpcChi2NCl()); + histos.fill(HIST("Ncluster/ITSChi2ncluster"), trk1.itsChi2NCl()); + histos.fill(HIST("Ncluster/ITSncluster"), trk1.itsNCls()); } if constexpr (!IsMix && !IsRot) { From 36e8e2d194f9208527769454965e377f4b738b1e Mon Sep 17 00:00:00 2001 From: murioni Date: Thu, 30 Jan 2025 17:58:17 +0100 Subject: [PATCH 2/5] latest changes in k892ana --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 543 ++++++++----------- 1 file changed, 241 insertions(+), 302 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index abd96a130ef..e6941ff9850 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -9,7 +9,9 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -/// \author Marta Urioni +/// +/// \brief K*0 spectra in Pb-Pb +/// \author Marta Urioni #include #include @@ -22,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -77,6 +78,8 @@ struct k892analysis_PbPb { // presel Configurable cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; + Configurable cfgCutMaxOccupancy{"cfgCutMaxOccupancy", 2000.0f, "Accepted maximum Occupancy"}; + Configurable cfgApplyOccupancyCut{"cfgApplyOccupancyCut", false, "Apply maximum Occupancy"}; // Track selections Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; @@ -101,19 +104,19 @@ struct k892analysis_PbPb { Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF Configurable cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection - Configurable TofandTpcPID{"TOFandTPCPID", false, "apply both TOF and TPC PID"}; + Configurable tofAndTpcPID{"tofAndTpcPID", false, "apply both TOF and TPC PID"}; Configurable tpclowpt{"tpclowpt", true, "apply TPC at low pt"}; Configurable tofhighpt{"tofhighpt", false, "apply TOF at high pt"}; // rotational bkg Configurable cfgNoRotations{"cfgNoRotations", 3, "Number of rotations per pair for rotbkg"}; - Configurable rotational_cut{"rotational_cut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; + Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; // event mixing Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; - ConfigurableAxis CfgVtxBins{"CfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; - ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfgMultBins{"cfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; // cuts on mother Configurable cfgCutsOnMother{"cfgCutsOnMother", false, "Enamble additional cuts on mother"}; @@ -130,7 +133,6 @@ struct k892analysis_PbPb { Configurable additionalMEPlots{"additionalMEPlots", false, "Additional Mixed event plots"}; // MC - Configurable genacceptancecut{"genacceptancecut", false, "Acceptance cut on generated MC particles"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; TRandom* rand = new TRandom(); @@ -146,7 +148,7 @@ struct k892analysis_PbPb { AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit}; - if (doprocessSameEvent || doprocessSameEventRun2 || doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { + if ((!doprocessMC && !doprocessMCRun2) || doprocessMixedEventMC || doprocessMixedEventMCRun2) { // event histograms histos.add("QAevent/hEvtCounterSameE", "Number of analyzed Same Events", HistType::kTH1F, {{1, 0.5, 1.5}}); histos.add("QAevent/hMultiplicityPercentSameE", "Multiplicity percentile of collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); @@ -173,7 +175,7 @@ struct k892analysis_PbPb { histos.add("k892invmassDSAnti", "Invariant mass of Anti-K(892)0 different sign", kTH1F, {invMassAxis}); histos.add("k892invmassLS", "Invariant mass of K(892)0 like sign", kTH1F, {invMassAxis}); histos.add("k892invmassLSAnti", "Invariant mass of Anti-K(892)0 like sign", kTH1F, {invMassAxis}); - if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { + if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC || doprocessMixedEventMCRun2) { histos.add("k892invmassME", "Invariant mass of K(892)0 mixed event", kTH1F, {invMassAxis}); if (additionalMEPlots) { histos.add("k892invmassME_DS", "Invariant mass of K(892)0 mixed event DS", kTH1F, {invMassAxis}); @@ -223,7 +225,7 @@ struct k892analysis_PbPb { histos.add("h3k892invmassRotDSAnti", "Invariant mass of Anti-K(892)0 Rotational Bkg", kTH3F, {centAxis, ptAxis, invMassAxis}); } - if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { + if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC || doprocessMixedEventMCRun2) { histos.add("h3k892invmassME", "Invariant mass of K(892)0 mixed event", kTH3F, {centAxis, ptAxis, invMassAxis}); if (additionalMEPlots) { @@ -240,7 +242,7 @@ struct k892analysis_PbPb { } if (doprocessMC || doprocessMCRun2) { - histos.add("hMCrecCollSels", "MC Event statistics", HistType::kTH1F, {{10, 0.0f, 10.0f}}); + histos.add("QAevent/hMCrecCollSels", "MC Event statistics", HistType::kTH1F, {{10, 0.0f, 10.0f}}); histos.add("QAevent/hMultiplicityPercentMC", "Multiplicity percentile of MCrec collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); histos.add("h1k892Recsplit", "k892 Rec split", HistType::kTH1F, {{200, 0.0f, 20.0f}}); @@ -274,8 +276,48 @@ struct k892analysis_PbPb { double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiPlus; + + template + bool myEventSelections(const CollType& coll) + { + if (!coll.sel8()) + return false; + if (std::abs(coll.posZ()) > cfgCutVertex) + return false; + if (timFrameEvsel && (!coll.selection_bit(aod::evsel::kNoTimeFrameBorder) || !coll.selection_bit(aod::evsel::kNoITSROFrameBorder))) + return false; + if (additionalEvSel2 && (!coll.selection_bit(aod::evsel::kNoSameBunchPileup) || !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) + return false; + if (additionalEvSel3 && (!coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) + return false; + auto centrality = coll.centFT0C(); + if(centrality > cfgCutCentrality) + return false; + auto occupancy = coll.trackOccupancyInTimeRange(); + if(cfgApplyOccupancyCut && (occupancy > cfgCutMaxOccupancy)) + return false; + + return true; + } + + + template + bool myEventSelectionsRun2(const CollType& coll, const bcType&) + { + auto bc = coll.template bc_as(); + if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) + return false; + if (std::abs(coll.posZ()) > cfgCutVertex) + return false; + auto centrality = coll.centRun2V0M(); + if (centrality > cfgCutCentrality) + return false; + + return true; + } + template - bool trackCut(const TrackType track) + bool trackCut(const TrackType& track) { // basic track cuts if (track.itsNCls() < cfgITScluster) @@ -306,7 +348,7 @@ struct k892analysis_PbPb { bool selectionPIDKaon(const T& candidate) { - if (TofandTpcPID) { + if (tofAndTpcPID) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) <= cMaxTOFnSigmaKaon && candidate.hasTPC() && std::abs(candidate.tpcNSigmaKa()) <= cMaxTPCnSigmaKaon) { // tof and tpc cut return true; @@ -336,7 +378,7 @@ struct k892analysis_PbPb { bool selectionPIDPion(const T& candidate) { - if (TofandTpcPID) { + if (tofAndTpcPID) { if (candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) <= cMaxTOFnSigmaPion && candidate.hasTPC() && std::abs(candidate.tpcNSigmaPi()) <= cMaxTPCnSigmaPion) { // tof and tpc cut return true; @@ -373,8 +415,8 @@ struct k892analysis_PbPb { multiplicity = collision.centRun2V0M(); auto oldindex = -999; - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance, ldaughter_rot, lResonance_rot; - for (auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) { + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance, ldaughterRot, lResonanceRot; + for (const auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks1, dTracks2))) { // Full index policy is needed to consider all possible combinations if (trk1.index() == trk2.index()) continue; // We need to run (0,1), (1,0) pairs as well. but same id pairs are not needed. @@ -471,7 +513,7 @@ struct k892analysis_PbPb { lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; // Rapidity cut - if (abs(lResonance.Rapidity()) >= 0.5) + if (std::abs(lResonance.Rapidity()) >= 0.5) continue; if (cfgCutsOnMother && !IsRot) { if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow @@ -484,25 +526,27 @@ struct k892analysis_PbPb { if (track1Sign * track2Sign < 0) { if constexpr (IsRot) { // rotational background for (int i = 0; i < cfgNoRotations; i++) { - float theta2 = rand->Uniform(TMath::Pi() - TMath::Pi() / rotational_cut, TMath::Pi() + TMath::Pi() / rotational_cut); - ldaughter_rot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta2, massKa); - lResonance_rot = lDecayDaughter1 + ldaughter_rot; + float theta2 = rand->Uniform(o2::constants::math::PI - o2::constants::math::PI/rotationalCut, o2::constants::math::PI + o2::constants::math::PI/rotationalCut); + ldaughterRot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta2, massKa); + lResonanceRot = lDecayDaughter1 + ldaughterRot; if (cfgCutsOnMother) { - if (lResonance_rot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + if (lResonanceRot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow continue; - if (lResonance_rot.M() >= cMaxMinvMotherCut) // excluding candidates in overflow + if (lResonanceRot.M() >= cMaxMinvMotherCut) // excluding candidates in overflow continue; } if (track1Sign < 0) { - histos.fill(HIST("k892invmassRotDS"), lResonance_rot.M()); - histos.fill(HIST("h3k892invmassRotDS"), multiplicity, lResonance_rot.Pt(), lResonance_rot.M()); + histos.fill(HIST("k892invmassRotDS"), lResonanceRot.M()); + histos.fill(HIST("h3k892invmassRotDS"), multiplicity, lResonanceRot.Pt(), lResonanceRot.M()); } else if (track1Sign > 0) { histos.fill(HIST("k892invmassRotDSAnti"), lResonance.M()); - histos.fill(HIST("h3k892invmassRotDSAnti"), multiplicity, lResonance_rot.Pt(), lResonance_rot.M()); + histos.fill(HIST("h3k892invmassRotDSAnti"), multiplicity, lResonanceRot.Pt(), lResonanceRot.M()); } } + + } else if constexpr (!IsMix) { // same event if (track1Sign < 0) { histos.fill(HIST("k892invmassDS"), lResonance.M()); @@ -511,6 +555,8 @@ struct k892analysis_PbPb { histos.fill(HIST("k892invmassDSAnti"), lResonance.M()); histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); } + + } else { // mixed event histos.fill(HIST("k892invmassME"), lResonance.M()); histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); @@ -533,8 +579,8 @@ struct k892analysis_PbPb { const auto mctrack1 = trk1.mcParticle(); const auto mctrack2 = trk2.mcParticle(); - int track1PDG = TMath::Abs(mctrack1.pdgCode()); - int track2PDG = TMath::Abs(mctrack2.pdgCode()); + int track1PDG = std::abs(mctrack1.pdgCode()); + int track2PDG = std::abs(mctrack2.pdgCode()); if (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary()) continue; @@ -544,14 +590,15 @@ struct k892analysis_PbPb { bool ismotherok = false; int pdgcodeMother = -999; - for (auto& mothertrack1 : mctrack1.template mothers_as()) { - for (auto& mothertrack2 : mctrack2.template mothers_as()) { + for (const auto& mothertrack1 : mctrack1.template mothers_as()) { + for (const auto& mothertrack2 : mctrack2.template mothers_as()) { if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) continue; if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) continue; - if (TMath::Abs(mothertrack1.pdgCode()) != 313) + if (std::abs(mothertrack1.pdgCode()) != 313) continue; + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { histos.fill(HIST("h1k892Recsplit"), mothertrack1.pt()); continue; @@ -587,6 +634,8 @@ struct k892analysis_PbPb { histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M()); } } + + } else if (track1Sign * track2Sign > 0) { if constexpr (!IsMix) { if (track1Sign < 0) { @@ -604,12 +653,28 @@ struct k892analysis_PbPb { Filter collisionFilter = nabs(aod::collision::posZ) <= cfgCutVertex; Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfgCutCentrality; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) >= cfgCutPT); - Filter DCAcutFilter = (nabs(aod::track::dcaXY) <= cfgCutDCAxy) && (nabs(aod::track::dcaZ) <= cfgCutDCAz); + Filter dcaCutFilter = (nabs(aod::track::dcaXY) <= cfgCutDCAxy) && (nabs(aod::track::dcaZ) <= cfgCutDCAz); + // Data using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; + // MC + using EventCandidatesMCrec = soa::Join; + using TrackCandidatesMCrec = soa::Filtered>; + // ME run 3 + using BinningTypeVtxCent = ColumnBinningPolicy; + + // Data Run 2 + using Run2Events = soa::Join; //, aod::TrackletMults>; + using BCsWithRun2Info = soa::Join; + // MC Run2 + using EventCandidatesMCrecRun2 = soa::Join; // aod::TrackletMults>; + // ME run 2 + using BinningTypeVtxCentRun2 = ColumnBinningPolicy; + + // partitions tpc low pt Partition negPitpc = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) < cMaxPtTPC); Partition posKatpc = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) < cMaxPtTPC); @@ -624,192 +689,143 @@ struct k892analysis_PbPb { Partition posPitof = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtof::tofNSigmaPi) <= cMaxTOFnSigmaPion) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) > cMinPtTOF); Partition negKatof = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtof::tofNSigmaKa) <= cMaxTOFnSigmaKaon) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) > cMinPtTOF); - void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + + template + void callFillHistoswithPartitions(const CollisionType& collision, const TracksType& ) { - if (!collision.sel8()) { - return; - } - auto centrality = collision.centFT0C(); - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } - if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; - } - if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - } - // int occupancy = collision.trackOccupancyInTimeRange(); - - histos.fill(HIST("QAevent/hEvtCounterSameE"), 1); - histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), centrality); - - if (additionalQAeventPlots) { - histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); - histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); - } - if (tpclowpt) { //+- auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - - fillHistograms(collision, candPosPitpc, candNegKatpc); + + fillHistograms(collision, candPosPitpc, candNegKatpc); //-+ auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - fillHistograms(collision, candNegPitpc, candPosKatpc); + fillHistograms(collision, candNegPitpc, candPosKatpc); } else if (tofhighpt) { //+- auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - fillHistograms(collision, candPosPitof, candNegKatof); + fillHistograms(collision, candPosPitof, candNegKatof); //-+ auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - fillHistograms(collision, candNegPitof, candPosKatof); + fillHistograms(collision, candNegPitof, candPosKatof); } } - PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", true); - void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const&, aod::BCs const&) - { - if (!collision.sel8()) { - return; - } - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } - if (additionalEvSel2 && (!collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; - } - if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - return; - } - // int occupancy = collision.trackOccupancyInTimeRange(); + template + void callFillHistoswithPartitionsMixedEvt(const CollisionType& collision1, const TracksType& , const CollisionType& collision2, const TracksType&) + { if (tpclowpt) { //+- - auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - - fillHistograms(collision, candPosPitpc, candNegKatpc); + auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + + fillHistograms(collision1, candPosPitpc, candNegKatpc); //-+ - auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision, candNegPitpc, candPosKatpc); + fillHistograms(collision1, candNegPitpc, candPosKatpc); } else if (tofhighpt) { //+- - auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision, candPosPitof, candNegKatof); + fillHistograms(collision1, candPosPitof, candNegKatof); //-+ - auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision, candNegPitof, candPosKatof); + fillHistograms(collision1, candNegPitof, candPosKatof); } } - PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkg, "Process Rotational Background", false); - ///////*************************************** - - using Run2Events = soa::Join; //, aod::TrackletMults>; - using BCsWithRun2Info = soa::Join; - - void processSameEventRun2(Run2Events::iterator const& collision, TrackCandidates const& tracks, BCsWithRun2Info const&) + + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { - auto bc = collision.bc_as(); - // if (!collision.alias_bit(kINT7)) - // return; + if(!myEventSelections(collision)) + return; - // if (!collision.sel7()) - // return; + auto centrality = collision.centFT0C(); - if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) - return; + histos.fill(HIST("QAevent/hEvtCounterSameE"), 1); + histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), centrality); - if (std::abs(collision.posZ()) > cfgCutVertex) - return; + if (additionalQAeventPlots) { + histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); + histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); + } + // + callFillHistoswithPartitions(collision, tracks); + + } + PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", true); - auto centrality = collision.centRun2V0M(); - if (centrality > cfgCutCentrality) + void processSameEventRun2(Run2Events::iterator const& collision, TrackCandidates const& tracks, BCsWithRun2Info const& bcs) + { + + if(!myEventSelectionsRun2(collision,bcs)) return; - + histos.fill(HIST("QAevent/hEvtCounterSameE"), 1); histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), centrality); + histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), collision.centRun2V0M()); if (additionalQAeventPlots) { histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); } - if (tpclowpt) { - //+- - auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + // + callFillHistoswithPartitions(collision, tracks); + + } + PROCESS_SWITCH(k892analysis_PbPb, processSameEventRun2, "Process Same event Run2", false); - fillHistograms(collision, candPosPitpc, candNegKatpc); - //-+ - auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + { - fillHistograms(collision, candNegPitpc, candPosKatpc); + if(!myEventSelections(collision)) + return; - } else if (tofhighpt) { - //+- - auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + // + callFillHistoswithPartitions(collision, tracks); - fillHistograms(collision, candPosPitof, candNegKatof); + } + PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkg, "Process Rotational Background", false); - //-+ - auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - fillHistograms(collision, candNegPitof, candPosKatof); - } - } - PROCESS_SWITCH(k892analysis_PbPb, processSameEventRun2, "Process Same event Run2", false); - using BinningTypeVtxCent = ColumnBinningPolicy; void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) { auto tracksTuple = std::make_tuple(tracks); - BinningTypeVtxCent colBinning{{CfgVtxBins, CfgMultBins}, true}; + BinningTypeVtxCent colBinning{{cfgVtxBins, cfgMultBins}, true}; SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if (!collision1.sel8() || !collision2.sel8()) { - continue; - } - auto centrality = collision1.centFT0C(); + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if (timFrameEvsel && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } - if (additionalEvSel2 && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + if(!myEventSelections(collision1) || !myEventSelections(collision2)) continue; - } + + auto centrality = collision1.centFT0C(); if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); @@ -818,131 +834,53 @@ struct k892analysis_PbPb { histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); } + + // + callFillHistoswithPartitionsMixedEvt(collision1, tracks1, collision2, tracks2); - if (tpclowpt) { - - //+- - auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candPosPitpc, candNegKatpc); - - //-+ - auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candNegPitpc, candPosKatpc); - - } else if (tofhighpt) { - - //+- - auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candPosPitof, candNegKatof); - - //-+ - auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candNegPitof, candPosKatof); - } } } PROCESS_SWITCH(k892analysis_PbPb, processMixedEvent, "Process Mixed event", true); - using BinningTypeVtxCentRun2 = ColumnBinningPolicy; - void processMixedEventRun2(Run2Events const& collisions, TrackCandidates const& tracks, BCsWithRun2Info const&) + + void processMixedEventRun2(Run2Events const& collisions, TrackCandidates const& tracks, BCsWithRun2Info const& bcs) { auto tracksTuple = std::make_tuple(tracks); - BinningTypeVtxCentRun2 colBinning{{CfgVtxBins, CfgMultBins}, true}; + BinningTypeVtxCentRun2 colBinning{{cfgVtxBins, cfgMultBins}, true}; SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { - - auto bc1 = collision1.bc_as(); - auto bc2 = collision2.bc_as(); - - if (!(bc1.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted)) || !(bc2.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) - continue; - - if ((std::abs(collision1.posZ()) > cfgCutVertex) || (std::abs(collision2.posZ()) > cfgCutVertex)) - continue; - - auto centrality1 = collision1.centRun2V0M(); - auto centrality2 = collision2.centRun2V0M(); + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if ((centrality1 > cfgCutCentrality) || (centrality2 > cfgCutCentrality)) + if(!myEventSelectionsRun2(collision1, bcs) || !myEventSelectionsRun2(collision2, bcs)) continue; - + if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); - histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), centrality1); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), collision1.centRun2V0M()); histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); } - if (tpclowpt) { - - //+- - auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candPosPitpc, candNegKatpc); - - //-+ - auto candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candNegPitpc, candPosKatpc); - - } else if (tofhighpt) { - - //+- - auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candPosPitof, candNegKatof); - - //-+ - auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - - fillHistograms(collision1, candNegPitof, candPosKatof); - } + // + callFillHistoswithPartitionsMixedEvt(collision1, tracks1, collision2, tracks2); + } } PROCESS_SWITCH(k892analysis_PbPb, processMixedEventRun2, "Process Mixed event Run2", false); - // MC - - using EventCandidatesMCrec = soa::Join; - using TrackCandidatesMCrec = soa::Filtered>; void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks) { auto tracksTuple = std::make_tuple(RecTracks); - BinningTypeVtxCent colBinning{{CfgVtxBins, CfgMultBins}, true}; + BinningTypeVtxCent colBinning{{cfgVtxBins, cfgMultBins}, true}; SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, recCollisions, tracksTuple, &cache}; - for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if (!collision1.sel8() || !collision2.sel8()) { - continue; - } - if (TMath::Abs(collision1.posZ()) > cfgCutVertex || TMath::Abs(collision2.posZ()) > cfgCutVertex) { - continue; - } - if (timFrameEvsel && (!collision1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } - if (additionalEvSel2 && (!collision1.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision2.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { - continue; - } + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if(!myEventSelections(collision1) || !myEventSelections(collision2)) + continue; + if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); @@ -951,53 +889,66 @@ struct k892analysis_PbPb { histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); } + // fillHistograms(collision1, tracks1, tracks2); } } PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMC, "Process Mixed event MC", false); - void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) + void processMixedEventMCRun2(EventCandidatesMCrecRun2 const& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const& bcs) { - histos.fill(HIST("hMCrecCollSels"), 0); + auto tracksTuple = std::make_tuple(RecTracks); + BinningTypeVtxCentRun2 colBinning{{cfgVtxBins, cfgMultBins}, true}; + SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, recCollisions, tracksTuple, &cache}; + + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + + if(!myEventSelectionsRun2(collision1, bcs) || !myEventSelectionsRun2(collision2, bcs)) + continue; + + if (additionalQAeventPlots) { + histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); + histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), collision1.centRun2V0M()); + histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); + histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); + } + + // + fillHistograms(collision1, tracks1, tracks2); + } + } + PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMCRun2, "Process Mixed event MC Run2", false); + + + void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) + { + histos.fill(HIST("QAevent/hMCrecCollSels"), 0); if (recCollisions.size() == 0) { - histos.fill(HIST("hMCrecCollSels"), 1); + histos.fill(HIST("QAevent/hMCrecCollSels"), 1); return; } if (recCollisions.size() > 1) { - histos.fill(HIST("hMCrecCollSels"), 2); + histos.fill(HIST("QAevent/hMCrecCollSels"), 2); return; } - for (auto& RecCollision : recCollisions) { - histos.fill(HIST("hMCrecCollSels"), 3); - if (!RecCollision.sel8()) { - continue; - } - histos.fill(HIST("hMCrecCollSels"), 4); - if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) { - continue; - } - histos.fill(HIST("hMCrecCollSels"), 5); - if (timFrameEvsel && (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } - histos.fill(HIST("hMCrecCollSels"), 6); - if (additionalEvSel2 && (!RecCollision.selection_bit(aod::evsel::kNoSameBunchPileup) || !RecCollision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - histos.fill(HIST("hMCrecCollSels"), 7); - if (additionalEvSel3 && (!RecCollision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + for (const auto& RecCollision : recCollisions) { + histos.fill(HIST("QAevent/hMCrecCollSels"), 3); + + if(!myEventSelections(RecCollision)) continue; - } - histos.fill(HIST("hMCrecCollSels"), 8); + histos.fill(HIST("QAevent/hMCrecCollSels"), 8); auto centrality = RecCollision.centFT0C(); histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); + + // fillHistograms(RecCollision, tracks, tracks); // Generated MC - for (auto& mcPart : mcParticles) { - if (abs(mcPart.y()) >= 0.5 || abs(mcPart.pdgCode()) != 313) + for (const auto& mcPart : mcParticles) { + if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313) continue; auto kDaughters = mcPart.daughters_as(); @@ -1009,16 +960,14 @@ struct k892analysis_PbPb { auto daughtp = false; auto daughtk = false; - for (auto kCurrentDaughter : kDaughters) { + for (const auto& kCurrentDaughter : kDaughters) { if (!kCurrentDaughter.isPhysicalPrimary()) break; - if (genacceptancecut && (kCurrentDaughter.pt() < cfgCutPT || TMath::Abs(kCurrentDaughter.eta()) > cfgCutEta)) - break; - if (abs(kCurrentDaughter.pdgCode()) == 211) { + if (std::abs(kCurrentDaughter.pdgCode()) == 211) { daughtp = true; lDecayDaughter1.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPi); - } else if (abs(kCurrentDaughter.pdgCode()) == 321) { + } else if (std::abs(kCurrentDaughter.pdgCode()) == 321) { daughtk = true; lDecayDaughter2.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); } @@ -1047,42 +996,35 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processMC, "Process Monte Carlo", false); - // MC Run2 - - using EventCandidatesMCrecRun2 = soa::Join; // aod::TrackletMults>; - void processMCRun2(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const&) + void processMCRun2(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const& bcs) { - histos.fill(HIST("hMCrecCollSels"), 0); + histos.fill(HIST("QAevent/hMCrecCollSels"), 0); if (recCollisions.size() == 0) { - histos.fill(HIST("hMCrecCollSels"), 1); + histos.fill(HIST("QAevent/hMCrecCollSels"), 1); return; } if (recCollisions.size() > 1) { - histos.fill(HIST("hMCrecCollSels"), 2); + histos.fill(HIST("QAevent/hMCrecCollSels"), 2); return; } - for (auto& RecCollision : recCollisions) { - auto bc = RecCollision.bc_as(); - histos.fill(HIST("hMCrecCollSels"), 3); - - if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) - continue; - histos.fill(HIST("hMCrecCollSels"), 4); - - if (std::abs(RecCollision.posZ()) > cfgCutVertex) + for (const auto& RecCollision : recCollisions) { + histos.fill(HIST("QAevent/hMCrecCollSels"), 3); + + if(!myEventSelectionsRun2(RecCollision, bcs)) continue; - histos.fill(HIST("hMCrecCollSels"), 5); - + histos.fill(HIST("QAevent/hMCrecCollSels"), 8); + auto centrality = RecCollision.centRun2V0M(); - histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); + + // fillHistograms(RecCollision, tracks, tracks); // Generated MC - for (auto& mcPart : mcParticles) { - if (abs(mcPart.y()) >= 0.5 || abs(mcPart.pdgCode()) != 313) + for (const auto& mcPart : mcParticles) { + if (std::abs(mcPart.y()) >= 0.5 || std::abs(mcPart.pdgCode()) != 313) continue; auto kDaughters = mcPart.daughters_as(); @@ -1094,16 +1036,14 @@ struct k892analysis_PbPb { auto daughtp = false; auto daughtk = false; - for (auto kCurrentDaughter : kDaughters) { + for (const auto& kCurrentDaughter : kDaughters) { if (!kCurrentDaughter.isPhysicalPrimary()) break; - if (genacceptancecut && (kCurrentDaughter.pt() < cfgCutPT || TMath::Abs(kCurrentDaughter.eta()) > cfgCutEta)) - break; - if (abs(kCurrentDaughter.pdgCode()) == 211) { + if (std::abs(kCurrentDaughter.pdgCode()) == 211) { daughtp = true; lDecayDaughter1.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPi); - } else if (abs(kCurrentDaughter.pdgCode()) == 321) { + } else if (std::abs(kCurrentDaughter.pdgCode()) == 321) { daughtk = true; lDecayDaughter2.SetXYZM(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); } @@ -1134,6 +1074,5 @@ struct k892analysis_PbPb { }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"k892analysis_PbPb"})}; + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"k892analysis_PbPb"})}; } From cb632cb760f6b89011d3ead474f59317b9499c0a Mon Sep 17 00:00:00 2001 From: murioni Date: Thu, 6 Feb 2025 18:40:59 +0100 Subject: [PATCH 3/5] adding QA plots and rotational bkg for MC --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 71 +++++++++++++++++--- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index e6941ff9850..6f368bba888 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -112,6 +112,8 @@ struct k892analysis_PbPb { // rotational bkg Configurable cfgNoRotations{"cfgNoRotations", 3, "Number of rotations per pair for rotbkg"}; Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; + Configurable cfgRotPi{"cfgRotPi", true, "rotate Pion"}; + // event mixing Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; @@ -145,6 +147,8 @@ struct k892analysis_PbPb { AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisMom = {binsPt, "Mom #it{p}_{T} (GeV/#it{c})"}; + AxisSpec ptAxisDau = {binsPtQA, "Dau #it{p}_{T} (GeV/#it{c})"}; AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; AxisSpec pidQAAxis = {cPIDBins, -cPIDQALimit, cPIDQALimit}; @@ -192,9 +196,19 @@ struct k892analysis_PbPb { histos.add("Ncluster/TPCChi2ncluster", "TPC Chi2ncluster distribution", kTH1F, {{100, 0, 10, "TPC Chi2nCluster"}}); histos.add("Ncluster/ITSChi2ncluster", "ITS Chi2ncluster distribution", kTH1F, {{100, 0, 40, "ITS Chi2nCluster"}}); - histos.add("Ncluster/ITSncluster", "ITS ncluster distribution", kTH1F, {{10, 0, 10, "ITS nCluster"}}); + histos.add("Ncluster/ITSncluster", "ITS ncluster distribution", kTH1F, {{10, 0, 10, "ITS nCluster"}}); + + histos.add("QA/h2k892ptMothervsptPiDS", "Pt of K(892)0 differnt sign vs pt pion daughter", kTH2F, {ptAxisMom, ptAxisDau}); + histos.add("QA/h2k892ptMothervsptPiDSAnti", "Pt of Anti-K(892)0 differnt sign vs pt pion daughter", kTH2F, {ptAxisMom, ptAxisDau}); + histos.add("QA/h2k892ptMothervsptKaDS", "Pt of K(892)0 differnt sign vs pt kaon daughter", kTH2F, {ptAxisMom, ptAxisDau}); + histos.add("QA/h2k892ptMothervsptKaDSAnti", "Pt of Anti-K(892)0 differnt sign vs pt kaon daughter", kTH2F, {ptAxisMom, ptAxisDau}); + + histos.add("QAME/h2k892ptMothervsptPiDS", "Pt of Mother vs pt pion daughter, Mixed Event", kTH2F, {ptAxisMom, ptAxisDau}); + histos.add("QAME/h2k892ptMothervsptPiDSAnti", "Pt of Anti-Mother vs pt pion daughter, Mixed Event", kTH2F, {ptAxisMom, ptAxisDau}); + histos.add("QAME/h2k892ptMothervsptKaDS", "Pt of Mother vs pt kaon daughter, Mixed Event", kTH2F, {ptAxisMom, ptAxisDau}); + histos.add("QAME/h2k892ptMothervsptKaDSAnti", "Pt of Anti-Mother vs pt pion daughter, Mixed Event", kTH2F, {ptAxisMom, ptAxisDau}); } - + // DCA QA histos.add("QA/trkDCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxis}); histos.add("QA/trkDCAxy_ka", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {dcaxyAxis}); @@ -217,7 +231,8 @@ struct k892analysis_PbPb { histos.add("h3k892invmassLS", "Invariant mass of K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892invmassLSAnti", "Invariant mass of Anti-K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis}); - if (doprocessRotationalBkg) { + + if (doprocessRotationalBkg || doprocessRotationalBkgMC) { histos.add("k892invmassRotDS", "Invariant mass of K(892)0 RotBkg", kTH1F, {invMassAxis}); histos.add("k892invmassRotDSAnti", "Invariant mass of Anti-K(892)0 RotBkg", kTH1F, {invMassAxis}); @@ -526,10 +541,15 @@ struct k892analysis_PbPb { if (track1Sign * track2Sign < 0) { if constexpr (IsRot) { // rotational background for (int i = 0; i < cfgNoRotations; i++) { - float theta2 = rand->Uniform(o2::constants::math::PI - o2::constants::math::PI/rotationalCut, o2::constants::math::PI + o2::constants::math::PI/rotationalCut); - ldaughterRot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta2, massKa); - lResonanceRot = lDecayDaughter1 + ldaughterRot; - + float theta = rand->Uniform(o2::constants::math::PI - o2::constants::math::PI/rotationalCut, o2::constants::math::PI + o2::constants::math::PI/rotationalCut); + if (cfgRotPi) { + ldaughterRot.SetPtEtaPhiM(trk1.pt(), trk1.eta(), trk1.phi() + theta, massPi); + lResonanceRot = lDecayDaughter2 + ldaughterRot; + } else { + ldaughterRot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta, massKa); + lResonanceRot = lDecayDaughter1 + ldaughterRot; + } + if (cfgCutsOnMother) { if (lResonanceRot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow continue; @@ -551,9 +571,17 @@ struct k892analysis_PbPb { if (track1Sign < 0) { histos.fill(HIST("k892invmassDS"), lResonance.M()); histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M()); + if(additionalQAplots) { + histos.fill(HIST("QA/h2k892ptMothervsptPiDS"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QA/h2k892ptMothervsptKaDS"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } else if (track1Sign > 0) { histos.fill(HIST("k892invmassDSAnti"), lResonance.M()); histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + if(additionalQAplots) { + histos.fill(HIST("QA/h2k892ptMothervsptPiDSAnti"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QA/h2k892ptMothervsptKaDSAnti"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } @@ -564,15 +592,23 @@ struct k892analysis_PbPb { if (track1Sign < 0) { histos.fill(HIST("k892invmassME_DS"), lResonance.M()); histos.fill(HIST("h3k892invmassME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + if(additionalQAplots) { + histos.fill(HIST("QAME/h2k892ptMothervsptPiDS"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QAME/h2k892ptMothervsptKaDS"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } else if (track1Sign > 0) { histos.fill(HIST("k892invmassME_DSAnti"), lResonance.M()); histos.fill(HIST("h3k892invmassME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + if(additionalQAplots) { + histos.fill(HIST("QAME/h2k892ptMothervsptPiDSAnti"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QAME/h2k892ptMothervsptKaDSAnti"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } } } // MC - if constexpr (IsMC && !IsMix) { + if constexpr (IsMC && !IsMix && !IsRot) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; @@ -646,9 +682,9 @@ struct k892analysis_PbPb { histos.fill(HIST("h3k892invmassLSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); } } - } // end on DS or LS if tenses - } // end of loop on tracks combinations - } // ennd on fill histograms + } // end on DS or LS if + } // end of loop on track combinations + } // end of fill histograms Filter collisionFilter = nabs(aod::collision::posZ) <= cfgCutVertex; Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfgCutCentrality; @@ -813,6 +849,19 @@ struct k892analysis_PbPb { PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkg, "Process Rotational Background", false); + void processRotationalBkgMC(EventCandidatesMCrec::iterator const& recCollision, TrackCandidatesMCrec const& RecTracks) + { + + if(!myEventSelections(recCollision)) + return; + + // + fillHistograms(recCollision, RecTracks, RecTracks); + + } + PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkgMC, "Process Rotational Background MC", false); + + void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) { From 6f3d3c1d65d0eb04637f6ebb9a166f4cb83aa934 Mon Sep 17 00:00:00 2001 From: murioni Date: Fri, 7 Feb 2025 17:27:17 +0100 Subject: [PATCH 4/5] adding histos for MC bkg study, cut on tof beta --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 168 +++++++++++++------ 1 file changed, 113 insertions(+), 55 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index 6f368bba888..e1c036bb993 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -86,6 +86,8 @@ struct k892analysis_PbPb { Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; + Configurable cfgIsPhysicalPrimary{"cfgIsPhysicalPrimary", true, "Primary track selection in MC"}; // for MC bkg study + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz @@ -93,6 +95,7 @@ struct k892analysis_PbPb { Configurable cfgUseITSTPCrefit{"cfgUseITSTPCrefit", true, "Use ITS and TPC refit"}; Configurable cfgITSChi2Ncl{"cfgITSChi2Ncl", 999.0, "ITS Chi2/NCl"}; Configurable cfgTPCChi2Ncl{"cfgTPCChi2Ncl", 999.0, "TPC Chi2/NCl"}; + Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; @@ -103,7 +106,8 @@ struct k892analysis_PbPb { Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 3.0, "TPC nSigma cut for Pion"}; // TPC Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF Configurable cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection - + Configurable cTofBetaCut{"cTofBetaCut", false, "selection on TOF beta"}; + Configurable tofAndTpcPID{"tofAndTpcPID", false, "apply both TOF and TPC PID"}; Configurable tpclowpt{"tpclowpt", true, "apply TPC at low pt"}; @@ -187,6 +191,7 @@ struct k892analysis_PbPb { } } + if (additionalQAplots) { // TPC ncluster distirbutions histos.add("Ncluster/TPCnclusterpi", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); @@ -256,6 +261,15 @@ struct k892analysis_PbPb { } } + + if(doprocessMixedEventMC || doprocessMixedEventMCRun2) { + histos.add("h3k892invmassWrongDaughtersME_DS" , "Invariant mass ME with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassWrongDaughtersME_DSAnti", "Invariant mass ME with wrong daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughtersME_DS" , "Invariant mass ME with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughtersME_DSAnti", "Invariant mass ME with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); + } + + if (doprocessMC || doprocessMCRun2) { histos.add("QAevent/hMCrecCollSels", "MC Event statistics", HistType::kTH1F, {{10, 0.0f, 10.0f}}); histos.add("QAevent/hMultiplicityPercentMC", "Multiplicity percentile of MCrec collision", HistType::kTH1F, {{120, 0.0f, 120.0f}}); @@ -282,7 +296,16 @@ struct k892analysis_PbPb { histos.add("k892RecAnti", "pT distribution of Reconstructed MC Anti-K(892)0", kTH2F, {ptAxis, centAxis}); histos.add("h3k892GenInvmass", "Invariant mass of generated K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892GenInvmassAnti", "Invariant mass of generated Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); + + histos.add("h3k892invmassWrongDaughters_DS" , "Invariant mass of K*0 with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassWrongDaughters_DSAnti", "Invariant mass of K*0 with wrong daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughters_DS" , "Invariant mass of K*0 with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughters_DSAnti", "Invariant mass of K*0 with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); + } + + + // Print output histograms statistics LOG(info) << "Size of the histograms in spectraTOF"; histos.print(); @@ -373,6 +396,9 @@ struct k892analysis_PbPb { if (candidate.hasTPC() && std::abs(candidate.tpcNSigmaKa()) <= cMaxTPCnSigmaKaon) { // tpc cut, tof when available + if (cTofBetaCut && candidate.hasTOF() && (candidate.beta() + 3*candidate.betaerror() > 1) ) + return false; + if (cByPassTOF) // skip tof selection return true; @@ -403,6 +429,9 @@ struct k892analysis_PbPb { if (candidate.hasTPC() && std::abs(candidate.tpcNSigmaPi()) <= cMaxTPCnSigmaPion) { // tpc cut, tof when available + if (cTofBetaCut && candidate.hasTOF() && (candidate.beta() + 3*candidate.betaerror() > 1) ) + return false; + if (cByPassTOF) // skip tof selection return true; @@ -608,7 +637,7 @@ struct k892analysis_PbPb { } // MC - if constexpr (IsMC && !IsMix && !IsRot) { + if constexpr (IsMC && !IsRot) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; @@ -618,59 +647,88 @@ struct k892analysis_PbPb { int track1PDG = std::abs(mctrack1.pdgCode()); int track2PDG = std::abs(mctrack2.pdgCode()); - if (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary()) - continue; - - if (track1PDG != 211 || track2PDG != 321) - continue; - - bool ismotherok = false; - int pdgcodeMother = -999; - for (const auto& mothertrack1 : mctrack1.template mothers_as()) { - for (const auto& mothertrack2 : mctrack2.template mothers_as()) { - if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) - continue; - if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) - continue; - if (std::abs(mothertrack1.pdgCode()) != 313) - continue; - - if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { - histos.fill(HIST("h1k892Recsplit"), mothertrack1.pt()); - continue; - } - oldindex = mothertrack1.globalIndex(); - pdgcodeMother = mothertrack1.pdgCode(); - ismotherok = true; - } - } + if (cfgIsPhysicalPrimary && (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary()) ) + continue; + + if (track1PDG != 211 || track2PDG != 321) { - if (!ismotherok) + if (track1Sign < 0) { + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassWrongDaughtersME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassWrongDaughters_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + } else if (track1Sign > 0) { + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassWrongDaughtersME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassWrongDaughters_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + continue; + } + + if (track1Sign < 0) { + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassRightDaughtersME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassRightDaughters_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + } else if (track1Sign > 0) { + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassRightDaughtersME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassRightDaughters_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + + + if constexpr (!IsMix) { + + bool ismotherok = false; + int pdgcodeMother = -999; + for (const auto& mothertrack1 : mctrack1.template mothers_as()) { + for (const auto& mothertrack2 : mctrack2.template mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) + continue; + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) + continue; + if (std::abs(mothertrack1.pdgCode()) != 313) + continue; + + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + histos.fill(HIST("h1k892Recsplit"), mothertrack1.pt()); + continue; + } + oldindex = mothertrack1.globalIndex(); + pdgcodeMother = mothertrack1.pdgCode(); + ismotherok = true; + } + } - histos.fill(HIST("QAMCTrue/hGlobalIndexMotherRec"), oldindex); - // Track selection check. - histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); - if (isTrk1hasTOF) { - histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); - } - histos.fill(HIST("QAMCTrue/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); - if (isTrk2hasTOF) { - histos.fill(HIST("QAMCTrue/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); - } - - // MC histograms - if (pdgcodeMother > 0) { - histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity); - histos.fill(HIST("k892Recinvmass"), lResonance.M()); - histos.fill(HIST("h3Reck892invmass"), multiplicity, lResonance.Pt(), lResonance.M()); - } else { - histos.fill(HIST("k892RecAnti"), lResonance.Pt(), multiplicity); - histos.fill(HIST("k892RecinvmassAnti"), lResonance.M()); - histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - } - } + if (!ismotherok) + continue; + + histos.fill(HIST("QAMCTrue/hGlobalIndexMotherRec"), oldindex); + // Track selection check. + histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + } + histos.fill(HIST("QAMCTrue/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + } + // MC histograms + if (pdgcodeMother > 0) { + histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity); + histos.fill(HIST("k892Recinvmass"), lResonance.M()); + histos.fill(HIST("h3Reck892invmass"), multiplicity, lResonance.Pt(), lResonance.M()); + } else { + histos.fill(HIST("k892RecAnti"), lResonance.Pt(), multiplicity); + histos.fill(HIST("k892RecinvmassAnti"), lResonance.M()); + histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } + } // end of IsMC } else if (track1Sign * track2Sign > 0) { if constexpr (!IsMix) { @@ -694,10 +752,10 @@ struct k892analysis_PbPb { // Data using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTOFbeta>>; // MC using EventCandidatesMCrec = soa::Join; - using TrackCandidatesMCrec = soa::Filtered>; + using TrackCandidatesMCrec = soa::Filtered>; // ME run 3 using BinningTypeVtxCent = ColumnBinningPolicy; @@ -919,7 +977,7 @@ struct k892analysis_PbPb { PROCESS_SWITCH(k892analysis_PbPb, processMixedEventRun2, "Process Mixed event Run2", false); - void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks) + void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks, aod::McParticles const&) { auto tracksTuple = std::make_tuple(RecTracks); BinningTypeVtxCent colBinning{{cfgVtxBins, cfgMultBins}, true}; @@ -944,7 +1002,7 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMC, "Process Mixed event MC", false); - void processMixedEventMCRun2(EventCandidatesMCrecRun2 const& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const& bcs) + void processMixedEventMCRun2(EventCandidatesMCrecRun2 const& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const& bcs, aod::McParticles const&) { auto tracksTuple = std::make_tuple(RecTracks); BinningTypeVtxCentRun2 colBinning{{cfgVtxBins, cfgMultBins}, true}; From 68d7635d2b41729eee839d3e4560eb2b97f61332 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Sat, 8 Feb 2025 12:02:36 +0000 Subject: [PATCH 5/5] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 355 +++++++++---------- 1 file changed, 160 insertions(+), 195 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index e1c036bb993..4efc780c7a9 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -11,7 +11,7 @@ // /// /// \brief K*0 spectra in Pb-Pb -/// \author Marta Urioni +/// \author Marta Urioni #include #include @@ -87,16 +87,15 @@ struct k892analysis_PbPb { Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; Configurable cfgIsPhysicalPrimary{"cfgIsPhysicalPrimary", true, "Primary track selection in MC"}; // for MC bkg study - + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor - Configurable cfgUseITSTPCrefit{"cfgUseITSTPCrefit", true, "Use ITS and TPC refit"}; + Configurable cfgUseITSTPCrefit{"cfgUseITSTPCrefit", true, "Use ITS and TPC refit"}; Configurable cfgITSChi2Ncl{"cfgITSChi2Ncl", 999.0, "ITS Chi2/NCl"}; Configurable cfgTPCChi2Ncl{"cfgTPCChi2Ncl", 999.0, "TPC Chi2/NCl"}; - Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; Configurable cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"}; @@ -107,7 +106,7 @@ struct k892analysis_PbPb { Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF Configurable cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection Configurable cTofBetaCut{"cTofBetaCut", false, "selection on TOF beta"}; - + Configurable tofAndTpcPID{"tofAndTpcPID", false, "apply both TOF and TPC PID"}; Configurable tpclowpt{"tpclowpt", true, "apply TPC at low pt"}; @@ -118,7 +117,6 @@ struct k892analysis_PbPb { Configurable rotationalCut{"rotationalCut", 10, "Cut value (Rotation angle pi - pi/cut and pi + pi/cut)"}; Configurable cfgRotPi{"cfgRotPi", true, "rotate Pion"}; - // event mixing Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; ConfigurableAxis cfgVtxBins{"cfgVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; @@ -191,18 +189,17 @@ struct k892analysis_PbPb { } } - if (additionalQAplots) { // TPC ncluster distirbutions histos.add("Ncluster/TPCnclusterpi", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); histos.add("Ncluster/TPCnclusterka", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); histos.add("Ncluster/TPCnclusterPhipi", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); histos.add("Ncluster/TPCnclusterPhika", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); - + histos.add("Ncluster/TPCChi2ncluster", "TPC Chi2ncluster distribution", kTH1F, {{100, 0, 10, "TPC Chi2nCluster"}}); histos.add("Ncluster/ITSChi2ncluster", "ITS Chi2ncluster distribution", kTH1F, {{100, 0, 40, "ITS Chi2nCluster"}}); - histos.add("Ncluster/ITSncluster", "ITS ncluster distribution", kTH1F, {{10, 0, 10, "ITS nCluster"}}); - + histos.add("Ncluster/ITSncluster", "ITS ncluster distribution", kTH1F, {{10, 0, 10, "ITS nCluster"}}); + histos.add("QA/h2k892ptMothervsptPiDS", "Pt of K(892)0 differnt sign vs pt pion daughter", kTH2F, {ptAxisMom, ptAxisDau}); histos.add("QA/h2k892ptMothervsptPiDSAnti", "Pt of Anti-K(892)0 differnt sign vs pt pion daughter", kTH2F, {ptAxisMom, ptAxisDau}); histos.add("QA/h2k892ptMothervsptKaDS", "Pt of K(892)0 differnt sign vs pt kaon daughter", kTH2F, {ptAxisMom, ptAxisDau}); @@ -213,7 +210,7 @@ struct k892analysis_PbPb { histos.add("QAME/h2k892ptMothervsptKaDS", "Pt of Mother vs pt kaon daughter, Mixed Event", kTH2F, {ptAxisMom, ptAxisDau}); histos.add("QAME/h2k892ptMothervsptKaDSAnti", "Pt of Anti-Mother vs pt pion daughter, Mixed Event", kTH2F, {ptAxisMom, ptAxisDau}); } - + // DCA QA histos.add("QA/trkDCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxis}); histos.add("QA/trkDCAxy_ka", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {dcaxyAxis}); @@ -236,7 +233,6 @@ struct k892analysis_PbPb { histos.add("h3k892invmassLS", "Invariant mass of K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892invmassLSAnti", "Invariant mass of Anti-K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis}); - if (doprocessRotationalBkg || doprocessRotationalBkgMC) { histos.add("k892invmassRotDS", "Invariant mass of K(892)0 RotBkg", kTH1F, {invMassAxis}); histos.add("k892invmassRotDSAnti", "Invariant mass of Anti-K(892)0 RotBkg", kTH1F, {invMassAxis}); @@ -261,14 +257,12 @@ struct k892analysis_PbPb { } } - - if(doprocessMixedEventMC || doprocessMixedEventMCRun2) { - histos.add("h3k892invmassWrongDaughtersME_DS" , "Invariant mass ME with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + if (doprocessMixedEventMC || doprocessMixedEventMCRun2) { + histos.add("h3k892invmassWrongDaughtersME_DS", "Invariant mass ME with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892invmassWrongDaughtersME_DSAnti", "Invariant mass ME with wrong daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassRightDaughtersME_DS" , "Invariant mass ME with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassRightDaughtersME_DSAnti", "Invariant mass ME with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughtersME_DS", "Invariant mass ME with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughtersME_DSAnti", "Invariant mass ME with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); } - if (doprocessMC || doprocessMCRun2) { histos.add("QAevent/hMCrecCollSels", "MC Event statistics", HistType::kTH1F, {{10, 0.0f, 10.0f}}); @@ -297,15 +291,12 @@ struct k892analysis_PbPb { histos.add("h3k892GenInvmass", "Invariant mass of generated K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892GenInvmassAnti", "Invariant mass of generated Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassWrongDaughters_DS" , "Invariant mass of K*0 with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassWrongDaughters_DS", "Invariant mass of K*0 with wrong daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892invmassWrongDaughters_DSAnti", "Invariant mass of K*0 with wrong daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassRightDaughters_DS" , "Invariant mass of K*0 with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("h3k892invmassRightDaughters_DSAnti", "Invariant mass of K*0 with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); - + histos.add("h3k892invmassRightDaughters_DS", "Invariant mass of K*0 with right daughters DS", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRightDaughters_DSAnti", "Invariant mass of K*0 with right daughters DS anti", kTH3F, {centAxis, ptAxis, invMassAxis}); } - - // Print output histograms statistics LOG(info) << "Size of the histograms in spectraTOF"; histos.print(); @@ -314,7 +305,6 @@ struct k892analysis_PbPb { double massKa = o2::constants::physics::MassKPlus; double massPi = o2::constants::physics::MassPiPlus; - template bool myEventSelections(const CollType& coll) { @@ -329,16 +319,15 @@ struct k892analysis_PbPb { if (additionalEvSel3 && (!coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) return false; auto centrality = coll.centFT0C(); - if(centrality > cfgCutCentrality) - return false; + if (centrality > cfgCutCentrality) + return false; auto occupancy = coll.trackOccupancyInTimeRange(); - if(cfgApplyOccupancyCut && (occupancy > cfgCutMaxOccupancy)) + if (cfgApplyOccupancyCut && (occupancy > cfgCutMaxOccupancy)) return false; - + return true; } - template bool myEventSelectionsRun2(const CollType& coll, const bcType&) { @@ -350,10 +339,10 @@ struct k892analysis_PbPb { auto centrality = coll.centRun2V0M(); if (centrality > cfgCutCentrality) return false; - + return true; } - + template bool trackCut(const TrackType& track) { @@ -376,9 +365,9 @@ struct k892analysis_PbPb { return false; if (cfgGlobalTrack && !track.isGlobalTrack()) return false; - if(cfgUseITSTPCrefit && (!(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit))) + if (cfgUseITSTPCrefit && (!(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit))) return false; - + return true; } @@ -396,8 +385,8 @@ struct k892analysis_PbPb { if (candidate.hasTPC() && std::abs(candidate.tpcNSigmaKa()) <= cMaxTPCnSigmaKaon) { // tpc cut, tof when available - if (cTofBetaCut && candidate.hasTOF() && (candidate.beta() + 3*candidate.betaerror() > 1) ) - return false; + if (cTofBetaCut && candidate.hasTOF() && (candidate.beta() + 3 * candidate.betaerror() > 1)) + return false; if (cByPassTOF) // skip tof selection return true; @@ -429,9 +418,9 @@ struct k892analysis_PbPb { if (candidate.hasTPC() && std::abs(candidate.tpcNSigmaPi()) <= cMaxTPCnSigmaPion) { // tpc cut, tof when available - if (cTofBetaCut && candidate.hasTOF() && (candidate.beta() + 3*candidate.betaerror() > 1) ) - return false; - + if (cTofBetaCut && candidate.hasTOF() && (candidate.beta() + 3 * candidate.betaerror() > 1)) + return false; + if (cByPassTOF) // skip tof selection return true; @@ -511,7 +500,7 @@ struct k892analysis_PbPb { histos.fill(HIST("Ncluster/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2.phi()); histos.fill(HIST("Ncluster/TPCChi2ncluster"), trk1.tpcChi2NCl()); histos.fill(HIST("Ncluster/ITSChi2ncluster"), trk1.itsChi2NCl()); - histos.fill(HIST("Ncluster/ITSncluster"), trk1.itsNCls()); + histos.fill(HIST("Ncluster/ITSncluster"), trk1.itsNCls()); } if constexpr (!IsMix && !IsRot) { @@ -570,15 +559,15 @@ struct k892analysis_PbPb { if (track1Sign * track2Sign < 0) { if constexpr (IsRot) { // rotational background for (int i = 0; i < cfgNoRotations; i++) { - float theta = rand->Uniform(o2::constants::math::PI - o2::constants::math::PI/rotationalCut, o2::constants::math::PI + o2::constants::math::PI/rotationalCut); - if (cfgRotPi) { - ldaughterRot.SetPtEtaPhiM(trk1.pt(), trk1.eta(), trk1.phi() + theta, massPi); - lResonanceRot = lDecayDaughter2 + ldaughterRot; - } else { - ldaughterRot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta, massKa); - lResonanceRot = lDecayDaughter1 + ldaughterRot; - } - + float theta = rand->Uniform(o2::constants::math::PI - o2::constants::math::PI / rotationalCut, o2::constants::math::PI + o2::constants::math::PI / rotationalCut); + if (cfgRotPi) { + ldaughterRot.SetPtEtaPhiM(trk1.pt(), trk1.eta(), trk1.phi() + theta, massPi); + lResonanceRot = lDecayDaughter2 + ldaughterRot; + } else { + ldaughterRot.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi() + theta, massKa); + lResonanceRot = lDecayDaughter1 + ldaughterRot; + } + if (cfgCutsOnMother) { if (lResonanceRot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow continue; @@ -595,25 +584,23 @@ struct k892analysis_PbPb { } } - } else if constexpr (!IsMix) { // same event if (track1Sign < 0) { histos.fill(HIST("k892invmassDS"), lResonance.M()); histos.fill(HIST("h3k892invmassDS"), multiplicity, lResonance.Pt(), lResonance.M()); - if(additionalQAplots) { - histos.fill(HIST("QA/h2k892ptMothervsptPiDS"), lResonance.Pt(), lDecayDaughter1.Pt()); - histos.fill(HIST("QA/h2k892ptMothervsptKaDS"), lResonance.Pt(), lDecayDaughter2.Pt()); - } + if (additionalQAplots) { + histos.fill(HIST("QA/h2k892ptMothervsptPiDS"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QA/h2k892ptMothervsptKaDS"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } else if (track1Sign > 0) { histos.fill(HIST("k892invmassDSAnti"), lResonance.M()); histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - if(additionalQAplots) { - histos.fill(HIST("QA/h2k892ptMothervsptPiDSAnti"), lResonance.Pt(), lDecayDaughter1.Pt()); - histos.fill(HIST("QA/h2k892ptMothervsptKaDSAnti"), lResonance.Pt(), lDecayDaughter2.Pt()); - } + if (additionalQAplots) { + histos.fill(HIST("QA/h2k892ptMothervsptPiDSAnti"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QA/h2k892ptMothervsptKaDSAnti"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } - } else { // mixed event histos.fill(HIST("k892invmassME"), lResonance.M()); histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); @@ -621,17 +608,17 @@ struct k892analysis_PbPb { if (track1Sign < 0) { histos.fill(HIST("k892invmassME_DS"), lResonance.M()); histos.fill(HIST("h3k892invmassME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); - if(additionalQAplots) { - histos.fill(HIST("QAME/h2k892ptMothervsptPiDS"), lResonance.Pt(), lDecayDaughter1.Pt()); - histos.fill(HIST("QAME/h2k892ptMothervsptKaDS"), lResonance.Pt(), lDecayDaughter2.Pt()); - } + if (additionalQAplots) { + histos.fill(HIST("QAME/h2k892ptMothervsptPiDS"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QAME/h2k892ptMothervsptKaDS"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } else if (track1Sign > 0) { histos.fill(HIST("k892invmassME_DSAnti"), lResonance.M()); histos.fill(HIST("h3k892invmassME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - if(additionalQAplots) { - histos.fill(HIST("QAME/h2k892ptMothervsptPiDSAnti"), lResonance.Pt(), lDecayDaughter1.Pt()); - histos.fill(HIST("QAME/h2k892ptMothervsptKaDSAnti"), lResonance.Pt(), lDecayDaughter2.Pt()); - } + if (additionalQAplots) { + histos.fill(HIST("QAME/h2k892ptMothervsptPiDSAnti"), lResonance.Pt(), lDecayDaughter1.Pt()); + histos.fill(HIST("QAME/h2k892ptMothervsptKaDSAnti"), lResonance.Pt(), lDecayDaughter2.Pt()); + } } } } @@ -647,89 +634,88 @@ struct k892analysis_PbPb { int track1PDG = std::abs(mctrack1.pdgCode()); int track2PDG = std::abs(mctrack2.pdgCode()); - if (cfgIsPhysicalPrimary && (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary()) ) - continue; - + if (cfgIsPhysicalPrimary && (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary())) + continue; + if (track1PDG != 211 || track2PDG != 321) { - if (track1Sign < 0) { + if (track1Sign < 0) { if constexpr (IsMix) - histos.fill(HIST("h3k892invmassWrongDaughtersME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); - else - histos.fill(HIST("h3k892invmassWrongDaughters_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + histos.fill(HIST("h3k892invmassWrongDaughtersME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassWrongDaughters_DS"), multiplicity, lResonance.Pt(), lResonance.M()); } else if (track1Sign > 0) { - if constexpr (IsMix) - histos.fill(HIST("h3k892invmassWrongDaughtersME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - else - histos.fill(HIST("h3k892invmassWrongDaughters_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - } - + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassWrongDaughtersME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassWrongDaughters_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + continue; - } - - if (track1Sign < 0) { - if constexpr (IsMix) - histos.fill(HIST("h3k892invmassRightDaughtersME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); - else - histos.fill(HIST("h3k892invmassRightDaughters_DS"), multiplicity, lResonance.Pt(), lResonance.M()); - } else if (track1Sign > 0) { - if constexpr (IsMix) - histos.fill(HIST("h3k892invmassRightDaughtersME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - else - histos.fill(HIST("h3k892invmassRightDaughters_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - } - - - if constexpr (!IsMix) { - - bool ismotherok = false; - int pdgcodeMother = -999; - for (const auto& mothertrack1 : mctrack1.template mothers_as()) { - for (const auto& mothertrack2 : mctrack2.template mothers_as()) { - if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) - continue; - if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) - continue; - if (std::abs(mothertrack1.pdgCode()) != 313) - continue; - - if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { - histos.fill(HIST("h1k892Recsplit"), mothertrack1.pt()); - continue; - } - oldindex = mothertrack1.globalIndex(); - pdgcodeMother = mothertrack1.pdgCode(); - ismotherok = true; - } - } - - if (!ismotherok) - continue; - - histos.fill(HIST("QAMCTrue/hGlobalIndexMotherRec"), oldindex); - // Track selection check. - histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); - if (isTrk1hasTOF) { - histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); - } - histos.fill(HIST("QAMCTrue/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); - if (isTrk2hasTOF) { - histos.fill(HIST("QAMCTrue/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); - } - - // MC histograms - if (pdgcodeMother > 0) { - histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity); - histos.fill(HIST("k892Recinvmass"), lResonance.M()); - histos.fill(HIST("h3Reck892invmass"), multiplicity, lResonance.Pt(), lResonance.M()); - } else { - histos.fill(HIST("k892RecAnti"), lResonance.Pt(), multiplicity); - histos.fill(HIST("k892RecinvmassAnti"), lResonance.M()); - histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M()); - } - } - } // end of IsMC - + } + + if (track1Sign < 0) { + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassRightDaughtersME_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassRightDaughters_DS"), multiplicity, lResonance.Pt(), lResonance.M()); + } else if (track1Sign > 0) { + if constexpr (IsMix) + histos.fill(HIST("h3k892invmassRightDaughtersME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + else + histos.fill(HIST("h3k892invmassRightDaughters_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + + if constexpr (!IsMix) { + + bool ismotherok = false; + int pdgcodeMother = -999; + for (const auto& mothertrack1 : mctrack1.template mothers_as()) { + for (const auto& mothertrack2 : mctrack2.template mothers_as()) { + if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) + continue; + if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) + continue; + if (std::abs(mothertrack1.pdgCode()) != 313) + continue; + + if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { + histos.fill(HIST("h1k892Recsplit"), mothertrack1.pt()); + continue; + } + oldindex = mothertrack1.globalIndex(); + pdgcodeMother = mothertrack1.pdgCode(); + ismotherok = true; + } + } + + if (!ismotherok) + continue; + + histos.fill(HIST("QAMCTrue/hGlobalIndexMotherRec"), oldindex); + // Track selection check. + histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + } + histos.fill(HIST("QAMCTrue/TPC_Nsigmaka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_ka_all"), multiplicity, trk2ptKa, trk2NSigmaKaTOF); + } + + // MC histograms + if (pdgcodeMother > 0) { + histos.fill(HIST("k892Rec"), lResonance.Pt(), multiplicity); + histos.fill(HIST("k892Recinvmass"), lResonance.M()); + histos.fill(HIST("h3Reck892invmass"), multiplicity, lResonance.Pt(), lResonance.M()); + } else { + histos.fill(HIST("k892RecAnti"), lResonance.Pt(), multiplicity); + histos.fill(HIST("k892RecinvmassAnti"), lResonance.M()); + histos.fill(HIST("h3Reck892invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } + } // end of IsMC + } else if (track1Sign * track2Sign > 0) { if constexpr (!IsMix) { if (track1Sign < 0) { @@ -752,14 +738,13 @@ struct k892analysis_PbPb { // Data using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTOFbeta>>; // MC using EventCandidatesMCrec = soa::Join; using TrackCandidatesMCrec = soa::Filtered>; // ME run 3 using BinningTypeVtxCent = ColumnBinningPolicy; - // Data Run 2 using Run2Events = soa::Join; //, aod::TrackletMults>; using BCsWithRun2Info = soa::Join; @@ -768,7 +753,6 @@ struct k892analysis_PbPb { // ME run 2 using BinningTypeVtxCentRun2 = ColumnBinningPolicy; - // partitions tpc low pt Partition negPitpc = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) < cMaxPtTPC); Partition posKatpc = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) < cMaxPtTPC); @@ -783,15 +767,14 @@ struct k892analysis_PbPb { Partition posPitof = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtof::tofNSigmaPi) <= cMaxTOFnSigmaPion) && (nabs(aod::pidtpc::tpcNSigmaPi) <= cMaxTPCnSigmaPion) && (nabs(aod::track::pt) > cMinPtTOF); Partition negKatof = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtof::tofNSigmaKa) <= cMaxTOFnSigmaKaon) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cMaxTPCnSigmaKaon) && (nabs(aod::track::pt) > cMinPtTOF); - template - void callFillHistoswithPartitions(const CollisionType& collision, const TracksType& ) + void callFillHistoswithPartitions(const CollisionType& collision, const TracksType&) { if (tpclowpt) { //+- auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - + fillHistograms(collision, candPosPitpc, candNegKatpc); //-+ @@ -815,15 +798,14 @@ struct k892analysis_PbPb { } } - template - void callFillHistoswithPartitionsMixedEvt(const CollisionType& collision1, const TracksType& , const CollisionType& collision2, const TracksType&) + void callFillHistoswithPartitionsMixedEvt(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&) { if (tpclowpt) { //+- auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - + fillHistograms(collision1, candPosPitpc, candNegKatpc); //-+ @@ -847,11 +829,10 @@ struct k892analysis_PbPb { } } - void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { - if(!myEventSelections(collision)) + if (!myEventSelections(collision)) return; auto centrality = collision.centFT0C(); @@ -864,19 +845,17 @@ struct k892analysis_PbPb { histos.fill(HIST("TestME/hCollisionIndexSameE"), collision.globalIndex()); histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); } - // + // callFillHistoswithPartitions(collision, tracks); - } PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", true); - void processSameEventRun2(Run2Events::iterator const& collision, TrackCandidates const& tracks, BCsWithRun2Info const& bcs) { - - if(!myEventSelectionsRun2(collision,bcs)) + + if (!myEventSelectionsRun2(collision, bcs)) return; - + histos.fill(HIST("QAevent/hEvtCounterSameE"), 1); histos.fill(HIST("QAevent/hVertexZSameE"), collision.posZ()); histos.fill(HIST("QAevent/hMultiplicityPercentSameE"), collision.centRun2V0M()); @@ -886,41 +865,33 @@ struct k892analysis_PbPb { histos.fill(HIST("TestME/hnTrksSameE"), tracks.size()); } - // + // callFillHistoswithPartitions(collision, tracks); - } PROCESS_SWITCH(k892analysis_PbPb, processSameEventRun2, "Process Same event Run2", false); - - void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { - if(!myEventSelections(collision)) + if (!myEventSelections(collision)) return; // callFillHistoswithPartitions(collision, tracks); - } PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkg, "Process Rotational Background", false); - void processRotationalBkgMC(EventCandidatesMCrec::iterator const& recCollision, TrackCandidatesMCrec const& RecTracks) { - if(!myEventSelections(recCollision)) + if (!myEventSelections(recCollision)) return; // fillHistograms(recCollision, RecTracks, RecTracks); - } PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkgMC, "Process Rotational Background MC", false); - - void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) { auto tracksTuple = std::make_tuple(tracks); @@ -929,7 +900,7 @@ struct k892analysis_PbPb { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if(!myEventSelections(collision1) || !myEventSelections(collision2)) + if (!myEventSelections(collision1) || !myEventSelections(collision2)) continue; auto centrality = collision1.centFT0C(); @@ -941,15 +912,13 @@ struct k892analysis_PbPb { histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); } - - // - callFillHistoswithPartitionsMixedEvt(collision1, tracks1, collision2, tracks2); + // + callFillHistoswithPartitionsMixedEvt(collision1, tracks1, collision2, tracks2); } } PROCESS_SWITCH(k892analysis_PbPb, processMixedEvent, "Process Mixed event", true); - void processMixedEventRun2(Run2Events const& collisions, TrackCandidates const& tracks, BCsWithRun2Info const& bcs) { auto tracksTuple = std::make_tuple(tracks); @@ -958,9 +927,9 @@ struct k892analysis_PbPb { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if(!myEventSelectionsRun2(collision1, bcs) || !myEventSelectionsRun2(collision2, bcs)) + if (!myEventSelectionsRun2(collision1, bcs) || !myEventSelectionsRun2(collision2, bcs)) continue; - + if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); @@ -971,12 +940,10 @@ struct k892analysis_PbPb { // callFillHistoswithPartitionsMixedEvt(collision1, tracks1, collision2, tracks2); - } } PROCESS_SWITCH(k892analysis_PbPb, processMixedEventRun2, "Process Mixed event Run2", false); - void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks, aod::McParticles const&) { auto tracksTuple = std::make_tuple(RecTracks); @@ -985,9 +952,9 @@ struct k892analysis_PbPb { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if(!myEventSelections(collision1) || !myEventSelections(collision2)) + if (!myEventSelections(collision1) || !myEventSelections(collision2)) continue; - + if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); @@ -1010,8 +977,8 @@ struct k892analysis_PbPb { for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if(!myEventSelectionsRun2(collision1, bcs) || !myEventSelectionsRun2(collision2, bcs)) - continue; + if (!myEventSelectionsRun2(collision1, bcs) || !myEventSelectionsRun2(collision2, bcs)) + continue; if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); @@ -1027,7 +994,6 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMCRun2, "Process Mixed event MC Run2", false); - void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) { histos.fill(HIST("QAevent/hMCrecCollSels"), 0); @@ -1041,8 +1007,8 @@ struct k892analysis_PbPb { } for (const auto& RecCollision : recCollisions) { histos.fill(HIST("QAevent/hMCrecCollSels"), 3); - - if(!myEventSelections(RecCollision)) + + if (!myEventSelections(RecCollision)) continue; histos.fill(HIST("QAevent/hMCrecCollSels"), 8); @@ -1050,7 +1016,7 @@ struct k892analysis_PbPb { histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); - // + // fillHistograms(RecCollision, tracks, tracks); // Generated MC @@ -1103,7 +1069,6 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processMC, "Process Monte Carlo", false); - void processMCRun2(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles const& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks, BCsWithRun2Info const& bcs) { histos.fill(HIST("QAevent/hMCrecCollSels"), 0); @@ -1117,16 +1082,16 @@ struct k892analysis_PbPb { } for (const auto& RecCollision : recCollisions) { histos.fill(HIST("QAevent/hMCrecCollSels"), 3); - - if(!myEventSelectionsRun2(RecCollision, bcs)) + + if (!myEventSelectionsRun2(RecCollision, bcs)) continue; histos.fill(HIST("QAevent/hMCrecCollSels"), 8); - + auto centrality = RecCollision.centRun2V0M(); histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); - // + // fillHistograms(RecCollision, tracks, tracks); // Generated MC