Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add energy as a dynamic column #8574

Merged
merged 1 commit into from
Apr 28, 2022
Merged
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
16 changes: 12 additions & 4 deletions Framework/Core/include/Framework/AnalysisDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,19 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! Momentum in z-direction in GeV/c

DECLARE_SOA_EXPRESSION_COLUMN(P, p, float, //! Momentum in Gev/c
0.5f * (ntan(PIQuarter - 0.5f * natan(aod::track::tgl)) + 1.f / ntan(PIQuarter - 0.5f * natan(aod::track::tgl))) / nabs(aod::track::signed1Pt));
DECLARE_SOA_DYNAMIC_COLUMN(Energy, energy, //! Track energy, computed under the mass assumption given as input
[](float signed1Pt, float tgl, float mass) -> float {
const auto pt = 1.f / std::abs(signed1Pt);
const auto pz = pt * tgl;
const auto p = 0.5f * (tan(PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(PIQuarter - 0.5f * atan(tgl))) * pt;
return sqrt(p * p + mass * mass);
});
DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input
[](float signed1Pt, float tgl, float mass) -> float {
auto pt = 1.f / std::abs(signed1Pt);
auto pz = pt * tgl;
auto p = 0.5f * (tan(PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(PIQuarter - 0.5f * atan(tgl))) * pt;
auto energy = sqrt(p * p + mass * mass);
const auto pt = 1.f / std::abs(signed1Pt);
const auto pz = pt * tgl;
const auto p = 0.5f * (tan(PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(PIQuarter - 0.5f * atan(tgl))) * pt;
const auto energy = sqrt(p * p + mass * mass);
return 0.5f * log((energy + pz) / (energy - pz));
});

Expand Down Expand Up @@ -282,6 +289,7 @@ DECLARE_SOA_TABLE_FULL(StoredTracks, "Tracks", "AOD", "TRACK", //! On disk versi
track::Px<track::Signed1Pt, track::Snp, track::Alpha>,
track::Py<track::Signed1Pt, track::Snp, track::Alpha>,
track::Pz<track::Signed1Pt, track::Tgl>,
track::Energy<track::Signed1Pt, track::Tgl>,
track::Rapidity<track::Signed1Pt, track::Tgl>,
track::Sign<track::Signed1Pt>);

Expand Down