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
8 changes: 3 additions & 5 deletions Framework/Core/include/Framework/AnalysisDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1990,15 +1990,13 @@ namespace mcparticle_v2
// note: this has to be declared in a separate namespace so it does not conflict with existing
// derived data table declarations in O2Physics
DECLARE_SOA_DYNAMIC_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, //! True if particle is considered a physical primary according to the ALICE definition
[](uint8_t input_flags, float vx, float vy) -> bool {
return (o2::aod::mcparticle::Tools::removeIsPhysicalPrimaryBit(input_flags, vx, vy) & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary; });
[](uint8_t input_flags, float vx, float vy) -> bool { return (o2::aod::mcparticle::Tools::removeIsPhysicalPrimaryBit(input_flags, vx, vy) & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary; });

// avoid that the stored flags are provided unprotected via
// the getter '.flags': analysers will get the correct bit map transparently
DECLARE_SOA_COLUMN(Flags, storedFlags, uint8_t); //! ALICE specific flags, see MCParticleFlags. Do not use directly. Use the dynamic columns, e.g. producedByGenerator()
DECLARE_SOA_COLUMN(Flags, storedFlags, uint8_t); //! ALICE specific flags, see MCParticleFlags. Do not use directly. Use the dynamic columns, e.g. producedByGenerator()
DECLARE_SOA_DYNAMIC_COLUMN(ProtectedFlags, flags, //! protected against
[](uint8_t input_flags, float vx, float vy) -> uint8_t {
return o2::aod::mcparticle::Tools::removeIsPhysicalPrimaryBit(input_flags, vx, vy); });
[](uint8_t input_flags, float vx, float vy) -> uint8_t { return o2::aod::mcparticle::Tools::removeIsPhysicalPrimaryBit(input_flags, vx, vy); });

} // namespace mcparticle_v2

Expand Down
11 changes: 6 additions & 5 deletions Framework/Core/include/Framework/DataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,16 @@ namespace o2::aod::mcparticle
constexpr float maxRadiusForPhysicalPrimary{5.f};

struct Tools {
// trivial helper to remove Physical Primary bit
static uint8_t removeIsPhysicalPrimaryBit(uint8_t input_flags, float vx, float vy){
if((std::hypot(vx, vy) > o2::aod::mcparticle::maxRadiusForPhysicalPrimary) && ((input_flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary)){
// trivial helper to remove Physical Primary bit
static uint8_t removeIsPhysicalPrimaryBit(uint8_t input_flags, float vx, float vy)
{
if ((std::hypot(vx, vy) > o2::aod::mcparticle::maxRadiusForPhysicalPrimary) && ((input_flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary)) {
input_flags = input_flags & ~enums::PhysicalPrimary; // remove physical primary bit, keep others
}
return input_flags;
return input_flags;
}
};
}
} // namespace o2::aod::mcparticle

namespace o2::aod::run2
{
Expand Down
Loading