Skip to content
Closed
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
44 changes: 21 additions & 23 deletions PWGLF/DataModel/LFSigmaTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,6 @@ DECLARE_SOA_TABLE(Pi0Gens, "AOD", "PI0GENS",
DECLARE_SOA_TABLE(Pi0GenCollRef, "AOD", "PI0GENCOLLREF", //! optional table to refer back to a collision
o2::soa::Index<>, v0data::StraMCCollisionId);


// ___________________________________________________________________________
// Xi0
namespace Xi0Core
Expand Down Expand Up @@ -1418,11 +1417,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Total momentum in GeV/c

DECLARE_SOA_DYNAMIC_COLUMN(Xi0Mass, xi0Mass,
[](float photon1Px, float photon1Py, float photon1Pz, float photon2Px, float photon2Py, float photon2Pz, float lambdaPx, float lambdaPy, float lambdaPz) -> float {
std::array<float, 3> pVecPi0{photon1Px+photon2Px, photon1Py+photon2Py, photon1Pz+photon2Pz};
std::array<float, 3> pVecPi0{photon1Px + photon2Px, photon1Py + photon2Py, photon1Pz + photon2Pz};
std::array<float, 3> pVecLambda{lambdaPx, lambdaPy, lambdaPz};
auto arrMom = std::array{pVecPi0, pVecLambda};
return RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPi0, o2::constants::physics::MassXi0});
});
});

DECLARE_SOA_DYNAMIC_COLUMN(PxPi0, pxPi0, //! Pi0 px
[](float photon1Px, float photon2Px) -> float { return photon1Px + photon2Px; });
Expand Down Expand Up @@ -1456,11 +1455,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(Radius, radius, //! Xi0 decay radius (2D, centered at
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });

DECLARE_SOA_DYNAMIC_COLUMN(RadiusPi0, radiusPi0, //! Pi0 decay radius (2D, centered at zero)
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });

DECLARE_SOA_DYNAMIC_COLUMN(RadiusLambda, radiusLambda, //! Pi0 decay radius (2D, centered at zero)
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });

// CosPAs
DECLARE_SOA_DYNAMIC_COLUMN(Pi0CosPA, pi0CosPA, //!
[](float xPi0, float yPi0, float zPi0, float pxGamma1, float pyGamma1, float pzGamma1, float pxGamma2, float pyGamma2, float pzGamma2, float pvX, float pvY, float pvZ) -> float {
Expand All @@ -1479,14 +1478,14 @@ DECLARE_SOA_DYNAMIC_COLUMN(DCALambdaToPV, dcaLambdaToPV, //!
[](float X, float Y, float Z, float px, float py, float pz, float pvX, float pvY, float pvZ) -> float {
return std::sqrt((std::pow((pvY - Y) * pz - (pvZ - Z) * py, 2) + std::pow((pvX - X) * pz - (pvZ - Z) * px, 2) + std::pow((pvX - X) * py - (pvY - Y) * px, 2)) / (px * px + py * py + pz * pz));
});

DECLARE_SOA_DYNAMIC_COLUMN(DCAPi0ToPV, dcaPi0ToPV, //!
[](float X, float Y, float Z, float pxGamma1, float pyGamma1, float pzGamma1, float pxGamma2, float pyGamma2, float pzGamma2, float pvX, float pvY, float pvZ) -> float {
float px = pxGamma1 + pxGamma2;
float py = pyGamma1 + pyGamma2;
float pz = pzGamma1 + pzGamma2;
return std::sqrt((std::pow((pvY - Y) * pz - (pvZ - Z) * py, 2) + std::pow((pvX - X) * pz - (pvZ - Z) * px, 2) + std::pow((pvX - X) * py - (pvY - Y) * px, 2)) / (px * px + py * py + pz * pz));
});
});

