Skip to content

Commit d997c4d

Browse files
hfribertHenrik Fribert
andauthored
[PWGCF] Femto: Use mom. at PV for Sigma kstar calculation (#18661)
Co-authored-by: Henrik Fribert <ge35huh@nidoqueen.ktas.ph.tum.de>
1 parent db4aa34 commit d997c4d

3 files changed

Lines changed: 99 additions & 7 deletions

File tree

‎PWGCF/Femto/Core/femtoUtils.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
#ifndef PWGCF_FEMTO_CORE_FEMTOUTILS_H_
1717
#define PWGCF_FEMTO_CORE_FEMTOUTILS_H_
1818

19+
#include "Common/Core/RecoDecay.h"
1920
#include "Common/Core/TableHelper.h"
2021

22+
#include <CommonConstants/MathConstants.h>
2123
#include <CommonConstants/PhysicsConstants.h>
2224
#include <Framework/InitContext.h>
2325
#include <Framework/Logger.h>
@@ -173,6 +175,18 @@ concept HasEventShapeRow = requires(T row) {
173175
template <typename T>
174176
concept HasEventShape = HasEventShapeRow<std::decay_t<T>> || (requires { typename std::decay_t<T>::iterator; } && HasEventShapeRow<typename std::decay_t<T>::iterator>);
175177

178+
/// Azimuth of the momentum of a charged particle at the primary vertex, from its azimuth at the decay vertex.
179+
/// The decay vertex (xDecay, yDecay) has to be given relative to the primary vertex. In a solenoidal field the transverse
180+
/// trajectory is a circle through both points, and the tangents at the two ends of a chord make the same angle with it:
181+
/// phiPV = 2*phiChord - phiDecay (independent of polarity).
182+
inline float phiAtPrimaryVertex(float phiDecay, float xDecay, float yDecay)
183+
{
184+
if (std::abs(xDecay) < o2::constants::math::Epsilon && std::abs(yDecay) < o2::constants::math::Epsilon) {
185+
return phiDecay;
186+
}
187+
return RecoDecay::constrainAngle(2.f * std::atan2(yDecay, xDecay) - phiDecay);
188+
}
189+
176190
/// Recalculate the pT of a kink mother from its direction and the charged daughter momentum
177191
inline float calcPtnew(float pxMother, float pyMother, float pzMother, float pxDaughter, float pyDaughter, float pzDaughter,
178192
float massMother, float massChargedDaughter, float massNeutralDaughter)

‎PWGCF/Femto/Core/kinkBuilder.h‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct ConfKinkFilters : o2::framework::ConfigurableGroup {
5353
o2::framework::Configurable<float> etaMax{"etaMax", 10.f, "Maximum eta"};
5454
o2::framework::Configurable<float> phiMin{"phiMin", 0.f, "Minimum phi"};
5555
o2::framework::Configurable<float> phiMax{"phiMax", 1.f * o2::constants::math::TwoPI, "Maximum phi"};
56+
o2::framework::Configurable<bool> kinkPhiAtPv{"kinkPhiAtPv", true, "Kinks and PCM SigmaPlus: store the azimuth of the Sigma momentum at the primary vertex"};
5657
o2::framework::Configurable<float> massMinSigma{"massMinSigma", 1.1f, "Minimum mass for Sigma hypothesis"};
5758
o2::framework::Configurable<float> massMaxSigma{"massMaxSigma", 1.3f, "Maximum mass for Sigma hypothesis"};
5859
o2::framework::Configurable<float> massMinSigmaPlus{"massMinSigmaPlus", 1.1f, "Minimum mass for SigmaPlus hypothesis"};
@@ -234,6 +235,7 @@ enum KinkFilters {
234235
kPhiMax,
235236
kMassMin,
236237
kMassMax,
238+
kPhiAtPv,
237239
kMlScoreMin,
238240
kKinkFiltersMax
239241
};
@@ -250,6 +252,7 @@ const std::unordered_map<KinkFilters, std::string> kinkFilterNames = {
250252
{kPhiMax, "phiMax"},
251253
{kMassMin, "massMin"},
252254
{kMassMax, "massMax"},
255+
{kPhiAtPv, "kinkPhiAtPv"},
253256
{kMlScoreMin, "mlScoreMin"}};
254257

255258
/// \class KinkCuts
@@ -272,6 +275,7 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
272275
mEtaMax = filter.etaMax.value;
273276
mPhiMin = filter.phiMin.value;
274277
mPhiMax = filter.phiMax.value;
278+
mKinkPhiAtPv = filter.kinkPhiAtPv.value;
275279

276280
if constexpr (modes::isEqual(kinkType, modes::Kink::kSigma)) {
277281
mMassSigmaLowerLimit = filter.massMinSigma.value;
@@ -317,6 +321,7 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
317321
{kinkFilterNames.at(kPhiMax), mPhiMax},
318322
{kinkFilterNames.at(kMassMin), mMassSigmaLowerLimit},
319323
{kinkFilterNames.at(kMassMax), mMassSigmaUpperLimit},
324+
{kinkFilterNames.at(kPhiAtPv), static_cast<float>(mKinkPhiAtPv)},
320325
});
321326
}
322327
if constexpr (modes::isEqual(kinkType, modes::Kink::kSigmaPlus)) {
@@ -331,6 +336,7 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
331336
{kinkFilterNames.at(kPhiMax), mPhiMax},
332337
{kinkFilterNames.at(kMassMin), mMassSigmaPlusLowerLimit},
333338
{kinkFilterNames.at(kMassMax), mMassSigmaPlusUpperLimit},
339+
{kinkFilterNames.at(kPhiAtPv), static_cast<float>(mKinkPhiAtPv)},
334340
});
335341
}
336342
};
@@ -421,6 +427,9 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
421427

