Skip to content

Commit a382517

Browse files
committed
Fix Xi1820 linter angle handling
1 parent 61e54a1 commit a382517

1 file changed

Lines changed: 22 additions & 28 deletions

File tree

PWGLF/Tasks/Resonances/xi1820Analysis.cxx

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "PWGLF/DataModel/LFResonanceTables.h"
1818

19+
#include <Common/Core/RecoDecay.h>
1920
#include <CommonConstants/MathConstants.h>
2021
#include <CommonConstants/PhysicsConstants.h>
2122
#include <Framework/ASoA.h>
@@ -56,10 +57,10 @@ struct Xi1820Analysis {
5657
using ResoMCCols = soa::Join<aod::ResoCollisions, aod::ResoMCCollisions>;
5758

5859
// Constants
59-
static constexpr float kSmallMomentumDenominator = 1e-10f; // Small value to avoid division by zero
60-
static constexpr int kPdgChagedXi1820 = 123314; // o2-linter: disable=pdg/explicit-code (Xi(1820) PDG code not available in PDG_t or o2::constants::physics::Pdg)
61-
static constexpr int kPdgXi1820Zero = 123324; // o2-linter: disable=pdg/explicit-code (Xi(1820) PDG code not available in PDG_t or o2::constants::physics::Pdg)
62-
static constexpr int kExpectedDaughters = 2; // Expected number of daughters for two-body decay
60+
static constexpr float SmallMomentumDenominator = 1e-10f; // Small value to avoid division by zero
61+
static constexpr int PdgChargedXi1820 = 123314; // o2-linter: disable=pdg/explicit-code (Xi(1820) PDG code not available in PDG_t or o2::constants::physics::Pdg)
62+
static constexpr int PdgXi1820Zero = 123324; // o2-linter: disable=pdg/explicit-code (Xi(1820) PDG code not available in PDG_t or o2::constants::physics::Pdg)
63+
static constexpr int ExpectedDaughters = 2; // Expected number of daughters for two-body decay
6364

6465
// Axes
6566
ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 10.0}, "pT"};
@@ -148,8 +149,8 @@ struct Xi1820Analysis {
148149
ConfigurableAxis multNTracksAxis{"multNTracksAxis", {500, 0, 500}, "N_{tracks}"};
149150

150151
Configurable<bool> cfgFillRotBkg{"cfgFillRotBkg", true, "Fill rotated background"};
151-
Configurable<float> cfgMinRot{"cfgMinRot", 5.0 * constants::math::PI / 6.0, "Minimum of rotation"};
152-
Configurable<float> cfgMaxRot{"cfgMaxRot", 7.0 * constants::math::PI / 6.0, "Maximum of rotation"};
152+
Configurable<float> cfgMinRot{"cfgMinRot", o2::constants::math::PIHalf + o2::constants::math::PIThird, "Minimum of rotation"};
153+
Configurable<float> cfgMaxRot{"cfgMaxRot", o2::constants::math::TwoPI - o2::constants::math::PIHalf - o2::constants::math::PIThird, "Maximum of rotation"};
153154
Configurable<bool> cfgRotKaon{"cfgRotKaon", true, "Rotate Kaon"};
154155
Configurable<int> cfgNrotBkg{"cfgNrotBkg", 10, "Number of rotated copies (background) per each original candidate"};
155156

@@ -436,14 +437,7 @@ struct Xi1820Analysis {
436437
template <typename FirstVectorType, typename SecondVectorType>
437438
static float deltaPhi(const FirstVectorType& first, const SecondVectorType& second)
438439
{
439-
auto dPhi = first.Phi() - second.Phi();
440-
while (dPhi > constants::math::PI) {
441-
dPhi -= 2.0 * constants::math::PI;
442-
}
443-
while (dPhi <= -constants::math::PI) {
444-
dPhi += 2.0 * constants::math::PI;
445-
}
446-
return dPhi;
440+
return RecoDecay::constrainAngle(first.Phi() - second.Phi(), -constants::math::PI);
447441
}
448442

449443
// Lambda/Anti-Lambda selection
@@ -483,7 +477,7 @@ struct Xi1820Analysis {
483477
float dz = v0.decayVtxZ() - collision.posZ();
484478
float l = std::sqrt(dx * dx + dy * dy + dz * dz);
485479
float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz());
486-
auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda;
480+
auto properLifetime = (l / (p + SmallMomentumDenominator)) * MassLambda;
487481
if (properLifetime > cV0ProperLifetimeMax)
488482
return false;
489483

@@ -559,7 +553,7 @@ struct Xi1820Analysis {
559553
float dz = v0.decayVtxZ() - collision.posZ();
560554
float l = std::sqrt(dx * dx + dy * dy + dz * dz);
561555
float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz());
562-
auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassK0Short;
556+
auto properLifetime = (l / (p + SmallMomentumDenominator)) * MassK0Short;
563557
if (properLifetime > cK0sProperLifetimeMax)
564558
return false;
565559

@@ -885,7 +879,7 @@ struct Xi1820Analysis {
885879
float dz = v0.decayVtxZ() - collision.posZ();
886880
float l = std::sqrt(dx * dx + dy * dy + dz * dz);
887881
float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz());
888-
auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda;
882+
auto properLifetime = (l / (p + SmallMomentumDenominator)) * MassLambda;
889883
histos.fill(HIST("QAbefore/lambdaProperLifetime"), v0.pt(), properLifetime);
890884
histos.fill(HIST("QAbefore/lambdaArmenterosPodolanski"), v0.alpha(), v0.qtarm(), v0.pt());
891885
}
@@ -927,7 +921,7 @@ struct Xi1820Analysis {
927921
float dz = v0.decayVtxZ() - collision.posZ();
928922
float l = std::sqrt(dx * dx + dy * dy + dz * dz);
929923
float p = std::sqrt(v0.px() * v0.px() + v0.py() * v0.py() + v0.pz() * v0.pz());
930-
auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda;
924+
auto properLifetime = (l / (p + SmallMomentumDenominator)) * MassLambda;
931925
histos.fill(HIST("QAafter/lambdaProperLifetime"), v0.pt(), properLifetime);
932926
histos.fill(HIST("QAafter/lambdaArmenterosPodolanski"), v0.alpha(), v0.qtarm(), v0.pt());
933927
}
@@ -1002,7 +996,7 @@ struct Xi1820Analysis {
1002996
}
1003997

1004998
if constexpr (IsMC) { // Calculate Acceptance x efficiency for "the particle" channel
1005-
if (std::abs(v0.motherPDG()) != kPdgChagedXi1820)
999+
if (std::abs(v0.motherPDG()) != PdgChargedXi1820)
10061000
continue;
10071001
if (kaon.pdgCode() != PDG_t::kKPlus || v0.pdgCode() != PDG_t::kLambda0Bar)
10081002
continue;
@@ -1069,7 +1063,7 @@ struct Xi1820Analysis {
10691063
}
10701064
}
10711065
if constexpr (IsMC) { // Calculate Acceptance x efficiency for "the particle" channel
1072-
if (std::abs(v0.motherPDG()) != kPdgChagedXi1820)
1066+
if (std::abs(v0.motherPDG()) != PdgChargedXi1820)
10731067
continue;
10741068
if (kaon.pdgCode() != PDG_t::kKMinus || v0.pdgCode() != PDG_t::kLambda0)
10751069
continue;
@@ -1239,7 +1233,7 @@ struct Xi1820Analysis {
12391233
float dz = lambda.decayVtxZ() - collision.posZ();
12401234
float l = std::sqrt(dx * dx + dy * dy + dz * dz);
12411235
float p = std::sqrt(lambda.px() * lambda.px() + lambda.py() * lambda.py() + lambda.pz() * lambda.pz());
1242-
auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda;
1236+
auto properLifetime = (l / (p + SmallMomentumDenominator)) * MassLambda;
12431237
histos.fill(HIST("QAbefore/lambdaProperLifetime"), lambda.pt(), properLifetime);
12441238
histos.fill(HIST("QAbefore/lambdaArmenterosPodolanski"), lambda.alpha(), lambda.qtarm(), lambda.pt());
12451239
}
@@ -1281,7 +1275,7 @@ struct Xi1820Analysis {
12811275
float dz = lambda.decayVtxZ() - collision.posZ();
12821276
float l = std::sqrt(dx * dx + dy * dy + dz * dz);
12831277
float p = std::sqrt(lambda.px() * lambda.px() + lambda.py() * lambda.py() + lambda.pz() * lambda.pz());
1284-
auto properLifetime = (l / (p + kSmallMomentumDenominator)) * MassLambda;
1278+
auto properLifetime = (l / (p + SmallMomentumDenominator)) * MassLambda;
12851279
histos.fill(HIST("QAafter/lambdaProperLifetime"), lambda.pt(), properLifetime);
12861280
histos.fill(HIST("QAafter/lambdaArmenterosPodolanski"), lambda.alpha(), lambda.qtarm(), lambda.pt());
12871281
}
@@ -1324,7 +1318,7 @@ struct Xi1820Analysis {
13241318
}
13251319

13261320
if constexpr (IsMC) { // Calculate Acceptance x efficiency
1327-
if (std::abs(lambda.motherPDG()) != kPdgXi1820Zero)
1321+
if (std::abs(lambda.motherPDG()) != PdgXi1820Zero)
13281322
continue;
13291323
if (std::abs(k0s.pdgCode()) != PDG_t::kK0Short || lambda.pdgCode() != PDG_t::kLambda0)
13301324
continue;
@@ -1382,7 +1376,7 @@ struct Xi1820Analysis {
13821376
}
13831377

13841378
if constexpr (IsMC) { // Calculate Acceptance x efficiency
1385-
if (std::abs(lambda.motherPDG()) != kPdgXi1820Zero)
1379+
if (std::abs(lambda.motherPDG()) != PdgXi1820Zero)
13861380
continue;
13871381
if (std::abs(k0s.pdgCode()) != PDG_t::kK0Short || lambda.pdgCode() != PDG_t::kLambda0Bar)
13881382
continue;
@@ -1548,15 +1542,15 @@ struct Xi1820Analysis {
15481542
histos.fill(HIST("multQA/h2MultCentMC"), inCent, multiplicity);
15491543
for (const auto& part : resoParents) { // loop over all pre-filtered Gen particle on selected events
15501544
auto pdgMother = part.pdgCode();
1551-
if (std::abs(pdgMother) != kPdgChagedXi1820 && std::abs(pdgMother) != kPdgXi1820Zero)
1545+
if (std::abs(pdgMother) != PdgChargedXi1820 && std::abs(pdgMother) != PdgXi1820Zero)
15521546
continue;
15531547
if (std::abs(part.y()) >= additionalConfig.cfgRapidityCut)
15541548
continue; // skip if rapidity of the particle is outside of cut
15551549
auto motherPt = part.pt();
15561550
auto daughter1PDG = part.daughterPDG1();
15571551
auto daughter2PDG = part.daughterPDG2();
15581552

1559-
if (std::abs(pdgMother) == kPdgChagedXi1820) { // Explicity check for the safety.
1553+
if (std::abs(pdgMother) == PdgChargedXi1820) { // Explicity check for the safety.
15601554
// K- + Anti-Lambda, K+ + Anti-Lambda
15611555
if ((daughter1PDG == PDG_t::kKMinus && daughter2PDG == PDG_t::kLambda0) ||
15621556
(daughter1PDG == PDG_t::kLambda0 && daughter2PDG == PDG_t::kKMinus)) {
@@ -1591,7 +1585,7 @@ struct Xi1820Analysis {
15911585

15921586
// Xi(1820)0: PDG 123314
15931587
// Check if it's Xi(1820) or similar resonance
1594-
if (std::abs(pdg) != kPdgChagedXi1820 && std::abs(pdg) != kPdgXi1820Zero)
1588+
if (std::abs(pdg) != PdgChargedXi1820 && std::abs(pdg) != PdgXi1820Zero)
15951589
continue;
15961590

15971591
// Fill generated level histograms
@@ -1605,7 +1599,7 @@ struct Xi1820Analysis {
16051599

16061600
// Get daughters
16071601
auto daughters = mcParticle.daughters_as<aod::McParticles>();
1608-
if (daughters.size() != kExpectedDaughters)
1602+
if (daughters.size() != ExpectedDaughters)
16091603
continue;
16101604

16111605
int daughter1PDG = 0, daughter2PDG = 0;

0 commit comments

Comments
 (0)