Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 42 additions & 24 deletions PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ struct HStrangeCorrelationFilter {
if (!collision.selection_bit(aod::evsel::kIsGoodITSLayersAll) && eventSelections.requireAllGoodITSLayers) {
return false;
}
// same occupancy / time frame / ITS ROF border selections as in Pb-Pb
auto occupancy = collision.trackOccupancyInTimeRange();
if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) {
return false;
}
if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
return false;
}
if (zorroMask.value != "") {
auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
initCCDB(bc);
Expand Down Expand Up @@ -863,57 +871,62 @@ struct HStrangeCorrelationFilter {
continue;
}

// proper lifetime (c tau): required in both pp and PbPb, DCA and Armenteros below stay PbPb only
const float v0DistOverTotMom = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ());
const bool passesLifetimeK0S = v0DistOverTotMom * o2::constants::physics::MassK0Short < v0Selection.lifetimecutK0S;
const bool passesLifetimeLambda = v0DistOverTotMom * o2::constants::physics::MassLambda0 < v0Selection.lifetimecutLambda;
const bool passesLifetimeAntiLambda = v0DistOverTotMom * o2::constants::physics::MassLambda0Bar < v0Selection.lifetimecutLambda;
float dcaDauCutForK0s = v0Selection.dcaDaugToPVForK0s == 0 ? v0Selection.dcaMesonToPV : v0Selection.dcaDaugToPVForK0s;
bool isGoodK0Short = (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < v0Selection.lifetimecutK0S &&
bool isGoodK0Short = (passesLifetimeK0S &&
std::abs(v0.dcapostopv()) > dcaDauCutForK0s && std::abs(v0.dcanegtopv()) > dcaDauCutForK0s &&
v0.qtarm() * v0Selection.armPodCut > std::abs(v0.alpha()));
bool isGoodLambda = (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0Selection.lifetimecutLambda &&
bool isGoodLambda = (passesLifetimeLambda &&
std::abs(v0.dcapostopv()) > v0Selection.dcaBaryonToPV && std::abs(v0.dcanegtopv()) > v0Selection.dcaMesonToPV);
bool isGoodAntiLambda = (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar < v0Selection.lifetimecutLambda &&
bool isGoodAntiLambda = (passesLifetimeAntiLambda &&
std::abs(v0.dcapostopv()) > v0Selection.dcaMesonToPV && std::abs(v0.dcanegtopv()) > v0Selection.dcaBaryonToPV);
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) {
if (doPPAnalysis || isGoodK0Short) {
if (doPPAnalysis ? passesLifetimeK0S : isGoodK0Short) {
SETBIT(compatibleK0Short, 0);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) {
if (doPPAnalysis || isGoodK0Short) {
if (doPPAnalysis ? passesLifetimeK0S : isGoodK0Short) {
SETBIT(compatibleK0Short, 1);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) {
if (doPPAnalysis || isGoodK0Short) {
if (doPPAnalysis ? passesLifetimeK0S : isGoodK0Short) {
SETBIT(compatibleK0Short, 2);
}
}
if (v0.v0cosPA() > v0Selection.lambdaCospa) {
if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) {
if (doPPAnalysis || isGoodLambda) {
if (doPPAnalysis ? passesLifetimeLambda : isGoodLambda) {
SETBIT(compatibleLambda, 0);
}
}
if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) {
if (doPPAnalysis || isGoodLambda) {
if (doPPAnalysis ? passesLifetimeLambda : isGoodLambda) {
SETBIT(compatibleLambda, 1);
}
}
if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) {
if (doPPAnalysis || isGoodLambda) {
if (doPPAnalysis ? passesLifetimeLambda : isGoodLambda) {
SETBIT(compatibleLambda, 2);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose) {
if (doPPAnalysis || isGoodAntiLambda) {
if (doPPAnalysis ? passesLifetimeAntiLambda : isGoodAntiLambda) {
SETBIT(compatibleAntiLambda, 0);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigma) {
if (doPPAnalysis || isGoodAntiLambda) {
if (doPPAnalysis ? passesLifetimeAntiLambda : isGoodAntiLambda) {
SETBIT(compatibleAntiLambda, 1);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaTight) {
if (doPPAnalysis || isGoodAntiLambda) {
if (doPPAnalysis ? passesLifetimeAntiLambda : isGoodAntiLambda) {
SETBIT(compatibleAntiLambda, 2);
}
}
Expand Down Expand Up @@ -1002,58 +1015,63 @@ struct HStrangeCorrelationFilter {
continue;
}

// proper lifetime (c tau): required in both pp and PbPb, DCA and Armenteros below stay PbPb only
const float v0DistOverTotMom = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ());
const bool passesLifetimeK0S = v0DistOverTotMom * o2::constants::physics::MassK0Short < v0Selection.lifetimecutK0S;
const bool passesLifetimeLambda = v0DistOverTotMom * o2::constants::physics::MassLambda0 < v0Selection.lifetimecutLambda;
const bool passesLifetimeAntiLambda = v0DistOverTotMom * o2::constants::physics::MassLambda0Bar < v0Selection.lifetimecutLambda;
float dcaDauCutForK0s = v0Selection.dcaDaugToPVForK0s == 0 ? v0Selection.dcaMesonToPV : v0Selection.dcaDaugToPVForK0s;
bool isGoodK0Short = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < v0Selection.lifetimecutK0S &&
bool isGoodK0Short = passesLifetimeK0S &&
std::abs(v0.dcapostopv()) > dcaDauCutForK0s && std::abs(v0.dcanegtopv()) > dcaDauCutForK0s &&
v0.qtarm() * v0Selection.armPodCut > std::abs(v0.alpha());
bool isGoodLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < v0Selection.lifetimecutLambda &&
bool isGoodLambda = passesLifetimeLambda &&
std::abs(v0.dcapostopv()) > v0Selection.dcaBaryonToPV && std::abs(v0.dcanegtopv()) > v0Selection.dcaMesonToPV;
bool isGoodAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar < v0Selection.lifetimecutLambda &&
bool isGoodAntiLambda = passesLifetimeAntiLambda &&
std::abs(v0.dcapostopv()) > v0Selection.dcaMesonToPV && std::abs(v0.dcanegtopv()) > v0Selection.dcaBaryonToPV;
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) {
if (doPPAnalysis || isGoodK0Short) {
if (doPPAnalysis ? passesLifetimeK0S : isGoodK0Short) {
SETBIT(compatibleK0Short, 0);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) {
if (doPPAnalysis || isGoodK0Short) {
if (doPPAnalysis ? passesLifetimeK0S : isGoodK0Short) {
SETBIT(compatibleK0Short, 1);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) {
if (doPPAnalysis || isGoodK0Short) {
if (doPPAnalysis ? passesLifetimeK0S : isGoodK0Short) {
SETBIT(compatibleK0Short, 2);
}
}
if (v0.v0cosPA() > v0Selection.lambdaCospa) {
if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose) {
if (doPPAnalysis || isGoodLambda) {
if (doPPAnalysis ? passesLifetimeLambda : isGoodLambda) {
SETBIT(compatibleLambda, 0);
}
}
if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigma) {
if (doPPAnalysis || isGoodLambda) {
if (doPPAnalysis ? passesLifetimeLambda : isGoodLambda) {
SETBIT(compatibleLambda, 1);
}
}

if (std::abs(posdau.tpcNSigmaPr()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPi()) < strangedEdxNSigmaTight) {
if (doPPAnalysis || isGoodLambda) {
if (doPPAnalysis ? passesLifetimeLambda : isGoodLambda) {
SETBIT(compatibleLambda, 2);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaLoose && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaLoose) {
if (doPPAnalysis || isGoodAntiLambda) {
if (doPPAnalysis ? passesLifetimeAntiLambda : isGoodAntiLambda) {
SETBIT(compatibleAntiLambda, 0);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigma && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigma) {
if (doPPAnalysis || isGoodAntiLambda) {
if (doPPAnalysis ? passesLifetimeAntiLambda : isGoodAntiLambda) {
SETBIT(compatibleAntiLambda, 1);
}
}
if (std::abs(posdau.tpcNSigmaPi()) < strangedEdxNSigmaTight && std::abs(negdau.tpcNSigmaPr()) < strangedEdxNSigmaTight) {
if (doPPAnalysis || isGoodAntiLambda) {
if (doPPAnalysis ? passesLifetimeAntiLambda : isGoodAntiLambda) {
SETBIT(compatibleAntiLambda, 2);
}
}
Expand Down
70 changes: 68 additions & 2 deletions PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <THn.h>
#include <THnSparse.h>
#include <TList.h>
#include <TMCProcess.h>
#include <TPDGCode.h>
#include <TString.h>

Expand Down Expand Up @@ -758,6 +759,7 @@ struct HStrangeCorrelation {
int64_t globalIndex = -1;
int64_t motherIndex = -1;
bool reconstructed = false;
int origin = 0; // 0 = physical primary, 1 = secondary from material, 2 = secondary from weak decay
};

struct PairLossTruthK0Info {
Expand Down Expand Up @@ -1699,7 +1701,7 @@ struct HStrangeCorrelation {
std::swap(binFillThnOppositeSignDaugher[2], binFillThnSameSignDaugher[2]);
}
std::array<double, 6> binFillThn = {deltaphi, deltaeta, ptassoc, pttrigger, pvz, mult};
if (TESTBIT(doCorrelation, Index) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0) && (masterConfigurations.doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) {
if (TESTBIT(doCorrelation, Index) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0) && (TESTBIT(selMap, Index) && (masterConfigurations.doPPAnalysis || TESTBIT(selMap, Index + 3)))) {
if (assocCandidate.compatible(Index, trackSelection.dEdxCompatibility) && (!masterConfigurations.doMCassociation || assocCandidate.mcTrue(Index)) && (!masterConfigurations.doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && masterConfigurations.doMassSpectrumCheck &&
((-massWindowConfigurations.maxBgNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < -massWindowConfigurations.minBgNSigma) ||
(-massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) ||
Expand Down Expand Up @@ -3176,6 +3178,15 @@ struct HStrangeCorrelation {
// reconstructed, so Reconstructed + OnlyTriggerReconstructed + OnlyK0Reconstructed
// + NotReconstructed equals Gen bin by bin.
histos.add("PairLossK0/GenStudy/Gen/hCorrelation", "generated h-K0s pairs;#Delta#eta;#Delta#varphi;#it{p}_{T}^{trigger} (GeV/#it{c});#it{p}_{T}^{K^{0}_{S}} (GeV/#it{c});#it{N}_{ch}^{gen}", kTHnF, {axisDeltaEtaNDim, axisDeltaPhiNDim, axisPtTriggerNDim, axisPtAssocNDim, axisGenStudyNch});
// Origin of triggers and K0s (primaries and both kinds of secondaries) in three classes:
// All (inclusive), NearSide (has a K0s / trigger at |#Delta#varphi| < #pi/2) and AwaySide
// (has one in the other half of the 2#pi range). A particle can be in NearSide and AwaySide at once.
const AxisSpec axisOrigin{3, -0.5, 2.5, "origin: 0 primary, 1 material, 2 weak decay"};
const AxisSpec axisReco{2, -0.5, 1.5, "reconstructed"};
histos.add("PairLossK0/GenStudy/Origin/All/hTrigger", "triggers by origin;#it{p}_{T}^{trigger} (GeV/#it{c});origin;reconstructed", kTH3F, {axesConfigurations.axisPtQA, axisOrigin, axisReco});
histos.add("PairLossK0/GenStudy/Origin/All/hK0Short", "K0s by origin;#it{p}_{T}^{K^{0}_{S}} (GeV/#it{c});origin;reconstructed", kTH3F, {axesConfigurations.axisPtQA, axisOrigin, axisReco});
histos.addClone("PairLossK0/GenStudy/Origin/All/", "PairLossK0/GenStudy/Origin/NearSide/");
histos.addClone("PairLossK0/GenStudy/Origin/All/", "PairLossK0/GenStudy/Origin/AwaySide/");
histos.addClone("PairLossK0/GenStudy/Gen/", "PairLossK0/GenStudy/Reconstructed/");
histos.addClone("PairLossK0/GenStudy/Gen/", "PairLossK0/GenStudy/NotReconstructed/");
// Only the correlation exists for the two mixed classes -- a single particle is
Expand Down Expand Up @@ -3712,6 +3723,14 @@ struct HStrangeCorrelation {
// use this cut at low multiplicities with caution
return false;
}
// same occupancy / time frame / ITS ROF border selections as in Pb-Pb
auto occupancy = collision.trackOccupancyInTimeRange();
if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) {
return false;
}
if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
return false;
}
if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup) && masterConfigurations.rejectSameBunchPileup) {
// rejects collisions which are associated with the same "found-by-T0" bunch crossing
return false;
Expand Down Expand Up @@ -4083,7 +4102,7 @@ struct HStrangeCorrelation {
}
float weight = efficiencyFlags.applyEfficiencyCorrection ? 1. / efficiency : 1.0f;
if (v0.compatible(Index, trackSelection.dEdxCompatibility) && (!masterConfigurations.doMCassociation || v0.mcTrue(Index)) && (!masterConfigurations.doAssocPhysicalPrimary || v0.mcPhysicalPrimary()) && (!efficiencyFlags.applyEfficiencyCorrection || efficiency != 0)) {
if ((TESTBIT(doCorrelation, Index)) && (masterConfigurations.doPPAnalysis || (TESTBIT(selMap, Index) && TESTBIT(selMap, Index + 3)))) {
if ((TESTBIT(doCorrelation, Index)) && (TESTBIT(selMap, Index) && (masterConfigurations.doPPAnalysis || TESTBIT(selMap, Index + 3)))) {
histos.fill(HIST("h3d") + HIST(V0names[Index]) + HIST("Spectrum"), v0Data.pt(), cent, v0.invMassNSigma(Index), weight);
if (masterConfigurations.doMassSpectrumCheck) {
histos.fill(HIST("h") + HIST(V0names[Index]) + HIST("PtVsMass"), v0Data.pt(), getV0InvariantMass<Index>(v0Data));
Expand Down Expand Up @@ -5105,6 +5124,53 @@ struct HStrangeCorrelation {
}
}
}

// Origin study. Same trigger / K0s definitions as above, but without the
// physical-primary requirement, so that secondaries are kept and classified.
// Material = not primary and not a weak decay (needs the transport process in the MC).
std::vector<GenStudyPairObject> originTriggers;
std::vector<GenStudyPairObject> originK0s;
for (auto const& mcParticle : mcParticles) {
const bool isK0 = mcParticle.pdgCode() == PDG_t::kK0Short;
if (std::abs(mcParticle.eta()) > etaSel || (!isK0 && !isPairLossTriggerPdg(mcParticle.pdgCode()))) {
continue;
}
const int origin = mcParticle.isPhysicalPrimary() ? 0 : (mcParticle.getProcess() == TMCProcess::kPDecay ? 2 : 1);
GenStudyPairObject object{.pt = mcParticle.pt(), .eta = mcParticle.eta(), .phi = mcParticle.phi(), .globalIndex = mcParticle.globalIndex(), .motherIndex = mcParticle.has_mothers() ? mcParticle.mothers_first_as<aod::McParticles>().globalIndex() : -1, .reconstructed = false, .origin = origin};
if (isK0 && object.pt >= axisRanges[2][0] && object.pt <= axisRanges[2][1]) {
object.reconstructed = reconstructedV0McIds.contains(object.globalIndex);
originK0s.push_back(object);
} else if (!isK0 && object.pt >= axisRanges[3][0] && object.pt <= axisRanges[3][1]) {
object.reconstructed = reconstructedTrackMcIds.contains(object.globalIndex);
originTriggers.push_back(object);
}
}
// near-side: -pi/2 < deltaPhi < pi/2; away-side: the other half of the 2pi range.
// computeDeltaPhi returns [-pi/2, 3pi/2), so the split is at pi/2.
auto hasSide = [&](GenStudyPairObject const& object, std::vector<GenStudyPairObject> const& others, bool nearSide) {
return std::any_of(others.begin(), others.end(), [&](GenStudyPairObject const& other) {
return object.globalIndex != other.globalIndex && object.motherIndex != other.globalIndex && other.motherIndex != object.globalIndex &&
(computeDeltaPhi(object.phi, other.phi) < PIHalf) == nearSide;
});
};
for (auto const& trigger : originTriggers) {
histos.fill(HIST("PairLossK0/GenStudy/Origin/All/hTrigger"), trigger.pt, trigger.origin, trigger.reconstructed);
if (hasSide(trigger, originK0s, true)) {
histos.fill(HIST("PairLossK0/GenStudy/Origin/NearSide/hTrigger"), trigger.pt, trigger.origin, trigger.reconstructed);
}
if (hasSide(trigger, originK0s, false)) {
histos.fill(HIST("PairLossK0/GenStudy/Origin/AwaySide/hTrigger"), trigger.pt, trigger.origin, trigger.reconstructed);
}
}
for (auto const& k0 : originK0s) {
histos.fill(HIST("PairLossK0/GenStudy/Origin/All/hK0Short"), k0.pt, k0.origin, k0.reconstructed);
if (hasSide(k0, originTriggers, true)) {
histos.fill(HIST("PairLossK0/GenStudy/Origin/NearSide/hK0Short"), k0.pt, k0.origin, k0.reconstructed);
}
if (hasSide(k0, originTriggers, false)) {
histos.fill(HIST("PairLossK0/GenStudy/Origin/AwaySide/hK0Short"), k0.pt, k0.origin, k0.reconstructed);
}
}
};

// Part 2. Wrapped in a lambda so that its own early exits leave the other
Expand Down
Loading