Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
#include <cstdlib>
#include <iterator>
#include <map>
#include <string>
#include <utility>
#include <vector>

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -241,7 +243,7 @@
if (centerDistToPC > trcCircle.rC)
return -103;

float pcaToIntercept = TMath::Sqrt(TMath::Abs(trcCircle.rC * trcCircle.rC - centerDistToPC * centerDistToPC));

Check failure on line 246 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.

float interceptX1 = pcaX + (x2 - x1) / segmentModulus * pcaToIntercept;
float interceptY1 = pcaY + (y2 - y1) / segmentModulus * pcaToIntercept;
Expand All @@ -260,23 +262,23 @@
sinAngle1 = (interceptX1 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY1 - trcCircle.yC) * (startPoint[0] - trcCircle.xC);
cosAngle1 /= modulus1;
sinAngle1 /= modulus1;
length1 = trcCircle.rC * TMath::ACos(cosAngle1);

Check failure on line 265 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
length1 *= sqrt(1.0f + track.getTgl() * track.getTgl());

Check failure on line 266 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.

modulus2 = std::hypot(interceptX2 - trcCircle.xC, interceptY2 - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC);
cosAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (interceptY2 - trcCircle.yC) * (startPoint[1] - trcCircle.yC);
sinAngle2 = (interceptX2 - trcCircle.xC) * (startPoint[1] - trcCircle.yC) - (interceptY2 - trcCircle.yC) * (startPoint[0] - trcCircle.xC);
cosAngle2 /= modulus2;
sinAngle2 /= modulus2;
length2 = trcCircle.rC * TMath::ACos(cosAngle2);

Check failure on line 273 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
length2 *= sqrt(1.0f + track.getTgl() * track.getTgl());

Check failure on line 274 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.

// rotate transverse momentum vector such that it is at intercepts
float angle1 = TMath::ACos(cosAngle1);

Check failure on line 277 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
if (sinAngle1 < 0)
angle1 *= -1.0f;
float px1 = +TMath::Cos(angle1) * mom[0] + TMath::Sin(angle1) * mom[1];

Check failure on line 280 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
float py1 = -TMath::Sin(angle1) * mom[0] + TMath::Cos(angle1) * mom[1];

Check failure on line 281 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.

float angle2 = TMath::ACos(cosAngle2);
if (sinAngle2 < 0)
Expand Down Expand Up @@ -507,7 +509,7 @@
if (propagationConfiguration.d_bz_input > -990) {
d_bz = propagationConfiguration.d_bz_input;
o2::parameters::GRPMagField grpmag;
if (fabs(d_bz) > 1e-5) {

Check failure on line 512 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
}
o2::base::Propagator::initFieldFromGRP(&grpmag);
Expand Down Expand Up @@ -944,7 +946,7 @@
// d3d = std::hypot(cascade.x() - cascCloseToPVPosition[0], cascade.y() - cascCloseToPVPosition[1], cascade.z() - cascCloseToPVPosition[2]); // cross-check variable
float sinThetaOverTwo = d / (2.0f * trcCircleCascade.rC);
lengthCascade = 2.0f * trcCircleCascade.rC * TMath::ASin(sinThetaOverTwo);
lengthCascade *= sqrt(1.0f + cascTrack.getTgl() * cascTrack.getTgl());

Check failure on line 949 in PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}