DECLARE_SOA_DYNAMIC_COLUMN(Photon1Pt, photon1Pt, //! Transverse momentum in GeV/c
[](float photon1Px, float photon1Py) -> float {
Expand Down Expand Up @@ -1555,12 +1554,12 @@ DECLARE_SOA_DYNAMIC_COLUMN(LambdaY, lambdaY, //! Rapidity
});

DECLARE_SOA_DYNAMIC_COLUMN(LambdaPhi, lambdaPhi, //! Phi in the range [0, 2pi)
[](float lambdaPx, float lambdaPy) -> float { return RecoDecay::phi(lambdaPx, lambdaPy); });
[](float lambdaPx, float lambdaPy) -> float { return RecoDecay::phi(lambdaPx, lambdaPy); });

} // namespace Pi0Core
} // namespace Xi0Core

DECLARE_SOA_TABLE(Xi0Cores, "AOD", "XI0CORES",
Xi0Core::X, Xi0Core::Y, Xi0Core::Z,
Xi0Core::X, Xi0Core::Y, Xi0Core::Z,
Xi0Core::XPi0, Xi0Core::YPi0, Xi0Core::ZPi0,
Xi0Core::XLambda, Xi0Core::YLambda, Xi0Core::ZLambda,
Xi0Core::DCADaughters, Xi0Core::DCADaughtersPi0, Xi0Core::DCAXYCascToPV, Xi0Core::DCAZCascToPV,
Expand Down Expand Up @@ -1619,15 +1618,14 @@ DECLARE_SOA_TABLE(Xi0CollRefs, "AOD", "XI0COLLREFS", //! optional table to refer
o2::soa::Index<>, v0data::StraCollisionId);

DECLARE_SOA_TABLE(Xi0Indices, "AOD", "XI0INDICES", //! optional table to refer back to V0Cores
o2::soa::Index<>, Xi0Core::Photon1Index, Xi0Core::Photon2Index, Xi0Core::LambdaIndex);


o2::soa::Index<>, Xi0Core::Photon1Index, Xi0Core::Photon2Index, Xi0Core::LambdaIndex);

// for MC
namespace Xi0MCCore
{
DECLARE_SOA_COLUMN(Photon1Index, photon1Index, int);
DECLARE_SOA_COLUMN(Photon2Index, photon2Index, int);
DECLARE_SOA_COLUMN(LambdaIndex, lambdaIndex, int);
DECLARE_SOA_COLUMN(LambdaIndex, lambdaIndex, int);

DECLARE_SOA_COLUMN(Photon1MCPx, photon1mcpx, float);
DECLARE_SOA_COLUMN(Photon1MCPy, photon1mcpy, float);
Expand Down Expand Up @@ -1700,13 +1698,13 @@ DECLARE_SOA_DYNAMIC_COLUMN(MCPhi, mcPhi, //! Phi in the range [0, 2pi)
DECLARE_SOA_DYNAMIC_COLUMN(MCEta, mcEta, //! Pseudorapidity
[](float photon1MCPx, float photon1MCPy, float photon1MCPz, float photon2MCPx, float photon2MCPy, float photon2MCPz, float lambdaMCPx, float lambdaMCPy, float lambdaMCPz) -> float {
return RecoDecay::eta(std::array{photon1MCPx + photon2MCPx + lambdaMCPx, photon1MCPy + photon2MCPy + lambdaMCPy, photon1MCPz + photon2MCPz + lambdaMCPz});
});
});

DECLARE_SOA_DYNAMIC_COLUMN(MCRadius, mcRadius, //! Xi0 decay radius (2D, centered at zero)
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });

DECLARE_SOA_DYNAMIC_COLUMN(MCRadiusPi0, mcRadiusPi0, //! Pi0 decay radius (2D, centered at zero)
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });
[](float x, float y) -> float { return RecoDecay::sqrtSumOfSquares(x, y); });

