Skip to content

Commit 4307e99

Browse files
author
Henrik Fribert
committed
SigmaPlus improved selections and tables
1 parent abd5072 commit 4307e99

3 files changed

Lines changed: 547 additions & 155 deletions

File tree

PWGLF/DataModel/LFKinkDecayTables.h

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,12 @@ DECLARE_SOA_TABLE(SlimKinkCandsMC, "AOD", "SLIMKINKCANDSMC",
163163
namespace sigmapluscand
164164
{
165165

166-
DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); //! Decay vertex of the candidate (x direction)
167-
DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); //! Decay vertex of the candidate (y direction)
168-
DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); //! Decay vertex of the candidate (z direction)
169-
DECLARE_SOA_COLUMN(Radius, radius, float); //! Decay radius of the candidate (cm)
170-
DECLARE_SOA_COLUMN(FlightDistance, flightDistance, float); //! Flight distance of the candidate (PV to decay vertex, cm)
171-
DECLARE_SOA_COLUMN(DcaProtonGamma, dcaProtonGamma, float); //! DCA between proton and photon at the fitted vertex (cm)
172-
DECLARE_SOA_COLUMN(Chi2, chi2, float); //! chi2 of the proton-photon vertex fit
166+
DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); //! Decay vertex of the candidate (x direction)
167+
DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); //! Decay vertex of the candidate (y direction)
168+
DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); //! Decay vertex of the candidate (z direction)
169+
DECLARE_SOA_COLUMN(FlightDistance, flightDistance, float); //! 3D distance from the PV to the decay vertex (cm)
170+
DECLARE_SOA_COLUMN(TransDecayRadius, transDecayRadius, float); //! Transverse decay radius of the candidate (cm), stored directly in the slim tables (no XDecVtx/YDecVtx there)
171+
DECLARE_SOA_COLUMN(DcaProtonGamma, dcaProtonGamma, float); //! DCA between proton and photon at the fitted vertex (cm)
173172

174173
DECLARE_SOA_COLUMN(PxProton, pxProton, float); //! Px of the proton
175174
DECLARE_SOA_COLUMN(PyProton, pyProton, float); //! Py of the proton
@@ -194,6 +193,11 @@ DECLARE_SOA_COLUMN(PhotonOpeningAngle, photonOpeningAngle, float); //! Opening
194193
DECLARE_SOA_COLUMN(PhotonPointingAngle, photonPointingAngle, float); //! Angle between the photon momentum and the line from its conversion point to the candidate decay vertex (rad)
195194
DECLARE_SOA_COLUMN(PhotonDcaToPV, photonDcaToPV, float); //! DCA of the photon's flight line to the primary vertex (cm)
196195

196+
DECLARE_SOA_COLUMN(RootCenter, rootCenter, float); //! -coefB/(2*coefA) of the missing-photon quadratic solve: negative flags an unphysical phase-space point
197+
DECLARE_SOA_COLUMN(AntiSigmaPointingAngle, antiSigmaPointingAngle, float); //! Angle between the field-unbent proton momentum (from its original reference point) and the PV->decay-vertex direction
198+
DECLARE_SOA_COLUMN(CandDcaToPV, candDcaToPV, float); //! DCA of the candidate's total reconstructed momentum line to the PV (cm)
199+
200+
DECLARE_SOA_COLUMN(ProtonSign, protonSign, int); //! Charge sign of the proton track (= sign of the whole candidate, since the photon is neutral)
197201
DECLARE_SOA_COLUMN(ProtonItsNCls, protonItsNCls, uint8_t); //! Number of ITS clusters of the proton track
198202
DECLARE_SOA_COLUMN(ProtonTpcNCls, protonTpcNCls, int16_t); //! Number of found TPC clusters of the proton track
199203
DECLARE_SOA_COLUMN(ProtonDcaXY, protonDcaXY, float); //! DCA of the proton track to the primary vertex, xy (cm)
@@ -205,18 +209,15 @@ DECLARE_SOA_COLUMN(PhotonNegItsNCls, photonNegItsNCls, uint8_t); //! Number of I
205209
DECLARE_SOA_COLUMN(PhotonNegTpcNCls, photonNegTpcNCls, int16_t); //! Number of found TPC clusters of the photon's negative daughter
206210