if (!successPropag) {
Expand Down
80 changes: 41 additions & 39 deletions PWGLF/Utils/strangenessBuilderModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
/// \brief strangeness builder module
/// \author ALICE

// simple checkers, but ensure 8 bit integers
#define BITSET(var, nbit) ((var) |= (static_cast<uint8_t>(1) << static_cast<uint8_t>(nbit)))

#ifndef PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_
#define PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_

// simple checkers, but ensure 8 bit integers
#define BITSET(var, nbit) ((var) |= (static_cast<uint8_t>(1) << static_cast<uint8_t>(nbit)))

#include "TableHelper.h"

#include "PWGLF/DataModel/LFStrangenessTables.h"
Expand All @@ -39,6 +39,7 @@
#include <cstdlib>
#include <memory>
#include <string>
#include <vector>

//__________________________________________
// strangeness builder module
Expand Down Expand Up @@ -531,7 +532,8 @@ class BuilderModule

nEnabledTables = 0;

TString listOfRequestors[nTables];
constexpr int kTablesConst = nTables; // silence warning
TString listOfRequestors[kTablesConst];
for (int i = 0; i < nTables; i++) {
int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable");
if (f == 1) {
Expand Down Expand Up @@ -986,10 +988,10 @@ class BuilderModule

bool trackIsInteresting = false;
if (
(originParticle.pdgCode() == 310 && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) ||
(originParticle.pdgCode() == 3122 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) ||
(originParticle.pdgCode() == -3122 && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) ||
(originParticle.pdgCode() == 22 && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) {
(originParticle.pdgCode() == PDG_t::kK0Short && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) ||
(originParticle.pdgCode() == PDG_t::kLambda0 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) ||
(originParticle.pdgCode() == PDG_t::kLambda0Bar && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) ||
(originParticle.pdgCode() == PDG_t::kGamma && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) {
trackIsInteresting = true;
}
if (!trackIsInteresting) {
Expand Down Expand Up @@ -1039,7 +1041,7 @@ class BuilderModule
currentV0Entry.pdgCode = positiveTrackIndex.pdgCode;
currentV0Entry.particleId = positiveTrackIndex.originId;
currentV0Entry.isCollinearV0 = false;
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) {
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) {
currentV0Entry.isCollinearV0 = true;
}
currentV0Entry.found = false;
Expand All @@ -1061,7 +1063,7 @@ class BuilderModule
currentV0Entry.pdgCode = positiveTrackIndex.pdgCode;
currentV0Entry.particleId = positiveTrackIndex.originId;
currentV0Entry.isCollinearV0 = false;
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) {
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) {
currentV0Entry.isCollinearV0 = true;
}
currentV0Entry.found = false;
Expand Down Expand Up @@ -1137,10 +1139,10 @@ class BuilderModule

bool trackIsInteresting = false;
if (
(originParticle.pdgCode() == 3312 && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) ||
(originParticle.pdgCode() == -3312 && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) ||
(originParticle.pdgCode() == 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) ||
(originParticle.pdgCode() == -3334 && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) {
(originParticle.pdgCode() == PDG_t::kXiMinus && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) ||
(originParticle.pdgCode() == PDG_t::kXiPlusBar && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) ||
(originParticle.pdgCode() == PDG_t::kOmegaMinus && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) ||
(originParticle.pdgCode() == PDG_t::kOmegaPlusBar && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) {
trackIsInteresting = true;
}
if (!trackIsInteresting) {
Expand All @@ -1160,7 +1162,7 @@ class BuilderModule
for (size_t v0i = 0; v0i < v0List.size(); v0i++) {
auto v0 = v0List[sorted_v0[v0i]];

if (std::abs(v0.pdgCode) != 3122) {
if (std::abs(v0.pdgCode) != PDG_t::kLambda0) {
continue; // this V0 isn't a lambda, can't come from a cascade: skip
}
if (v0.particleId < 0) {
Expand All @@ -1182,7 +1184,7 @@ class BuilderModule
}
auto v0OriginParticle = mcParticles.rawIteratorAt(v0OriginParticleIndex);

if (std::abs(v0OriginParticle.pdgCode()) != 3312 && std::abs(v0OriginParticle.pdgCode()) != 3334) {
if (std::abs(v0OriginParticle.pdgCode()) != PDG_t::kXiMinus && std::abs(v0OriginParticle.pdgCode()) != PDG_t::kOmegaMinus) {
continue; // this V0 does not come from any particle of interest, don't try
}
for (const auto& bachelorTrackIndex : bachelorTrackArray) {
Expand Down Expand Up @@ -1693,10 +1695,10 @@ class BuilderModule
continue; // skip secondary MC V0s

if (
(v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == 310) ||
(v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == 3122) ||
(v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == -3122) ||
(v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == 22)) {
(v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == PDG_t::kK0Short) ||
(v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == PDG_t::kLambda0) ||
(v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == PDG_t::kLambda0Bar) ||
(v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == PDG_t::kGamma)) {
thisInfo.pdgCode = mcParticle.pdgCode();
thisInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary();
thisInfo.label = mcParticle.globalIndex();
Expand All @@ -1719,7 +1721,7 @@ class BuilderModule
auto const& daughters = mcParticle.template daughters_as<aod::McParticles>();

for (const auto& dau : daughters) {
if (dau.getProcess() != 4)
if (dau.getProcess() != TMCProcess::kPDecay)
continue;

if (dau.pdgCode() > 0) {
Expand Down Expand Up @@ -2137,27 +2139,27 @@ class BuilderModule
bool bbTag = false;
if (bachTrack.has_mcParticle()) {
auto bachelorParticle = bachTrack.template mcParticle_as<aod::McParticles>();
if (bachelorParticle.pdgCode() == 211) { // pi+, look for antiproton in negative prong
if (bachelorParticle.pdgCode() == PDG_t::kPiPlus) { // pi+, look for antiproton in negative prong
if (negTrack.has_mcParticle()) {
auto baryonParticle = negTrack.template mcParticle_as<aod::McParticles>();
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == -2212) {
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProtonBar) {
for (const auto& baryonMother : baryonParticle.template mothers_as<aod::McParticles>()) {
for (const auto& pionMother : bachelorParticle.template mothers_as<aod::McParticles>()) {
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == -3122) {
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0Bar) {
bbTag = true;
}
}
}
}
}
} // end if-pion
if (bachelorParticle.pdgCode() == -211) { // pi-, look for proton in positive prong
if (bachelorParticle.pdgCode() == PDG_t::kPiMinus) { // pi-, look for proton in positive prong
if (posTrack.has_mcParticle()) {
auto baryonParticle = posTrack.template mcParticle_as<aod::McParticles>();
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == 2212) {
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProton) {
for (const auto& baryonMother : baryonParticle.template mothers_as<aod::McParticles>()) {
for (const auto& pionMother : bachelorParticle.template mothers_as<aod::McParticles>()) {
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == 3122) {
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0) {
bbTag = true;
}
}
Expand Down Expand Up @@ -2207,10 +2209,10 @@ class BuilderModule
continue; // skip secondary MC cascades

if (
(cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == 3312) ||
(cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == -3312) ||
(cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == 3334) ||
(cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == -3334)) {
(cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == PDG_t::kXiMinus) ||
(cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == PDG_t::kXiPlusBar) ||
(cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == PDG_t::kOmegaMinus) ||
(cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == PDG_t::kOmegaPlusBar)) {
thisCascInfo.pdgCode = mcParticle.pdgCode();
thisCascInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary();

Expand All @@ -2225,10 +2227,10 @@ class BuilderModule
if (mcParticle.has_daughters()) {
auto const& daughters = mcParticle.template daughters_as<aod::McParticles>();
for (const auto& dau : daughters) {
if (dau.getProcess() != 4) // check whether the daughter comes from a decay
if (dau.getProcess() != TMCProcess::kPDecay) // check whether the daughter comes from a decay
continue;

if (std::abs(dau.pdgCode()) == 211 || std::abs(dau.pdgCode()) == 321) {
if (std::abs(dau.pdgCode()) == PDG_t::kPiPlus || std::abs(dau.pdgCode()) == PDG_t::kKPlus) {
thisCascInfo.pdgCodeBachelor = dau.pdgCode();
thisCascInfo.bachP[0] = dau.px();
thisCascInfo.bachP[1] = dau.py();
Expand All @@ -2238,11 +2240,11 @@ class BuilderModule
thisCascInfo.xyz[2] = dau.vz();
thisCascInfo.mcParticleBachelor = dau.globalIndex();
}
if (std::abs(dau.pdgCode()) == 2212) {
if (std::abs(dau.pdgCode()) == PDG_t::kProton) {
thisCascInfo.pdgCodeV0 = dau.pdgCode();

for (const auto& v0Dau : dau.template daughters_as<aod::McParticles>()) {
if (v0Dau.getProcess() != 4)
if (v0Dau.getProcess() != TMCProcess::kPDecay)
continue;

if (v0Dau.pdgCode() > 0) {
Expand Down Expand Up @@ -2476,10 +2478,10 @@ class BuilderModule
interlinks.cascadeToTraCascCores.push_back(products.tracascdata.lastIndex());
}
if (baseOpts.mEnabledTables[kCascCovs]) {
std::array<float, 21> traCovMat = {0.};
std::array<float, o2::track::kLabCovMatSize> traCovMat = {0.};
strangeTrackParCov.getCovXYZPxPyPzGlo(traCovMat);
float traCovMatArray[21];
for (int ii = 0; ii < 21; ii++) {
float traCovMatArray[o2::track::kLabCovMatSize];
for (int ii = 0; ii < o2::track::kLabCovMatSize; ii++) {
traCovMatArray[ii] = traCovMat[ii];
}
products.tracasccovs(traCovMatArray);
Expand Down Expand Up @@ -2512,7 +2514,7 @@ class BuilderModule
auto const& motherList = part.template mothers_as<aod::McParticles>();
if (motherList.size() == 1) {
for (const auto& mother : motherList) {
if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) {
if (std::abs(part.pdgCode()) == PDG_t::kMuonMinus && treatPiToMuDecays) {
// muon decay, de-ref mother twice
if (mother.has_mothers()) {
auto grandMotherList = mother.template mothers_as<aod::McParticles>();
Expand Down
Loading