DECLARE_SOA_DYNAMIC_COLUMN(Pi0MCPx, pi0mcpx, //! Pi0 MC px
[](float photon1MCPx, float photon2MCPx) -> float { return photon1MCPx + photon2MCPx; });
Expand Down Expand Up @@ -1820,9 +1818,9 @@ DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCY, lambdaMCY, //! Rapidity
});

DECLARE_SOA_DYNAMIC_COLUMN(LambdaMCPhi, lambdaMCPhi, //! Phi in the range [0, 2pi)
[](float lambdaMCPx, float lambdaMCPy) -> float { return RecoDecay::phi(lambdaMCPx, lambdaMCPy); });
[](float lambdaMCPx, float lambdaMCPy) -> float { return RecoDecay::phi(lambdaMCPx, lambdaMCPy); });

} // namespace Xi0CoreMC
} // namespace Xi0MCCore

DECLARE_SOA_TABLE(Xi0MCCores, "AOD", "XI0MCCORES",
// Basic properties
Expand All @@ -1839,7 +1837,7 @@ DECLARE_SOA_TABLE(Xi0MCCores, "AOD", "XI0MCCORES",
Xi0MCCore::IsPi0Primary, Xi0MCCore::Pi0MCprocess, Xi0MCCore::Pi0PDGCode,

Xi0MCCore::MCx, Xi0MCCore::MCy, Xi0MCCore::MCz,
Xi0MCCore::IsPhysicalPrimary, Xi0MCCore::MCprocess, Xi0MCCore::PDGCode, Xi0MCCore::PDGCodeMother,
Xi0MCCore::IsPhysicalPrimary, Xi0MCCore::MCprocess, Xi0MCCore::PDGCode, Xi0MCCore::PDGCodeMother,

// Dynamic columns
Xi0MCCore::MCPx<Xi0MCCore::Photon1MCPx, Xi0MCCore::Photon2MCPx, Xi0MCCore::LambdaMCPx>,
Expand Down Expand Up @@ -1876,7 +1874,7 @@ DECLARE_SOA_TABLE(Xi0MCCores, "AOD", "XI0MCCORES",
Xi0MCCore::Photon2MCEta<Xi0MCCore::Photon2MCPx, Xi0MCCore::Photon2MCPy, Xi0MCCore::Photon2MCPz>,
Xi0MCCore::Photon2MCY<Xi0MCCore::Photon2MCPx, Xi0MCCore::Photon2MCPy, Xi0MCCore::Photon2MCPz>,
Xi0MCCore::Photon2MCPhi<Xi0MCCore::Photon2MCPx, Xi0MCCore::Photon2MCPy>,

Xi0MCCore::LambdaMCPt<Xi0MCCore::LambdaMCPx, Xi0MCCore::LambdaMCPy>,
Xi0MCCore::LambdaMCP<Xi0MCCore::LambdaMCPx, Xi0MCCore::LambdaMCPy, Xi0MCCore::LambdaMCPz>,
Xi0MCCore::LambdaMCEta<Xi0MCCore::LambdaMCPx, Xi0MCCore::LambdaMCPy, Xi0MCCore::LambdaMCPz>,
Expand All @@ -1887,7 +1885,7 @@ DECLARE_SOA_TABLE(Xi0MCCollRefs, "AOD", "XI0MCCOLLREFS", //! optional table to r
o2::soa::Index<>, v0data::StraMCCollisionId);

DECLARE_SOA_TABLE(Xi0MCIndices, "AOD", "XI0MCINDICES", //! optional table to refer back to V0MCCores
o2::soa::Index<>, Xi0MCCore::Photon1Index, Xi0MCCore::Photon2Index, Xi0MCCore::LambdaIndex);
o2::soa::Index<>, Xi0MCCore::Photon1Index, Xi0MCCore::Photon2Index, Xi0MCCore::LambdaIndex);

} // namespace o2::aod

Expand Down
64 changes: 32 additions & 32 deletions PWGLF/TableProducer/Strangeness/sigma0builder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
#include "PWGLF/DataModel/LFStrangenessMLTables.h"
#include "PWGLF/DataModel/LFStrangenessPIDTables.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "Common/Tools/StandardCCDBLoader.h"
#include <DCAFitter/DCAFitterN.h>

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/ctpRateFetcher.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Tools/StandardCCDBLoader.h"

#include <CCDB/BasicCCDBManager.h>
#include <CommonConstants/MathConstants.h>
#include <CommonConstants/PhysicsConstants.h>
#include <DCAFitter/DCAFitterN.h>
#include <Framework/ASoA.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
Expand Down Expand Up @@ -113,7 +113,7 @@ struct sigma0builder {
//__________________________________________________
// Xi0 specific
Produces<aod::Xi0Cores> xi0cores; // xi0 candidates info for analysis
Produces<aod::Xi0CollRefs> xi0collRefs; // references to straCollision
Produces<aod::Xi0CollRefs> xi0collRefs; // references to straCollision
Produces<aod::Xi0Indices> xi0Indices; // references to V0Cores
Produces<aod::Xi0MCCores> xi0mccores; // Reco xi0 MC properties
Produces<aod::Xi0MCCollRefs> xi0mccollRefs; // references to straMCCollision
Expand Down Expand Up @@ -892,12 +892,12 @@ struct sigma0builder {
// ______________________________________________________
// Struct to store V0Pair properties
struct V0PairTopoInfo {
std::array<float, 3> position {-999.f, -999.f, -999.f};
std::array<float, 3> position{-999.f, -999.f, -999.f};
float dcaPi0ToPV = 999.f;
float daughterDCA = 999.f;
float cosPA = -1.f;
float pi0Mass= 999.f;
float pi0Y= 999.f;
float pi0Mass = 999.f;
float pi0Y = 999.f;

int v01Index = 0; // index to de-reference V0Cores table
int v02Index = 0; // index to de-reference V0Cores table
Expand Down Expand Up @@ -964,31 +964,31 @@ struct sigma0builder {
// ______________________________________________________
// Struct to store V0Pair properties
struct Xi0Info {
std::array<float, 3> gamma1Momentum {999.f, 999.f, 999.f};
std::array<float, 3> gamma2Momentum {999.f, 999.f, 999.f};
std::array<float, 3> lambdaMomentum {999.f, 999.f, 999.f};
std::array<float, 3> pi0Position {0., 0., 0.};
std::array<float, 3> cascadePosition {0., 0., 0.};
std::array<float, 3> gamma1Momentum{999.f, 999.f, 999.f};
std::array<float, 3> gamma2Momentum{999.f, 999.f, 999.f};
std::array<float, 3> lambdaMomentum{999.f, 999.f, 999.f};
std::array<float, 3> pi0Position{0., 0., 0.};
std::array<float, 3> cascadePosition{0., 0., 0.};
float xi0Mass = 999.f;
float dcaPi0ToPV = 999.f;
float pi0DaughterDCA = 999.f;
float cascadeDaughterDCA = 999.f;
float cascadeDCAxy = 999.f;
float cascadeDCAz = 999.f;

int collisionId = 0;
int gamma1Index = 0; // index to de-reference V0Cores table
int gamma2Index = 0; // index to de-reference V0Cores table
int lambdaIndex = 0; // index to de-reference V0Cores table

std::array<float, 21> covariance {0.};
std::array<float, 21> covariance{0.};
};

struct Xi0MCInfo {
int gamma1Index = 0; // index to de-reference V0MCCores table
int gamma2Index = 0; // index to de-reference V0MCCores table
int lambdaIndex = 0; // index to de-reference V0MCCores table

// Basic kinematic info
float gamma1MCpx = -999.f;
float gamma1MCpy = -999.f;
Expand Down Expand Up @@ -1472,8 +1472,8 @@ struct sigma0builder {
auto MCParticle_gamma2 = mcparticles.rawIteratorAt(gamma2MC.particleIdMC());
auto MCParticle_lambda = mcparticles.rawIteratorAt(lambdaMC.particleIdMC());

if ((std::abs(MCParticle_gamma1.pdgCode()) == PDG_t::kGamma) &&
(std::abs(MCParticle_gamma2.pdgCode()) == PDG_t::kGamma) &&
if ((std::abs(MCParticle_gamma1.pdgCode()) == PDG_t::kGamma) &&
(std::abs(MCParticle_gamma2.pdgCode()) == PDG_t::kGamma) &&
(std::abs(MCParticle_lambda.pdgCode()) == PDG_t::kLambda0)) {

// Get MC Mothers
Expand All @@ -1482,9 +1482,9 @@ struct sigma0builder {
auto const& MCMothersList_lambda = MCParticle_lambda.template mothers_as<aod::McParticles>();

if (!MCMothersList_gamma1.empty() && !MCMothersList_gamma2.empty() && !MCMothersList_lambda.empty()) { // Are there mothers?
auto const& MCMother_gamma1 = MCMothersList_gamma1.front(); // First mother
auto const& MCMother_gamma2 = MCMothersList_gamma2.front(); // First mother
auto const& MCMother_lambda = MCMothersList_lambda.front(); // First mother
auto const& MCMother_gamma1 = MCMothersList_gamma1.front(); // First mother
auto const& MCMother_gamma2 = MCMothersList_gamma2.front(); // First mother
auto const& MCMother_lambda = MCMothersList_lambda.front(); // First mother

MCinfo.gamma1PDGCodeMother = MCMother_gamma1.pdgCode();
MCinfo.gamma2PDGCodeMother = MCMother_gamma2.pdgCode();
Expand All @@ -1500,9 +1500,9 @@ struct sigma0builder {
MCinfo.pi0Z = MCMother_gamma1.vz();

auto const& MCMothersList_pi0 = MCMother_gamma1.template mothers_as<aod::McParticles>(); // get pi0 mother list
if (!MCMothersList_pi0.empty()) { // Are there mothers?
auto const& MCMother_pi0 = MCMothersList_pi0.front(); // get pi0 mother
if (!MCMothersList_pi0.empty()) { // Are there mothers?
auto const& MCMother_pi0 = MCMothersList_pi0.front(); // get pi0 mother

if (MCMother_pi0.globalIndex() == MCMother_lambda.globalIndex()) { // check that lambda and pi0 have the same mother.
MCinfo.xi0PDGCode = MCMother_pi0.pdgCode();
MCinfo.xi0MCProcess = MCMother_pi0.getProcess();
Expand Down Expand Up @@ -2601,7 +2601,7 @@ struct sigma0builder {
//_______________________________________________
// Build pi0 candidate for QA
template <typename TV0Object, typename TCollision>
bool buildPi0ForXi0(TV0Object const& gamma1, TV0Object const& gamma2, TCollision const& collision, V0PairTopoInfo &info)
bool buildPi0ForXi0(TV0Object const& gamma1, TV0Object const& gamma2, TCollision const& collision, V0PairTopoInfo& info)
{
//_______________________________________________
// Check if both V0s are made of the same tracks
Expand Down Expand Up @@ -2629,7 +2629,7 @@ struct sigma0builder {

info.v01Index = gamma1.globalIndex();
info.v02Index = gamma2.globalIndex();

//_______________________________________________
// Pi0-specific selections:
if (std::abs(info.pi0Y) > cascadeSelections.maxPi0Rapidity)
Expand Down Expand Up @@ -2675,7 +2675,7 @@ struct sigma0builder {
if (std::hypot(info.position[0], info.position[1]) < cascadeSelections.radiusPi0) {
return false;
}

float x = vtxPi0[0];
float y = vtxPi0[1];
float z = vtxPi0[2];
Expand Down Expand Up @@ -2780,9 +2780,9 @@ struct sigma0builder {

// Calculate DCAxy of the cascade (with bending)
auto lCascadeTrack = fitter3Prongs.createParentTrackParCov();
lCascadeTrack.setAbsCharge(0); // to be sure
lCascadeTrack.setAbsCharge(0); // to be sure
lCascadeTrack.setPID(o2::track::PID::XiMinus); // FIXME: not OK for omegas
std::array<float, 2> dcaInfo {999.f, 999.f};
std::array<float, 2> dcaInfo{999.f, 999.f};

o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, lCascadeTrack, 2.f, fitter3Prongs.getMatCorrType(), &dcaInfo);
cascade.cascadeDCAxy = dcaInfo[0];
Expand All @@ -2795,10 +2795,10 @@ struct sigma0builder {
cascade.gamma2Index = gamma2.globalIndex();
cascade.lambdaIndex = lambda.globalIndex();

std::array<float, 3> momPi0{gamma1.px()+gamma2.px(), gamma1.py()+gamma2.py(), gamma1.pz()+gamma2.pz()};
std::array<float, 3> momPi0{gamma1.px() + gamma2.px(), gamma1.py() + gamma2.py(), gamma1.pz() + gamma2.pz()};
auto arrMom = std::array{momPi0, momLambda};
cascade.xi0Mass = RecoDecay::m(arrMom, std::array{o2::constants::physics::MassPi0, o2::constants::physics::MassXi0});

// Calculate position covariance matrix
auto covVtxV = fitter3Prongs.calcPCACovMatrix(0);
// std::array<float, 6> positionCovariance;
Expand Down Expand Up @@ -2827,7 +2827,7 @@ struct sigma0builder {
}

// Check if MC data and populate corresponding table
if constexpr (requires { collision.straMCCollisionId(); gamma1.motherMCPartId(); gamma2.motherMCPartId(); lambda.motherMCPartId();}) {
if constexpr (requires { collision.straMCCollisionId(); gamma1.motherMCPartId(); gamma2.motherMCPartId(); lambda.motherMCPartId(); }) {
auto xi0MCInfo = getXi0MCInfo(gamma1, gamma2, lambda, collision, mcparticles);

xi0mccores(xi0MCInfo.gamma1MCpx, xi0MCInfo.gamma1MCpy, xi0MCInfo.gamma1MCpz,
Expand All @@ -2838,7 +2838,7 @@ struct sigma0builder {
xi0MCInfo.lambdaIsPhysicalPrimary, xi0MCInfo.lambdaPDGCodePos, xi0MCInfo.lambdaPDGCodeNeg, xi0MCInfo.lambdaPDGCode, xi0MCInfo.lambdaPDGCodeMother,
xi0MCInfo.pi0X, xi0MCInfo.pi0Y, xi0MCInfo.pi0Z, xi0MCInfo.pi0IsPhysicalPrimary, xi0MCInfo.pi0MCProcess, xi0MCInfo.pi0PDGCode,
xi0MCInfo.xi0X, xi0MCInfo.xi0Y, xi0MCInfo.xi0Z, xi0MCInfo.xi0IsPhysicalPrimary, xi0MCInfo.xi0MCProcess, xi0MCInfo.xi0PDGCode, xi0MCInfo.xi0PDGCodeMother);

xi0mcIndices(xi0MCInfo.gamma1Index, xi0MCInfo.gamma2Index, xi0MCInfo.lambdaIndex);

int mcCollisionIndex = -1;
Expand Down Expand Up @@ -3402,7 +3402,7 @@ struct sigma0builder {
pi0Candidates.push_back(pi0Info);
}
}

// second build Xi0 candidates
for (size_t i = 0; i < bestLambdasArray.size(); ++i) { // loop over Lambda
auto lambda = fullV0s.rawIteratorAt(bestLambdasArray[i]);
Expand Down
Loading