207211
// MC columns
208-
DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! True if proton and photon are MC-truth matched to the same Sigma+
212+
DECLARE_SOA_COLUMN(CollisionIdCheck, collisionIdCheck, bool); //! True if the proton's collision ID matches the reconstructed collision ID
209213

210-
DECLARE_SOA_COLUMN(ProtonPdgCode, protonPdgCode, int); //! PDG code of the proton's MC particle
211-
DECLARE_SOA_COLUMN(ProtonMotherPdgCode, protonMotherPdgCode, int); //! PDG code of the proton's MC mother
212-
DECLARE_SOA_COLUMN(GammaPdgCode, gammaPdgCode, int); //! PDG code of the measured photon's MC particle
213-
DECLARE_SOA_COLUMN(GammaMotherPdgCode, gammaMotherPdgCode, int); //! PDG code of the photon's MC mother (expected: pi0)
214-
DECLARE_SOA_COLUMN(GammaGMotherPdgCode, gammaGMotherPdgCode, int); //! PDG code of the photon's MC grandmother (expected: Sigma+)
214+
DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! True if the proton and photon share the same true Sigma+ mother
215215

216216
DECLARE_SOA_COLUMN(XDecVtxMC, xDecVtxMC, float); //! MC-truth Sigma+ decay vertex (x direction)
217217
DECLARE_SOA_COLUMN(YDecVtxMC, yDecVtxMC, float); //! MC-truth Sigma+ decay vertex (y direction)
218218
DECLARE_SOA_COLUMN(ZDecVtxMC, zDecVtxMC, float); //! MC-truth Sigma+ decay vertex (z direction)
219219
DECLARE_SOA_COLUMN(DecayRadiusMC, decayRadiusMC, float); //! MC-truth Sigma+ decay radius
220+
DECLARE_SOA_COLUMN(MassMC, massMC, float); //! MC-truth invariant mass of the Sigma+ mother
220221
DECLARE_SOA_COLUMN(PxSigmaPlusMC, pxSigmaPlusMC, float); //! MC-truth Sigma+ mother Px
221222
DECLARE_SOA_COLUMN(PySigmaPlusMC, pySigmaPlusMC, float); //! MC-truth Sigma+ mother Py
222223
DECLARE_SOA_COLUMN(PzSigmaPlusMC, pzSigmaPlusMC, float); //! MC-truth Sigma+ mother Pz
@@ -229,6 +230,12 @@ DECLARE_SOA_COLUMN(PzGammaMC, pzGammaMC, float); //! MC-truth momentum o
229230

230231
// DYNAMIC COLUMNS
231232

233+
DECLARE_SOA_DYNAMIC_COLUMN(Radius, radius, //! Transverse decay radius of the candidate (cm), from the beam axis
234+
[](float xDecVtx, float yDecVtx) -> float { return std::hypot(xDecVtx, yDecVtx); });
235+
236+
DECLARE_SOA_DYNAMIC_COLUMN(Chi2, chi2, //! chi2 of the proton-photon vertex fit; dcaProtonGamma = sqrt(chi2) by construction in the builder
237+
[](float dcaProtonGamma) -> float { return dcaProtonGamma * dcaProtonGamma; });
238+
232239
DECLARE_SOA_DYNAMIC_COLUMN(PxSigmaPlus, pxSigmaPlus, //! Px of the Sigma+ candidate
233240
[](float pxProton, float pxGamma1, float pxGamma2) -> float { return pxProton + pxGamma1 + pxGamma2; });
234241

@@ -258,48 +265,54 @@ DECLARE_SOA_DYNAMIC_COLUMN(YSigmaPlusMC, ySigmaPlusMC, //! True rapidity of the
258265
} // namespace sigmapluscand
259266

