diff --git a/PWGLF/TableProducer/lambdakzerobuilder.cxx b/PWGLF/TableProducer/lambdakzerobuilder.cxx index 945cff25c96..2a124b73fa7 100644 --- a/PWGLF/TableProducer/lambdakzerobuilder.cxx +++ b/PWGLF/TableProducer/lambdakzerobuilder.cxx @@ -194,6 +194,13 @@ struct lambdakzeroBuilder { Configurable massWindowWithTPCPID{"massWindowWithTPCPID", true, "when checking mass windows, correlate with TPC dE/dx"}; Configurable massWindowSafetyMargin{"massWindowSafetyMargin", 0.001, "Extra mass window safety margin"}; + // apply lifetime cuts to K0Short and Lambda candidates + // unit of measurement: centimeters + // lifetime of Lambda ~7.9cm but keep in mind feeddown from cascades + // lifetime of K0Short ~2.5cm, no feeddown and plenty to cut + static constexpr float defaultLifetimeCuts[1][2] = {{1e+6, 1e+6}}; + Configurable> lifetimecut{"lifetimecut", {defaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; + int mRunNumber; float d_bz; float maxSnp; // max sine phi for propagation @@ -717,6 +724,8 @@ struct lambdakzeroBuilder { auto py = v0candidate.posP[1] + v0candidate.negP[1]; auto pz = v0candidate.posP[2] + v0candidate.negP[2]; auto lPt = RecoDecay::sqrtSumOfSquares(v0candidate.posP[0] + v0candidate.negP[0], v0candidate.posP[1] + v0candidate.negP[1]); + auto lPtotal = RecoDecay::sqrtSumOfSquares(lPt, v0candidate.posP[2] + v0candidate.negP[2]); + auto lLengthTraveled = RecoDecay::sqrtSumOfSquares(v0candidate.pos[0] - primaryVertex.getX(), v0candidate.pos[1] - primaryVertex.getY(), v0candidate.pos[2] - primaryVertex.getZ()); // Momentum range check if (lPt < minimumPt || lPt > maximumPt) { @@ -729,6 +738,11 @@ struct lambdakzeroBuilder { return false; // reject - daughters have too large eta to be reliable for MC corrections } + // calculate proper lifetime + // m*L/p for each hypothesis + float lML2P_K0Short = o2::constants::physics::MassKaonNeutral * lLengthTraveled / lPtotal; + float lML2P_Lambda = o2::constants::physics::MassLambda * lLengthTraveled / lPtotal; + // Passes momentum window check statisticsRegistry.v0stats[kWithinMomentumRange]++; @@ -741,25 +755,40 @@ struct lambdakzeroBuilder { auto lAntiHypertritonMass = RecoDecay::m(array{array{v0candidate.posP[0], v0candidate.posP[1], v0candidate.posP[2]}, array{2.0f * v0candidate.negP[0], 2.0f * v0candidate.negP[1], 2.0f * v0candidate.negP[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3}); // mass window check - bool desiredMass = false; + bool keepCandidate = false; + + bool desiredMassK0Short = false; + bool desiredMassLambda = false; + bool desiredMassAntiLambda = false; + if (massWindownumberOfSigmas > 1e+3) { - desiredMass = true; // safety fallback + desiredMassK0Short = true; // safety fallback + desiredMassLambda = true; // safety fallback + desiredMassAntiLambda = true; // safety fallback } else { - // check if user requested to correlate mass requirement with TPC PID - // (useful for data volume reduction) - bool dEdxK0Short = V0.isdEdxK0Short() || !massWindowWithTPCPID; - bool dEdxLambda = V0.isdEdxLambda() || !massWindowWithTPCPID; - bool dEdxAntiLambda = V0.isdEdxAntiLambda() || !massWindowWithTPCPID; - - if (dEdxK0Short && TMath::Abs(v0candidate.k0ShortMass - o2::constants::physics::MassKaonNeutral) < massWindownumberOfSigmas * getMassSigmaK0Short(lPt) + massWindowSafetyMargin) - desiredMass = true; - if (dEdxLambda && TMath::Abs(v0candidate.lambdaMass - o2::constants::physics::MassLambda) < massWindownumberOfSigmas * getMassSigmaLambda(lPt) + massWindowSafetyMargin) - desiredMass = true; - if (dEdxAntiLambda && TMath::Abs(v0candidate.antiLambdaMass - o2::constants::physics::MassLambda) < massWindownumberOfSigmas * getMassSigmaLambda(lPt) + massWindowSafetyMargin) - desiredMass = true; + desiredMassK0Short = TMath::Abs(v0candidate.k0ShortMass - o2::constants::physics::MassKaonNeutral) < massWindownumberOfSigmas * getMassSigmaK0Short(lPt) + massWindowSafetyMargin; + desiredMassLambda = TMath::Abs(v0candidate.lambdaMass - o2::constants::physics::MassLambda) < massWindownumberOfSigmas * getMassSigmaLambda(lPt) + massWindowSafetyMargin; + desiredMassAntiLambda = TMath::Abs(v0candidate.antiLambdaMass - o2::constants::physics::MassLambda) < massWindownumberOfSigmas * getMassSigmaLambda(lPt) + massWindowSafetyMargin; } - if (!desiredMass) + // check if user requested to correlate mass requirement with TPC PID + // (useful for data volume reduction) + bool dEdxK0Short = V0.isdEdxK0Short() || !massWindowWithTPCPID; + bool dEdxLambda = V0.isdEdxLambda() || !massWindowWithTPCPID; + bool dEdxAntiLambda = V0.isdEdxAntiLambda() || !massWindowWithTPCPID; + + // check proper lifetime if asked for + bool passML2P_K0Short = lML2P_K0Short < lifetimecut->get("lifetimecutK0S") || lifetimecut->get("lifetimecutK0S") > 1000; + bool passML2P_Lambda = lML2P_Lambda < lifetimecut->get("lifetimecutLambda") || lifetimecut->get("lifetimecutLambda") > 1000; + + if (passML2P_K0Short && dEdxK0Short && desiredMassK0Short) + keepCandidate = true; + if (passML2P_Lambda && dEdxLambda && desiredMassLambda) + keepCandidate = true; + if (passML2P_Lambda && dEdxAntiLambda && desiredMassAntiLambda) + keepCandidate = true; + + if (!keepCandidate) return false; if (d_doTrackQA) { diff --git a/PWGLF/TableProducer/strangederivedbuilder.cxx b/PWGLF/TableProducer/strangederivedbuilder.cxx index fb3b01c3e13..5cad9c8fc0a 100644 --- a/PWGLF/TableProducer/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/strangederivedbuilder.cxx @@ -503,7 +503,7 @@ struct strangederivedbuilder { histos.fill(HIST("h2dNVerticesVsCentrality"), bestCentrality, collisions.size()); for (auto& mcp : mcParticles) { - if (TMath::Abs(mcp.y()) < 0.5) { + if (TMath::Abs(mcp.y()) < 0.5 && mcp.isPhysicalPrimary()) { static_for<0, nSpecies - 1>([&](auto i) { constexpr int index = i.value; if (mcp.pdgCode() == particlePDGCodes[index] && bitcheck(enabledBits, index)) {