diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index 71abc9c6161..4efc780c7a9 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -9,6 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // +/// +/// \brief K*0 spectra in Pb-Pb /// \author Marta Urioni #include @@ -22,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -77,16 +78,23 @@ 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"}; 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 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"}; @@ -97,20 +105,22 @@ 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 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)"}; + 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"}; - 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"}; @@ -127,7 +137,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(); @@ -140,10 +149,12 @@ 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}; - 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}}); @@ -170,7 +181,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}); @@ -180,10 +191,24 @@ 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"}}); + + 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 @@ -208,7 +233,7 @@ 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}); @@ -216,7 +241,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) { @@ -232,8 +257,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("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}}); @@ -258,7 +290,13 @@ 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(); @@ -267,14 +305,56 @@ 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) 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,6 +365,8 @@ 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; } @@ -293,7 +375,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; @@ -303,6 +385,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; @@ -323,7 +408,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; @@ -333,6 +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 (cByPassTOF) // skip tof selection return true; @@ -360,8 +448,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. @@ -406,10 +494,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) { @@ -455,7 +546,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 @@ -468,33 +559,48 @@ 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 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 (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()); 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()); + } } + } else { // mixed event histos.fill(HIST("k892invmassME"), lResonance.M()); histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); @@ -502,75 +608,114 @@ 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 && !IsRot) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; 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()) + if (cfgIsPhysicalPrimary && (!mctrack1.isPhysicalPrimary() || !mctrack2.isPhysicalPrimary())) continue; - if (track1PDG != 211 || track2PDG != 321) - continue; + if (track1PDG != 211 || track2PDG != 321) { - bool ismotherok = false; - int pdgcodeMother = -999; - for (auto& mothertrack1 : mctrack1.template mothers_as()) { - for (auto& mothertrack2 : mctrack2.template mothers_as()) { - if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) - continue; - if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) - continue; - if (TMath::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 (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()); } - } - 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); + + 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()); } - // 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 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) { @@ -581,18 +726,32 @@ 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; 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>; + 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; + // 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); @@ -608,192 +767,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&) + template + void callFillHistoswithPartitionsMixedEvt(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&) { - 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(); - if (tpclowpt) { //+- - auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision, candPosPitpc, candNegKatpc); + 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(); + void processSameEventRun2(Run2Events::iterator const& collision, TrackCandidates const& tracks, BCsWithRun2Info const& bcs) + { - if (centrality > cfgCutCentrality) + 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); - - fillHistograms(collision, candPosPitpc, candNegKatpc); + // + callFillHistoswithPartitions(collision, tracks); + } + PROCESS_SWITCH(k892analysis_PbPb, processSameEventRun2, "Process Same event Run2", false); - //-+ - 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); + } + PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkg, "Process Rotational Background", false); - fillHistograms(collision, candPosPitof, candNegKatof); + void processRotationalBkgMC(EventCandidatesMCrec::iterator const& recCollision, TrackCandidatesMCrec const& RecTracks) + { - //-+ - auto candNegPitof = negPitof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto candPosKatof = posKatof->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + if (!myEventSelections(recCollision)) + return; - fillHistograms(collision, candNegPitof, candPosKatof); - } + // + fillHistograms(recCollision, RecTracks, RecTracks); } - PROCESS_SWITCH(k892analysis_PbPb, processSameEventRun2, "Process Same event Run2", false); + PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkgMC, "Process Rotational Background MC", 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); @@ -803,129 +913,47 @@ struct k892analysis_PbPb { 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, 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) + void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks, aod::McParticles const&) { 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))) { + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + + if (!myEventSelections(collision1) || !myEventSelections(collision2)) continue; - } if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); @@ -935,53 +963,65 @@ 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, aod::McParticles const&) { - 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(); @@ -993,16 +1033,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); } @@ -1031,42 +1069,34 @@ 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); + for (const auto& RecCollision : recCollisions) { + histos.fill(HIST("QAevent/hMCrecCollSels"), 3); - if (std::abs(RecCollision.posZ()) > cfgCutVertex) + 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(); @@ -1078,16 +1108,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); } @@ -1118,6 +1146,5 @@ struct k892analysis_PbPb { }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"k892analysis_PbPb"})}; + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"k892analysis_PbPb"})}; }