422428
mKinkMotherEta = RecoDecay::eta(momMother);
423429
mKinkMotherPhi = RecoDecay::phi(momMother);
430+
if (mKinkPhiAtPv) {
431+
mKinkMotherPhi = utils::phiAtPrimaryVertex(mKinkMotherPhi, kinkCand.xDecVtx(), kinkCand.yDecVtx());
432+
}
424433

425434
// Recalculate pT using kinematic constraints of the decay channel
426435
float ptRecalc = -999.f;
@@ -468,6 +477,8 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
468477
this->template fillFilter<FilterHistName>(kPhiMax, p);
469478
pass &= p;
470479

480+
this->template fillFilter<FilterHistName>(kPhiAtPv, mKinkPhiAtPv);
481+
471482
if constexpr (modes::isEqual(kinkType, modes::Kink::kSigma)) {
472483
float sigmaMass = kinkCand.mSigmaMinus();
473484

@@ -517,6 +528,7 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
517528
float mEtaMax = 1.f;
518529
float mPhiMin = 0.f;
519530
float mPhiMax = o2::constants::math::TwoPI;
531+
bool mKinkPhiAtPv = true;
520532

521533
// mother kinematic
522534
float mKinkMotherPt = 0.f; // recalculated pT (falls back to the original pT if the recalculation fails)
@@ -827,6 +839,7 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
827839
mEtaMax = filter.etaMax.value;
828840
mPhiMin = filter.phiMin.value;
829841
mPhiMax = filter.phiMax.value;
842+
mPhiAtPv = filter.kinkPhiAtPv.value;
830843
mMassLowerLimit = filter.massMinSigmaPlusPcm.value;
831844
mMassUpperLimit = filter.massMaxSigmaPlusPcm.value;
832845
mMlScoreMin = filter.mlScoreMinSigmaPlusPcm.value;
@@ -852,17 +865,21 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
852865
{kinkFilterNames.at(kPhiMax), mPhiMax},
853866
{kinkFilterNames.at(kMassMin), mMassLowerLimit},
854867
{kinkFilterNames.at(kMassMax), mMassUpperLimit},
868+
{kinkFilterNames.at(kPhiAtPv), static_cast<float>(mPhiAtPv)},
855869
{kinkFilterNames.at(kMlScoreMin), mMlScoreMin},
856870
});
857871
};
858872

