Skip to content

Commit

Permalink
PWGLF: optional proper lifetime at builder time, def off (AliceO2Grou…
Browse files Browse the repository at this point in the history
…p#4499)

* PWGLF: optional proper lifetime at builder time, def off

* Please consider the following formatting changes (#228)

* Update strangederivedbuilder.cxx

---------

Co-authored-by: ALICE Builder <[email protected]>
  • Loading branch information
ddobrigk and alibuild authored Jan 29, 2024
1 parent bd36cbc commit 2dc8ebc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
59 changes: 44 additions & 15 deletions PWGLF/TableProducer/lambdakzerobuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ struct lambdakzeroBuilder {
Configurable<bool> massWindowWithTPCPID{"massWindowWithTPCPID", true, "when checking mass windows, correlate with TPC dE/dx"};
Configurable<float> 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<LabeledArray<float>> lifetimecut{"lifetimecut", {defaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"};

int mRunNumber;
float d_bz;
float maxSnp; // max sine phi for propagation
Expand Down Expand Up @@ -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) {
Expand All @@ -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]++;

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion PWGLF/TableProducer/strangederivedbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 2dc8ebc

Please sign in to comment.