260267
DECLARE_SOA_TABLE(SigmaPlusCands, "AOD", "SIGMAPLUSCANDS",
261-
sigmapluscand::XDecVtx, sigmapluscand::YDecVtx, sigmapluscand::ZDecVtx,
262-
sigmapluscand::Radius, sigmapluscand::FlightDistance,
263-
sigmapluscand::DcaProtonGamma, sigmapluscand::Chi2,
268+
sigmapluscand::XDecVtx, sigmapluscand::YDecVtx, sigmapluscand::ZDecVtx, sigmapluscand::FlightDistance,
269+
sigmapluscand::DcaProtonGamma,
264270
sigmapluscand::PxProton, sigmapluscand::PyProton, sigmapluscand::PzProton,
265271
sigmapluscand::PxGamma1, sigmapluscand::PyGamma1, sigmapluscand::PzGamma1,
266272
sigmapluscand::PxGamma2, sigmapluscand::PyGamma2, sigmapluscand::PzGamma2,
267273
sigmapluscand::NSigmaTPCProton, sigmapluscand::NSigmaTOFProton,
268274
sigmapluscand::NSigmaTPCElPos, sigmapluscand::NSigmaTPCElNeg,
269275
sigmapluscand::PhotonMass, sigmapluscand::PhotonAlpha, sigmapluscand::PhotonQt, sigmapluscand::PhotonConvRadius,
270276
sigmapluscand::PhotonOpeningAngle, sigmapluscand::PhotonPointingAngle, sigmapluscand::PhotonDcaToPV,
277+
sigmapluscand::RootCenter, sigmapluscand::AntiSigmaPointingAngle, sigmapluscand::CandDcaToPV,
278+
sigmapluscand::ProtonSign,
271279
sigmapluscand::ProtonItsNCls, sigmapluscand::ProtonTpcNCls, sigmapluscand::ProtonDcaXY, sigmapluscand::ProtonDcaZ,
272280
sigmapluscand::PhotonPosItsNCls, sigmapluscand::PhotonPosTpcNCls, sigmapluscand::PhotonNegItsNCls, sigmapluscand::PhotonNegTpcNCls,
273281

274282
// dynamic columns
283+
sigmapluscand::Radius<sigmapluscand::XDecVtx, sigmapluscand::YDecVtx>,
284+
sigmapluscand::Chi2<sigmapluscand::DcaProtonGamma>,
275285
sigmapluscand::PxSigmaPlus<sigmapluscand::PxProton, sigmapluscand::PxGamma1, sigmapluscand::PxGamma2>,
276286
sigmapluscand::PySigmaPlus<sigmapluscand::PyProton, sigmapluscand::PyGamma1, sigmapluscand::PyGamma2>,
277287
sigmapluscand::PzSigmaPlus<sigmapluscand::PzProton, sigmapluscand::PzGamma1, sigmapluscand::PzGamma2>,
278288
sigmapluscand::PtSigmaPlus<sigmapluscand::PxProton, sigmapluscand::PxGamma1, sigmapluscand::PxGamma2, sigmapluscand::PyProton, sigmapluscand::PyGamma1, sigmapluscand::PyGamma2>,
279289
sigmapluscand::MassSigmaPlus<sigmapluscand::PxProton, sigmapluscand::PyProton, sigmapluscand::PzProton, sigmapluscand::PxGamma1, sigmapluscand::PyGamma1, sigmapluscand::PzGamma1, sigmapluscand::PxGamma2, sigmapluscand::PyGamma2, sigmapluscand::PzGamma2>);
280290