859-
template <typename T>
860-
void computeKinematics(T const& sigmaPlusPcmCand)
873+
template <typename T1, typename T2>
874+
void computeKinematics(T1 const& sigmaPlusPcmCand, T2 const& col)
861875
{
862876
std::array<float, 3> momMother = {sigmaPlusPcmCand.pxSigmaPlus(), sigmaPlusPcmCand.pySigmaPlus(), sigmaPlusPcmCand.pzSigmaPlus()};
863877
mPt = RecoDecay::pt(momMother);
864878
mEta = RecoDecay::eta(momMother);
865879
mPhi = RecoDecay::phi(momMother);
880+
if (mPhiAtPv) {
881+
mPhi = utils::phiAtPrimaryVertex(mPhi, sigmaPlusPcmCand.xDecVtx() - col.posX(), sigmaPlusPcmCand.yDecVtx() - col.posY());
882+
}
866883
mMass = sigmaPlusPcmCand.massSigmaPlus();
867884
mMlScore = sigmaPlusPcmCand.mlScore();
868885
}
@@ -897,6 +914,8 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
897914
this->template fillFilter<FilterHistName>(kPhiMax, p);
898915
pass &= p;
899916

917+
this->template fillFilter<FilterHistName>(kPhiAtPv, mPhiAtPv);
918+
900919
p = mMass > mMassLowerLimit;
901920
this->template fillFilter<FilterHistName>(kMassMin, p);
902921
pass &= p;
@@ -951,6 +970,7 @@ class SigmaPlusPcmSelection : public baseselection::BaseSelection<float, o2::ana
951970
float mEtaMin = -1.f;
952971
float mEtaMax = 1.f;
953972
float mPhiMin = 0.f;
973+
bool mPhiAtPv = true;
954974
float mPhiMax = o2::constants::math::TwoPI;
955975

956976
// mother kinematic
@@ -1015,7 +1035,7 @@ class SigmaPlusPcmBuilder
10151035
int64_t daughterIndex = 0;
10161036

