From c0c25e07c19ad80b24884e46e85841004c31a035 Mon Sep 17 00:00:00 2001 From: murioni Date: Tue, 14 Jan 2025 17:08:03 +0100 Subject: [PATCH 1/5] mixed event MC process function --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 55 ++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index d1866ffb594..c1e10c05b3b 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -136,7 +136,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) { + if (doprocessSameEvent || doprocessSameEventRun2 || doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { // 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}}); @@ -163,7 +163,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) { + if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { 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}); @@ -200,7 +200,7 @@ struct k892analysis_PbPb { histos.add("h3k892invmassDSAnti", "Invariant mass of Anti-K(892)0 differnt sign", kTH3F, {centAxis, ptAxis, invMassAxis}); 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 (doprocessMixedEvent || doprocessMixedEventRun2) { + if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { histos.add("h3k892invmassME", "Invariant mass of K(892)0 mixed event", kTH3F, {centAxis, ptAxis, invMassAxis}); if (additionalMEPlots) { @@ -755,6 +755,7 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processMixedEvent, "Process Mixed event", true); + using BinningTypeVtxCentRun2 = ColumnBinningPolicy; void processMixedEventRun2(Run2Events const& collisions, TrackCandidates const& tracks, BCsWithRun2Info const&) { @@ -824,6 +825,54 @@ struct k892analysis_PbPb { using EventCandidatesMCrec = soa::Join; using TrackCandidatesMCrec = soa::Filtered>; + + + ////////////////////////////OCCHIO + void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks) + { + auto tracksTuple = std::make_tuple(RecTracks); + 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; + } + + if (additionalQAeventPlots) { + histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); + histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); + histos.fill(HIST("QAevent/hMultiplicityPercentMixedE"), collision1.centFT0C()); + histos.fill(HIST("TestME/hCollisionIndexMixedE"), collision1.globalIndex()); + histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); + } + + auto tracksPi = tracks1.sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto tracksKa = tracks2.sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + fillHistograms(collision1, tracksPi, tracksKa); + + } + } + PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMC, "Process Mixed event MC", true); + + + + + + void processMC(aod::McCollisions::iterator const& /*mcCollision*/, aod::McParticles& mcParticles, const soa::SmallGroups& recCollisions, TrackCandidatesMCrec const& RecTracks) { histos.fill(HIST("hMCrecCollSels"), 0); From d5b9bfccfce3a4bbd597efe79f631b96044bfca3 Mon Sep 17 00:00:00 2001 From: murioni Date: Wed, 15 Jan 2025 19:26:58 +0100 Subject: [PATCH 2/5] fixing mixedevent and implementing rotational background --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 181 +++++++++++++------ 1 file changed, 130 insertions(+), 51 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index c1e10c05b3b..fb899aa2b58 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -95,13 +96,17 @@ struct k892analysis_PbPb { Configurable cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF 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 cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection 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)"}; + // 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"}; @@ -125,6 +130,9 @@ struct k892analysis_PbPb { Configurable genacceptancecut{"genacceptancecut", false, "Acceptance cut on generated MC particles"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; + TRandom* rand = new TRandom(); + + void init(o2::framework::InitContext&) { AxisSpec centAxis = {binsCent, "V0M (%)"}; @@ -200,6 +208,15 @@ struct k892analysis_PbPb { histos.add("h3k892invmassDSAnti", "Invariant mass of Anti-K(892)0 differnt sign", kTH3F, {centAxis, ptAxis, invMassAxis}); 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) { + 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}); + + histos.add("h3k892invmassRotDS", "Invariant mass of K(892)0 Rotational Bkg", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("h3k892invmassRotDSAnti", "Invariant mass of Anti-K(892)0 Rotational Bkg", kTH3F, {centAxis, ptAxis, invMassAxis}); + } + if (doprocessMixedEvent || doprocessMixedEventRun2 || doprocessMixedEventMC) { histos.add("h3k892invmassME", "Invariant mass of K(892)0 mixed event", kTH3F, {centAxis, ptAxis, invMassAxis}); @@ -333,10 +350,9 @@ struct k892analysis_PbPb { return false; } - template + template void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2) { - auto multiplicity = -999; if constexpr (!IsRun2) @@ -345,15 +361,14 @@ struct k892analysis_PbPb { multiplicity = collision.centRun2V0M(); auto oldindex = -999; - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance, ldaughter_rot, lResonance_rot; for (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. if (additionalQAeventPlots) { - if constexpr (!IsMC) { + if constexpr (!IsMC && !IsRot) { if constexpr (!IsMix) { histos.fill(HIST("TestME/hPairsCounterSameE"), 1.0); } else { @@ -390,7 +405,7 @@ struct k892analysis_PbPb { } } - if (additionalQAplots) { + if (additionalQAplots && !IsMix && !IsRot) { // TPCncluster distributions histos.fill(HIST("TPCncluster/TPCnclusterpi"), trk1.tpcNClsFound()); histos.fill(HIST("TPCncluster/TPCnclusterka"), trk2.tpcNClsFound()); @@ -398,7 +413,7 @@ struct k892analysis_PbPb { histos.fill(HIST("TPCncluster/TPCnclusterPhika"), trk2.tpcNClsFound(), trk2.phi()); } - if constexpr (!IsMix) { + if constexpr (!IsMix && !IsRot) { //// QA plots after the selection // --- PID QA Pion histos.fill(HIST("QA/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); @@ -418,7 +433,7 @@ struct k892analysis_PbPb { histos.fill(HIST("QA/trkDCAxy_ka"), trk2.dcaXY()); histos.fill(HIST("QA/trkDCAz_pi"), trk1.dcaZ()); histos.fill(HIST("QA/trkDCAz_ka"), trk2.dcaZ()); - } else if (additionalMEPlots) { + } else if (IsMix && additionalMEPlots) { // --- PID QA Pion histos.fill(HIST("QAME/TPC_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); if (isTrk1hasTOF) { @@ -433,26 +448,49 @@ struct k892analysis_PbPb { } } + + int track1Sign = trk1.sign(); + int track2Sign = trk2.sign(); + + //// Resonance reconstruction lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; // Rapidity cut if (abs(lResonance.Rapidity()) >= 0.5) - continue; - if (cfgCutsOnMother) { - if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow - continue; - if (lResonance.M() >= cMaxMinvMotherCut) // excluding candidates in overflow - continue; + continue; + if (cfgCutsOnMother && !IsRot) { + if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (lResonance.M() >= cMaxMinvMotherCut) // excluding candidates in overflow + continue; } - - int track1Sign = trk1.sign(); - int track2Sign = trk2.sign(); + //// Un-like sign pair only - if (track1Sign * track2Sign < 0) { - if constexpr (!IsMix) { + 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; + + if (cfgCutsOnMother) { + if (lResonance_rot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (lResonance_rot.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()); + } else if (track1Sign > 0) { + histos.fill(HIST("k892invmassRotDSAnti"), lResonance.M()); + histos.fill(HIST("h3k892invmassRotDSAnti"), multiplicity, lResonance_rot.Pt(), lResonance_rot.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()); @@ -460,7 +498,7 @@ struct k892analysis_PbPb { histos.fill(HIST("k892invmassDSAnti"), lResonance.M()); histos.fill(HIST("h3k892invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M()); } - } else { + } else { // mixed event histos.fill(HIST("k892invmassME"), lResonance.M()); histos.fill(HIST("h3k892invmassME"), multiplicity, lResonance.Pt(), lResonance.M()); if (additionalMEPlots) { @@ -475,7 +513,7 @@ struct k892analysis_PbPb { } // MC - if constexpr (IsMC) { + if constexpr (IsMC && !IsMix) { if (!trk1.has_mcParticle() || !trk2.has_mcParticle()) continue; @@ -604,30 +642,76 @@ struct k892analysis_PbPb { 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", false); + PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", true); + + void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const& tracks, 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(); + + 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 candNegPitpc = negPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto candPosKatpc = posKatpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + 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); + + //-+ + 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, processRotationalBkg, "Process Rotational Background", false); + ///////*************************************** using Run2Events = soa::Join; //, aod::TrackletMults>; @@ -668,26 +752,26 @@ struct k892analysis_PbPb { 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, processSameEventRun2, "Process Same event Run2", false); @@ -729,13 +813,13 @@ struct k892analysis_PbPb { auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision1, candPosPitpc, candNegKatpc); + 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); + fillHistograms(collision1, candNegPitpc, candPosKatpc); } else if (tofhighpt) { @@ -743,13 +827,13 @@ struct k892analysis_PbPb { auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision1, candPosPitof, candNegKatof); + 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); + fillHistograms(collision1, candNegPitof, candPosKatof); } } } @@ -794,13 +878,13 @@ struct k892analysis_PbPb { auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto candNegKatpc = negKatpc->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision1, candPosPitpc, candNegKatpc); + 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); + fillHistograms(collision1, candNegPitpc, candPosKatpc); } else if (tofhighpt) { @@ -808,17 +892,17 @@ struct k892analysis_PbPb { auto candPosPitof = posPitof->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto candNegKatof = negKatof->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision1, candPosPitof, candNegKatof); + 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); + fillHistograms(collision1, candNegPitof, candPosKatof); } } } - PROCESS_SWITCH(k892analysis_PbPb, processMixedEventRun2, "Process Mixed event Run2", true); + PROCESS_SWITCH(k892analysis_PbPb, processMixedEventRun2, "Process Mixed event Run2", false); // MC @@ -826,8 +910,6 @@ struct k892analysis_PbPb { using TrackCandidatesMCrec = soa::Filtered>; - - ////////////////////////////OCCHIO void processMixedEventMC(EventCandidatesMCrec const& recCollisions, TrackCandidatesMCrec const& RecTracks) { auto tracksTuple = std::make_tuple(RecTracks); @@ -835,7 +917,6 @@ struct k892analysis_PbPb { SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, recCollisions, tracksTuple, &cache}; for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { - if (!collision1.sel8() || !collision2.sel8()) { continue; } @@ -851,7 +932,7 @@ struct k892analysis_PbPb { if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - + if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); @@ -860,13 +941,11 @@ struct k892analysis_PbPb { histos.fill(HIST("TestME/hnTrksMixedE"), tracks1.size()); } - auto tracksPi = tracks1.sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto tracksKa = tracks2.sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); - fillHistograms(collision1, tracksPi, tracksKa); - + fillHistograms(collision1, tracks1, tracks2); + } } - PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMC, "Process Mixed event MC", true); + PROCESS_SWITCH(k892analysis_PbPb, processMixedEventMC, "Process Mixed event MC", false); @@ -910,7 +989,7 @@ struct k892analysis_PbPb { auto centrality = RecCollision.centFT0C(); histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); - fillHistograms(RecCollision, tracks, tracks); + fillHistograms(RecCollision, tracks, tracks); // Generated MC for (auto& mcPart : mcParticles) { @@ -995,7 +1074,7 @@ struct k892analysis_PbPb { histos.fill(HIST("QAevent/hMultiplicityPercentMC"), centrality); auto tracks = RecTracks.sliceByCached(aod::track::collisionId, RecCollision.globalIndex(), cache); - fillHistograms(RecCollision, tracks, tracks); + fillHistograms(RecCollision, tracks, tracks); // Generated MC for (auto& mcPart : mcParticles) { From 21a8eceadfdbbb783092d4b38a7da9a79f6dd92d Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 15 Jan 2025 18:34:18 +0000 Subject: [PATCH 3/5] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 82 +++++++++----------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index fb899aa2b58..eb64f7d9e89 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -96,14 +96,14 @@ struct k892analysis_PbPb { Configurable cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF 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 cByPassTOF{"cByPassTOF", false, "By pass TOF PID selection"}; // By pass TOF PID selection 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 + // 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)"}; @@ -132,7 +132,6 @@ struct k892analysis_PbPb { TRandom* rand = new TRandom(); - void init(o2::framework::InitContext&) { AxisSpec centAxis = {binsCent, "V0M (%)"}; @@ -448,49 +447,47 @@ struct k892analysis_PbPb { } } - int track1Sign = trk1.sign(); int track2Sign = trk2.sign(); - //// Resonance reconstruction lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; // Rapidity cut if (abs(lResonance.Rapidity()) >= 0.5) - continue; + continue; if (cfgCutsOnMother && !IsRot) { - if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow - continue; - if (lResonance.M() >= cMaxMinvMotherCut) // excluding candidates in overflow - continue; + if (lResonance.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (lResonance.M() >= cMaxMinvMotherCut) // excluding candidates in overflow + continue; } - + //// Un-like sign pair only 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; - - if (cfgCutsOnMother) { - if (lResonance_rot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow - continue; - if (lResonance_rot.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()); - } else if (track1Sign > 0) { - histos.fill(HIST("k892invmassRotDSAnti"), lResonance.M()); - histos.fill(HIST("h3k892invmassRotDSAnti"), multiplicity, lResonance_rot.Pt(), lResonance_rot.M()); - } - } - } else if constexpr (!IsMix) { //same event + 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; + + if (cfgCutsOnMother) { + if (lResonance_rot.Pt() >= cMaxPtMotherCut) // excluding candidates in overflow + continue; + if (lResonance_rot.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()); + } else if (track1Sign > 0) { + histos.fill(HIST("k892invmassRotDSAnti"), lResonance.M()); + histos.fill(HIST("h3k892invmassRotDSAnti"), multiplicity, lResonance_rot.Pt(), lResonance_rot.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()); @@ -666,7 +663,6 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", true); - void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { if (!collision.sel8()) { @@ -682,7 +678,7 @@ struct k892analysis_PbPb { return; } // int occupancy = collision.trackOccupancyInTimeRange(); - + if (tpclowpt) { //+- auto candPosPitpc = posPitpc->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -711,7 +707,7 @@ struct k892analysis_PbPb { } } PROCESS_SWITCH(k892analysis_PbPb, processRotationalBkg, "Process Rotational Background", false); - + ///////*************************************** using Run2Events = soa::Join; //, aod::TrackletMults>; @@ -839,7 +835,6 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processMixedEvent, "Process Mixed event", true); - using BinningTypeVtxCentRun2 = ColumnBinningPolicy; void processMixedEventRun2(Run2Events const& collisions, TrackCandidates const& tracks, BCsWithRun2Info const&) { @@ -909,13 +904,12 @@ struct k892analysis_PbPb { 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}; SameKindPair pairs{colBinning, cfgNoMixedEvents, -1, recCollisions, tracksTuple, &cache}; - + for (auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (!collision1.sel8() || !collision2.sel8()) { continue; @@ -923,7 +917,7 @@ struct k892analysis_PbPb { 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) )) { + 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))) { @@ -932,7 +926,7 @@ struct k892analysis_PbPb { if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { continue; } - + if (additionalQAeventPlots) { histos.fill(HIST("QAevent/hEvtCounterMixedE"), 1.0); histos.fill(HIST("QAevent/hVertexZMixedE"), collision1.posZ()); @@ -942,16 +936,10 @@ struct k892analysis_PbPb { } 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) { histos.fill(HIST("hMCrecCollSels"), 0); From e2d534fc9ab34052ace1686a2aaa73d082f70be8 Mon Sep 17 00:00:00 2001 From: Marta Urioni <78807256+murioni@users.noreply.github.com> Date: Wed, 15 Jan 2025 23:03:21 +0100 Subject: [PATCH 4/5] fixing compilation warning k892analysis_PbPb.cxx --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index eb64f7d9e89..df27984a4b6 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -663,7 +663,7 @@ struct k892analysis_PbPb { } PROCESS_SWITCH(k892analysis_PbPb, processSameEvent, "Process Same event", true); - void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) + void processRotationalBkg(EventCandidates::iterator const& collision, TrackCandidates const&, aod::BCs const&) { if (!collision.sel8()) { return; From e926043d9423faa32832075f1216a5bfada51881 Mon Sep 17 00:00:00 2001 From: Marta Urioni <78807256+murioni@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:59:40 +0100 Subject: [PATCH 5/5] Update k892analysis_PbPb.cxx --- PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx index df27984a4b6..71abc9c6161 100644 --- a/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -202,7 +202,7 @@ struct k892analysis_PbPb { histos.add("QA/TOF_Nsigma_ka_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); histos.add("QA/TPC_Nsigmaka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH3F, {centAxis, ptAxisQA, pidQAAxis}}); - // 3d histogram + // inv mass histograms histos.add("h3k892invmassDS", "Invariant mass of K(892)0 differnt sign", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892invmassDSAnti", "Invariant mass of Anti-K(892)0 differnt sign", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3k892invmassLS", "Invariant mass of K(892)0 same sign", kTH3F, {centAxis, ptAxis, invMassAxis});