Skip to content

Commit 05e135e

Browse files
authored
Flag for background particles (#7344)
1 parent f596f7d commit 05e135e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Framework/Core/include/Framework/AnalysisDataModel.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ namespace mcparticle
787787
DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! MC collision of this particle
788788
DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); //! PDG code
789789
DECLARE_SOA_COLUMN(StatusCode, statusCode, int); //! Status code directly from the generator
790-
DECLARE_SOA_COLUMN(Flags, flags, uint8_t); //! ALICE specific flags. Do not use directly. Use the dynamic columns, e.g. producedByGenerator()
790+
DECLARE_SOA_COLUMN(Flags, flags, uint8_t); //! ALICE specific flags, see MCParticleFlags. Do not use directly. Use the dynamic columns, e.g. producedByGenerator()
791791
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Mother0, mother0, int, "McParticles_Mother0"); //! Track index of the first mother
792792
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Mother1, mother1, int, "McParticles_Mother1"); //! Track index of the last mother
793793
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Daughter0, daughter0, int, "McParticles_Daughter0"); //! Track index of the first daugther
@@ -804,7 +804,9 @@ DECLARE_SOA_COLUMN(Vt, vt, float);
804804
DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! Phi
805805
[](float px, float py) -> float { return static_cast<float>(M_PI) + std::atan2(-py, -px); });
806806
DECLARE_SOA_DYNAMIC_COLUMN(ProducedByGenerator, producedByGenerator, //! Particle produced by the generator or by the transport code
807-
[](uint8_t flags) -> bool { return (flags & 0x1) == 0x0; });
807+
[](uint8_t flags) -> bool { return (flags & o2::aod::mcparticle::enums::ProducedByTransport) == 0x0; });
808+
DECLARE_SOA_DYNAMIC_COLUMN(FromBackgroundEvent, fromBackgroundEvent, //! Particle from background event
809+
[](uint8_t flags) -> bool { return (flags & o2::aod::mcparticle::enums::FromBackgroundEvent) == o2::aod::mcparticle::enums::FromBackgroundEvent; });
808810

809811
// DECLARE_SOA_EXPRESSION_COLUMN(Phi, phi, float, //! Phi: NOTE this waits that the atan2 function is defined for expression columns
810812
// static_cast<float>(M_PI) + natan2(-aod::mcparticle::py, -aod::mcparticle::px));
@@ -844,8 +846,7 @@ DECLARE_SOA_TABLE_FULL(StoredMcParticles, "McParticles", "AOD", "MCPARTICLE", //
844846
mcparticle::Px, mcparticle::Py, mcparticle::Pz, mcparticle::E,
845847
mcparticle::Vx, mcparticle::Vy, mcparticle::Vz, mcparticle::Vt,
846848
mcparticle::Phi<mcparticle::Px, mcparticle::Py>,
847-
// mcparticle::Eta<mcparticle::Px, mcparticle::Py, mcparticle::Pz>,
848-
mcparticle::ProducedByGenerator<mcparticle::Flags>);
849+
mcparticle::ProducedByGenerator<mcparticle::Flags>, mcparticle::FromBackgroundEvent<mcparticle::Flags>);
849850

850851
DECLARE_SOA_EXTENDED_TABLE(McParticles, StoredMcParticles, "MCPARTICLE", //! Basic MC particle properties
851852
// mcparticle::Phi,

Framework/Core/include/Framework/DataTypes.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ enum ForwardTrackTypeEnum : uint8_t {
6161
};
6262
} // namespace o2::aod::fwdtrack
6363

64+
namespace o2::aod::mcparticle::enums
65+
{
66+
enum MCParticleFlags : uint8_t {
67+
ProducedByTransport = 0x1,
68+
FromBackgroundEvent = 0x2 // Particle from background event (may have been used several times)
69+
};
70+
} // namespace o2::aod::mcparticle::enums
71+
6472
namespace o2::aod::run2
6573
{
6674
enum Run2EventSelectionCut {

0 commit comments

Comments
 (0)