10171037
for (const auto& sigmaPlusPcm : sigmaPlusPcms) {
1018-
mSigmaPlusPcmSelection.computeKinematics(sigmaPlusPcm);
1038+
mSigmaPlusPcmSelection.computeKinematics(sigmaPlusPcm, col);
10191039
if (!mSigmaPlusPcmSelection.checkFilters(sigmaPlusPcm)) {
10201040
continue;
10211041
}
@@ -1041,7 +1061,7 @@ class SigmaPlusPcmBuilder
10411061
int64_t daughterIndex = 0;
10421062

10431063
for (const auto& sigmaPlusPcm : sigmaPlusPcms) {
1044-
mSigmaPlusPcmSelection.computeKinematics(sigmaPlusPcm);
1064+
mSigmaPlusPcmSelection.computeKinematics(sigmaPlusPcm, col);
10451065
if (!mSigmaPlusPcmSelection.checkFilters(sigmaPlusPcm)) {
10461066
continue;
10471067
}

‎PWGCF/Femto/TableProducer/femtoProducer.cxx‎

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,13 @@ struct FemtoProducer {
270270
}
271271
if ((builders.sigmaBuilder.fillAnyTable() || builders.sigmaPlusBuilder.fillAnyTable()) &&
272272
(!doprocessTracksKinksRun3pp && !doprocessTracksV0sCascadesKinksRun3pp && !doprocessTracksV0sCascadesKinksPhotonsRun3pp &&
273-
!doprocessTracksKinksRun3ppMc && !doprocessTracksV0sKinksRun3ppMc)) {
273+
!doprocessTracksKinksRun3ppMc && !doprocessTracksV0sKinksRun3ppMc &&
274+
!doprocessTracksKinksSigmaPlusPcmsRun3pp && !doprocessTracksKinksSigmaPlusPcmsRun3ppMc)) {
274275
LOG(fatal) << "At least one kink table is enabled, but wrong process function is enabled. Breaking...";
275276
}
276277
if (builders.sigmaPlusPcmBuilder.fillAnyTable() &&
277-
(!doprocessTracksSigmaPlusPcmsRun3pp && !doprocessTracksSigmaPlusPcmsRun3ppMc)) {
278+
(!doprocessTracksSigmaPlusPcmsRun3pp && !doprocessTracksSigmaPlusPcmsRun3ppMc &&
279+
!doprocessTracksKinksSigmaPlusPcmsRun3pp && !doprocessTracksKinksSigmaPlusPcmsRun3ppMc)) {
278280
LOG(fatal) << "At least one sigma plus (PCM) table is enabled, but wrong process function is enabled. Breaking...";
279281
}
280282
if ((builders.d0Builder.fillAnyTable() || builders.d0barBuilder.fillAnyTable()) &&
@@ -292,7 +294,7 @@ struct FemtoProducer {
292294
!doprocessTracksV0sRun3ppMc && !doprocessTracksV0sRun3PbPbMc &&
293295
!doprocessTracksV0sCascadesRun3ppMc && !doprocessTracksV0sCascadesRun3PbPbMc &&
294296
!doprocessTracksKinksRun3ppMc && !doprocessTracksV0sKinksRun3ppMc &&
295-
!doprocessTracksSigmaPlusPcmsRun3ppMc &&
297+
!doprocessTracksSigmaPlusPcmsRun3ppMc && !doprocessTracksKinksSigmaPlusPcmsRun3ppMc &&
296298
!doprocessTracksD0sRun3ppMc && !doprocessTracksD0sRun3PbPbMc &&
297299
!doprocessTracksLcsRun3ppMc && !doprocessTracksLcsRun3PbPbMc &&
298300
!doprocessMcOnly)) {
@@ -379,6 +381,7 @@ struct FemtoProducer {
379381
static_cast<int>(doprocessTracksV0sCascadesKinksRun3pp) +
380382
static_cast<int>(doprocessTracksV0sCascadesKinksPhotonsRun3pp) +
381383
static_cast<int>(doprocessTracksSigmaPlusPcmsRun3pp) +
384+
static_cast<int>(doprocessTracksKinksSigmaPlusPcmsRun3pp) +
382385
static_cast<int>(doprocessTracksD0sRun3pp) +
383386
static_cast<int>(doprocessTracksD0sRun3PbPb) +
384387
static_cast<int>(doprocessTracksRun3ppMc) +
@@ -390,6 +393,7 @@ struct FemtoProducer {
390393
static_cast<int>(doprocessTracksKinksRun3ppMc) +
391394
static_cast<int>(doprocessTracksV0sKinksRun3ppMc) +
392395
static_cast<int>(doprocessTracksSigmaPlusPcmsRun3ppMc) +
396+
static_cast<int>(doprocessTracksKinksSigmaPlusPcmsRun3ppMc) +
393397
static_cast<int>(doprocessTracksD0sRun3ppMc) +
394398
static_cast<int>(doprocessTracksD0sRun3PbPbMc) +
395399
static_cast<int>(doprocessTracksLcsRun3pp) +
@@ -833,6 +837,29 @@ struct FemtoProducer {
833837
}
834838
PROCESS_SWITCH(FemtoProducer, processTracksSigmaPlusPcmsRun3pp, "Provide tracks and sigma plus reconstructed with a PCM photon", false);
835839

840+
void processTracksKinksSigmaPlusPcmsRun3pp(rawinputs::Run3PpCollisions const& cols,
841+
o2::aod::BCsWithTimestamps const& bcs,
842+
rawinputs::Run3FullPidTracks const& tracks,
843+
rawinputs::Run3Kinks const& kinks,
844+
rawinputs::Run3SigmaPlusPcms const& sigmaPlusPcms)
845+
{
846+
builders.trackBuilder.reset(tracks);
847+
for (auto const& col : cols) {
848+
auto tracksThisCol = tracks.sliceBy(preslices.perColTracks, col.globalIndex());
849+
if (!processCollisions<modes::System::kPP_Run3>(col, bcs, tracksThisCol)) {
850+
continue;
851+
}
852+
auto tracksWithItsPid = o2::soa::Attach<rawinputs::Run3FullPidTracks, o2::aod::pidits::ITSNSigmaEl, o2::aod::pidits::ITSNSigmaPi, o2::aod::pidits::ITSNSigmaKa,
853+
o2::aod::pidits::ITSNSigmaPr, o2::aod::pidits::ITSNSigmaDe, o2::aod::pidits::ITSNSigmaTr, o2::aod::pidits::ITSNSigmaHe>(tracksThisCol);
854+
processTracks<modes::System::kPP_Run3>(col, tracksWithItsPid);
855+
auto kinksThisCol = kinks.sliceBy(preslices.perColRecoKinks, col.globalIndex());
856+
processKinks<modes::System::kPP_Run3>(col, tracksThisCol, kinksThisCol);
857+
auto sigmaPlusPcmsThisCol = sigmaPlusPcms.sliceBy(preslices.perColSigmaPlusPcms, col.globalIndex());
858+
processSigmaPlusPcms<modes::System::kPP_Run3>(col, tracksThisCol, sigmaPlusPcmsThisCol);
859+
}
860+
}
861+
PROCESS_SWITCH(FemtoProducer, processTracksKinksSigmaPlusPcmsRun3pp, "Provide tracks, kinks and sigma plus reconstructed with a PCM photon", false);
862+
836863
void processTracksV0sCascadesKinksRun3pp(rawinputs::Run3PpCollisions const& cols,
837864
o2::aod::BCsWithTimestamps const& bcs,
838865
rawinputs::Run3FullPidTracks const& tracks,
@@ -1168,6 +1195,37 @@ struct FemtoProducer {
11681195
}
11691196
PROCESS_SWITCH(FemtoProducer, processTracksSigmaPlusPcmsRun3ppMc, "Provide reconstructed and generated tracks and sigma plus reconstructed with a PCM photon", false);
11701197

1198+
void processTracksKinksSigmaPlusPcmsRun3ppMc(rawinputs::Run3PpMcGenCollisions const& mcCols,
1199+
rawinputs::Run3PpMcRecoCollisions const& cols,
1200+
o2::aod::BCsWithTimestamps const& bcs,
1201+
rawinputs::Run3McRecoTracks const& tracks,
1202+
rawinputs::Run3Kinks const& kinks,
1203+
rawinputs::Run3RecoSigmaPlusPcms const& sigmaPlusPcms,
1204+
rawinputs::Run3McGenParticles const& mcParticles)
1205+
{
1206+
builders.mcBuilder.reset(mcCols, mcParticles);
1207+
builders.trackBuilder.reset(tracks);
1208+
if (builders.mcBuilder.isPassThrough()) {
1209+
builders.mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, preslices.perMcCollision, mcProducts);
1210+
}
1211+
1212+
for (const auto& col : cols) {
1213+
auto tracksThisCol = tracks.sliceBy(preslices.perColRecoTracks, col.globalIndex());
1214+
if (!processMcCollisions<modes::System::kPP_Run3_MC>(col, mcCols, bcs, tracksThisCol)) {
1215+
continue;
1216+
}
1217+
auto tracksWithItsPid = o2::soa::Attach<rawinputs::Run3McRecoTracks, o2::aod::pidits::ITSNSigmaEl, o2::aod::pidits::ITSNSigmaPi, o2::aod::pidits::ITSNSigmaKa,
1218+
o2::aod::pidits::ITSNSigmaPr, o2::aod::pidits::ITSNSigmaDe, o2::aod::pidits::ITSNSigmaTr, o2::aod::pidits::ITSNSigmaHe>(tracksThisCol);
1219+
processMcTracks<modes::System::kPP_Run3_MC>(col, mcCols, tracksThisCol, tracksWithItsPid, mcParticles);
1220+
1221+
auto kinksThisCol = kinks.sliceBy(preslices.perColRecoKinks, col.globalIndex());
1222+
processMcKinks<modes::System::kPP_Run3_MC>(col, mcCols, tracks, kinksThisCol, mcParticles);
1223+
auto sigmaPlusPcmsThisCol = sigmaPlusPcms.sliceBy(preslices.perColRecoSigmaPlusPcms, col.globalIndex());
1224+
processMcSigmaPlusPcms<modes::System::kPP_Run3_MC>(col, mcCols, tracks, sigmaPlusPcmsThisCol, mcParticles);
1225+
}
1226+
}
1227+
PROCESS_SWITCH(FemtoProducer, processTracksKinksSigmaPlusPcmsRun3ppMc, "Provide reconstructed and generated tracks, kinks and sigma plus reconstructed with a PCM photon", false);
1228+
11711229
void processTracksV0sKinksRun3ppMc(rawinputs::Run3PpMcGenCollisions const& mcCols,
11721230
rawinputs::Run3PpMcRecoCollisions const& cols,
11731231
o2::aod::BCsWithTimestamps const& bcs,

0 commit comments

Comments
 (0)