281291
DECLARE_SOA_TABLE(SigmaPlusCandsMC, "AOD", "SIGMAPLUSMC",
282-
sigmapluscand::XDecVtx, sigmapluscand::YDecVtx, sigmapluscand::ZDecVtx,
283-
sigmapluscand::Radius, sigmapluscand::FlightDistance,
284-
sigmapluscand::DcaProtonGamma, sigmapluscand::Chi2,
292+
sigmapluscand::XDecVtx, sigmapluscand::YDecVtx, sigmapluscand::ZDecVtx, sigmapluscand::FlightDistance,
293+
sigmapluscand::DcaProtonGamma,
285294
sigmapluscand::PxProton, sigmapluscand::PyProton, sigmapluscand::PzProton,
286295
sigmapluscand::PxGamma1, sigmapluscand::PyGamma1, sigmapluscand::PzGamma1,
287296
sigmapluscand::PxGamma2, sigmapluscand::PyGamma2, sigmapluscand::PzGamma2,
288297
sigmapluscand::NSigmaTPCProton, sigmapluscand::NSigmaTOFProton,
289298
sigmapluscand::NSigmaTPCElPos, sigmapluscand::NSigmaTPCElNeg,
290299
sigmapluscand::PhotonMass, sigmapluscand::PhotonAlpha, sigmapluscand::PhotonQt, sigmapluscand::PhotonConvRadius,
291300
sigmapluscand::PhotonOpeningAngle, sigmapluscand::PhotonPointingAngle, sigmapluscand::PhotonDcaToPV,
301+
sigmapluscand::RootCenter, sigmapluscand::AntiSigmaPointingAngle, sigmapluscand::CandDcaToPV,
302+
sigmapluscand::ProtonSign,
292303
sigmapluscand::ProtonItsNCls, sigmapluscand::ProtonTpcNCls, sigmapluscand::ProtonDcaXY, sigmapluscand::ProtonDcaZ,
293304
sigmapluscand::PhotonPosItsNCls, sigmapluscand::PhotonPosTpcNCls, sigmapluscand::PhotonNegItsNCls, sigmapluscand::PhotonNegTpcNCls,
305+
sigmapluscand::CollisionIdCheck,
294306
sigmapluscand::IsSignal,
295-
sigmapluscand::ProtonPdgCode, sigmapluscand::ProtonMotherPdgCode,
296-
sigmapluscand::GammaPdgCode, sigmapluscand::GammaMotherPdgCode, sigmapluscand::GammaGMotherPdgCode,
297307
sigmapluscand::XDecVtxMC, sigmapluscand::YDecVtxMC, sigmapluscand::ZDecVtxMC,
298308
sigmapluscand::PxProtonMC, sigmapluscand::PyProtonMC, sigmapluscand::PzProtonMC,
299309
sigmapluscand::PxGammaMC, sigmapluscand::PyGammaMC, sigmapluscand::PzGammaMC,
300310
sigmapluscand::PxSigmaPlusMC, sigmapluscand::PySigmaPlusMC, sigmapluscand::PzSigmaPlusMC,
311+
sigmapluscand::DecayRadiusMC, sigmapluscand::MassMC,
301312

302313
// dynamic columns
314+
sigmapluscand::Radius<sigmapluscand::XDecVtx, sigmapluscand::YDecVtx>,
315+
sigmapluscand::Chi2<sigmapluscand::DcaProtonGamma>,
303316
sigmapluscand::PxSigmaPlus<sigmapluscand::PxProton, sigmapluscand::PxGamma1, sigmapluscand::PxGamma2>,
304317
sigmapluscand::PySigmaPlus<sigmapluscand::PyProton, sigmapluscand::PyGamma1, sigmapluscand::PyGamma2>,
305318
sigmapluscand::PzSigmaPlus<sigmapluscand::PzProton, sigmapluscand::PzGamma1, sigmapluscand::PzGamma2>,
@@ -309,7 +322,11 @@ DECLARE_SOA_TABLE(SigmaPlusCandsMC, "AOD", "SIGMAPLUSMC",
309322
sigmapluscand::YSigmaPlusMC<sigmapluscand::PxSigmaPlusMC, sigmapluscand::PySigmaPlusMC, sigmapluscand::PzSigmaPlusMC>);
310323

311324
DECLARE_SOA_TABLE(SlimSigmaPlusCands, "AOD", "SLIMSIGMAPLUS",
312-
sigmapluscand::Radius, sigmapluscand::DcaProtonGamma,
325+
sigmapluscand::TransDecayRadius,
326+
sigmapluscand::CandDcaToPV,
327+
sigmapluscand::DcaProtonGamma,
328+
sigmapluscand::ProtonSign,
329+
sigmapluscand::ProtonDcaXY, sigmapluscand::ProtonDcaZ,
313330
sigmapluscand::PxProton, sigmapluscand::PyProton, sigmapluscand::PzProton,
314331
sigmapluscand::PxGamma1, sigmapluscand::PyGamma1, sigmapluscand::PzGamma1,
315332
sigmapluscand::PxGamma2, sigmapluscand::PyGamma2, sigmapluscand::PzGamma2,
@@ -325,16 +342,20 @@ DECLARE_SOA_TABLE(SlimSigmaPlusCands, "AOD", "SLIMSIGMAPLUS",
325342
sigmapluscand::MassSigmaPlus<sigmapluscand::PxProton, sigmapluscand::PyProton, sigmapluscand::PzProton, sigmapluscand::PxGamma1, sigmapluscand::PyGamma1, sigmapluscand::PzGamma1, sigmapluscand::PxGamma2, sigmapluscand::PyGamma2, sigmapluscand::PzGamma2>);
326343

327344
DECLARE_SOA_TABLE(SlimSigmaPlusCandsMC, "AOD", "SLIMSIGMAPLUSMC",
328-
sigmapluscand::Radius, sigmapluscand::DcaProtonGamma,
345+
sigmapluscand::TransDecayRadius,
346+
sigmapluscand::CandDcaToPV,
347+
sigmapluscand::DcaProtonGamma,
348+
sigmapluscand::ProtonSign,
349+
sigmapluscand::ProtonDcaXY, sigmapluscand::ProtonDcaZ,
329350
sigmapluscand::PxProton, sigmapluscand::PyProton, sigmapluscand::PzProton,
330351
sigmapluscand::PxGamma1, sigmapluscand::PyGamma1, sigmapluscand::PzGamma1,
331352
sigmapluscand::PxGamma2, sigmapluscand::PyGamma2, sigmapluscand::PzGamma2,
332353
sigmapluscand::NSigmaTPCProton, sigmapluscand::NSigmaTOFProton,
333354
sigmapluscand::NSigmaTPCElPos, sigmapluscand::NSigmaTPCElNeg,
334355
sigmapluscand::PhotonMass,
335-
sigmapluscand::ProtonPdgCode, sigmapluscand::ProtonMotherPdgCode,
336-
sigmapluscand::GammaPdgCode, sigmapluscand::GammaMotherPdgCode, sigmapluscand::GammaGMotherPdgCode,
337-
sigmapluscand::DecayRadiusMC,
356+
sigmapluscand::CollisionIdCheck,
357+
sigmapluscand::IsSignal,
358+
sigmapluscand::DecayRadiusMC, sigmapluscand::MassMC,
338359
sigmapluscand::PxSigmaPlusMC, sigmapluscand::PySigmaPlusMC, sigmapluscand::PzSigmaPlusMC,
339360

340361
// dynamic columns

PWGLF/TableProducer/Strangeness/sigmaHadCorr.cxx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ struct SigmaHadCorr {
113113
Configurable<float> cutMaxKStar{"cutMaxKStar", 1.5, "Maximum k* for Sigma-hadron pairs (GeV/c)"};
114114

115115
Configurable<float> minPtSigma{"minPtSigma", 1.f, "Minimum pT for Sigma candidates (GeV/c)"};
116+
Configurable<float> cutRapMotherMC{"cutRapMotherMC", 1.0f, "Rapidity cut for generated mother Sigma in MC"};
117+
Configurable<float> cutPtGenMC{"cutPtGenMC", 0.5f, "Minimum pT for generated Sigma particles in MC"};
116118
Configurable<bool> useRecalculatedSigmaMomentum{"useRecalculatedSigmaMomentum", true, "If true, compute k* using Sigma momentum recalculated from daughter kinematics"};
117119
Configurable<float> cutDCAtoPVSigma{"cutDCAtoPVSigma", 0.1f, "Max DCA to primary vertex for Sigma candidates (cm)"};
118120
Configurable<float> cutSigmaRadius{"cutSigmaRadius", 20.f, "Minimum radius for Sigma candidates (cm)"};
@@ -237,29 +239,29 @@ struct SigmaHadCorr {
237239
float versorZ = sigmaPz / pMother;
238240
float eChDau = std::sqrt(massChargedDau * massChargedDau + sigmaDauPx * sigmaDauPx + sigmaDauPy * sigmaDauPy + sigmaDauPz * sigmaDauPz);
239241
float a = versorX * sigmaDauPx + versorY * sigmaDauPy + versorZ * sigmaDauPz;
240-
float K = massSigma * massSigma + massChargedDau * massChargedDau - massNeutralDau * massNeutralDau;
241-
float A = 4.f * (eChDau * eChDau - a * a);
242-
float B = -4.f * a * K;
243-
float C = 4.f * eChDau * eChDau * massSigma * massSigma - K * K;
244-
if (std::abs(A) < epsilon) {
242+
float coefK = massSigma * massSigma + massChargedDau * massChargedDau - massNeutralDau * massNeutralDau;
243+
float coefA = 4.f * (eChDau * eChDau - a * a);
244+
float coefB = -4.f * a * coefK;
245+
float coefC = 4.f * eChDau * eChDau * massSigma * massSigma - coefK * coefK;
246+
if (std::abs(coefA) < epsilon) {
245247
return -999.f;
246248
}
247-
float D = B * B - 4.f * A * C;
248-
if (D < 0.f) {
249+
float discriminant = coefB * coefB - 4.f * coefA * coefC;
250+
if (discriminant < 0.f) {
249251
return -999.f;
250252
}
251-
float sqrtD = std::sqrt(D);
252-
float P1 = (-B + sqrtD) / (2.f * A);
253-
float P2 = (-B - sqrtD) / (2.f * A);
254-
if (P2 < 0.f && P1 < 0.f) {
253+
float sqrtDiscriminant = std::sqrt(discriminant);
254+
float root1 = (-coefB + sqrtDiscriminant) / (2.f * coefA);
255+
float root2 = (-coefB - sqrtDiscriminant) / (2.f * coefA);
256+
if (root2 < 0.f && root1 < 0.f) {
255257
return -999.f;
256258
}
257-
if (P2 < 0.f) {
258-
return P1;
259+
if (root2 < 0.f) {
260+
return root1;
259261
}
260-
float p1Diff = std::abs(P1 - pMother);
261-
float p2Diff = std::abs(P2 - pMother);
262-
return (p1Diff < p2Diff) ? P1 : P2;
262+
float p1Diff = std::abs(root1 - pMother);
263+
float p2Diff = std::abs(root2 - pMother);
264+
return (p1Diff < p2Diff) ? root1 : root2;
263265
}
264266

265267
std::array<float, 3> getSigmaMomentumForKstar(float sigmaPx, float sigmaPy, float sigmaPz, float sigmaDauPx, float sigmaDauPy, float sigmaDauPz)
@@ -794,6 +796,12 @@ struct SigmaHadCorr {
794796
if (!isValidMother) {
795797
continue;
796798
}
799+
if (std::abs(mcPart.y()) > cutRapMotherMC) {
800+
continue;
801+
}
802+
if (mcPart.pt() < cutPtGenMC) {
803+
continue;
804+
}
797805
bool hasChargedDaughter = false;
798806
std::array<float, 3> genDecVtx{-999.f, -999.f, -999.f};
799807
int daugPdgCode = 0;

0 commit comments

Comments
 (0)