Skip to content

Commit 22a43b5

Browse files
committed
Adjustments: fix bugs, tuning
1 parent afb61fa commit 22a43b5

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

Framework/Core/include/Framework/AnalysisDataModel.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,20 +1991,14 @@ namespace mcparticle_v2
19911991
// derived data table declarations in O2Physics
19921992
DECLARE_SOA_DYNAMIC_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, //! True if particle is considered a physical primary according to the ALICE definition
19931993
[](uint8_t input_flags, float vx, float vy) -> bool {
1994-
if((std::hypot(vx, vy) > o2::aod::mcparticle::maxRadiusForPhysicalPrimary) && ((input_flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary)){
1995-
return o2::aod::mcparticle::enums::FromBackgroundEvent;
1996-
}
1997-
return (input_flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary; });
1994+
return (o2::aod::mcparticle::Tools::removeIsPhysicalPrimaryBit(input_flags, vx, vy) & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary; });
19981995

19991996
// avoid that the stored flags are provided unprotected via
20001997
// the getter '.flags': analysers will get the correct bit map transparently
20011998
DECLARE_SOA_COLUMN(Flags, storedFlags, uint8_t); //! ALICE specific flags, see MCParticleFlags. Do not use directly. Use the dynamic columns, e.g. producedByGenerator()
20021999
DECLARE_SOA_DYNAMIC_COLUMN(McParticleFlags, flags, //! protected against
20032000
[](uint8_t input_flags, float vx, float vy) -> uint8_t {
2004-
if((std::hypot(vx, vy) > o2::aod::mcparticle::maxRadiusForPhysicalPrimary) && ((input_flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary)){
2005-
return o2::aod::mcparticle::enums::FromBackgroundEvent;
2006-
}
2007-
return input_flags; });
2001+
return o2::aod::mcparticle::Tools::removeIsPhysicalPrimaryBit(input_flags, vx, vy); });
20082002

20092003
} // namespace mcparticle_v2
20102004

Framework/Core/include/Framework/DataTypes.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "CommonConstants/LHCConstants.h"
1515

16+
#include <cmath>
1617
#include <cstdint>
1718
#include <limits>
1819
#include <array>
@@ -148,11 +149,6 @@ enum ForwardTrackTypeEnum : uint8_t {
148149
};
149150
} // namespace o2::aod::fwdtrack
150151

151-
namespace o2::aod::mcparticle
152-
{
153-
constexpr float maxRadiusForPhysicalPrimary{5.f};
154-
}
155-
156152
namespace o2::aod::mcparticle::enums
157153
{
158154
enum MCParticleFlags : uint8_t {
@@ -163,6 +159,21 @@ enum MCParticleFlags : uint8_t {
163159
};
164160
} // namespace o2::aod::mcparticle::enums
165161

162+
namespace o2::aod::mcparticle
163+
{
164+
constexpr float maxRadiusForPhysicalPrimary{5.f};
165+
166+
struct Tools {
167+
// trivial helper to remove Physical Primary bit
168+
static uint8_t removeIsPhysicalPrimaryBit(uint8_t input_flags, float vx, float vy){
169+
if((std::hypot(vx, vy) > o2::aod::mcparticle::maxRadiusForPhysicalPrimary) && ((input_flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary)){
170+
input_flags = input_flags & ~enums::PhysicalPrimary; // remove physical primary bit, keep others
171+
}
172+
return input_flags;
173+
}
174+
};
175+
}
176+
166177
namespace o2::aod::run2
167178
{
168179
enum Run2EventSelectionCut {

0 commit comments

Comments
 (0)