Skip to content

Commit 9429243

Browse files
committed
MCParticles: Dynamic columns to extract physics process or generator status
1 parent 83ba2d0 commit 9429243

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Framework/Core/include/Framework/AnalysisDataModel.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ namespace mcparticle
791791
{
792792
DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! MC collision of this particle
793793
DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); //! PDG code
794-
DECLARE_SOA_COLUMN(StatusCode, statusCode, int); //! Status code directly from the generator
794+
DECLARE_SOA_COLUMN(StatusCode, statusCode, int); //! Generators status code or physics process. Do not use directly. Use dynamic columns getGenStatusCode() or getProcess()
795795
DECLARE_SOA_COLUMN(Flags, flags, uint8_t); //! ALICE specific flags, see MCParticleFlags. Do not use directly. Use the dynamic columns, e.g. producedByGenerator()
796796
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Mother0, mother0, int, "McParticles_Mother0"); //! Track index of the first mother
797797
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Mother1, mother1, int, "McParticles_Mother1"); //! Track index of the last mother
@@ -808,10 +808,14 @@ DECLARE_SOA_COLUMN(Vz, vz, float);
808808
DECLARE_SOA_COLUMN(Vt, vt, float); //! Production time
809809
DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, //! Phi
810810
[](float px, float py) -> float { return static_cast<float>(M_PI) + std::atan2(-py, -px); });
811-
DECLARE_SOA_DYNAMIC_COLUMN(ProducedByGenerator, producedByGenerator, //! Particle produced by the generator or by the transport code
811+
DECLARE_SOA_DYNAMIC_COLUMN(ProducedByGenerator, producedByGenerator, //! True if particle produced by the generator (==TMCProcess::kPrimary); False if by the transport code
812812
[](uint8_t flags) -> bool { return (flags & o2::aod::mcparticle::enums::ProducedByTransport) == 0x0; });
813813
DECLARE_SOA_DYNAMIC_COLUMN(FromBackgroundEvent, fromBackgroundEvent, //! Particle from background event
814814
[](uint8_t flags) -> bool { return (flags & o2::aod::mcparticle::enums::FromBackgroundEvent) == o2::aod::mcparticle::enums::FromBackgroundEvent; });
815+
DECLARE_SOA_DYNAMIC_COLUMN(GetProcess, getProcess, //! The VMC physics code (as int) that generated this particle (see header TMCProcess.h in ROOT)
816+
[](uint8_t flags, int statusCode) -> int { if ((flags & o2::aod::mcparticle::enums::ProducedByTransport) == 0x0) { return 0 /*TMCProcess::kPrimary*/; } else { return statusCode; } });
817+
DECLARE_SOA_DYNAMIC_COLUMN(GetGenStatusCode, getGenStatusCode, //! The status code put by the generator, or -1 if a particle produced during transport
818+
[](uint8_t flags, int statusCode) -> int { if ((flags & o2::aod::mcparticle::enums::ProducedByTransport) == 0x0) { return statusCode; } else { return -1; } });
815819

816820
// DECLARE_SOA_EXPRESSION_COLUMN(Phi, phi, float, //! Phi: NOTE this waits that the atan2 function is defined for expression columns
817821
// static_cast<float>(M_PI) + natan2(-aod::mcparticle::py, -aod::mcparticle::px));
@@ -851,7 +855,10 @@ DECLARE_SOA_TABLE_FULL(StoredMcParticles, "McParticles", "AOD", "MCPARTICLE", //
851855
mcparticle::Px, mcparticle::Py, mcparticle::Pz, mcparticle::E,
852856
mcparticle::Vx, mcparticle::Vy, mcparticle::Vz, mcparticle::Vt,
853857
mcparticle::Phi<mcparticle::Px, mcparticle::Py>,
854-
mcparticle::ProducedByGenerator<mcparticle::Flags>, mcparticle::FromBackgroundEvent<mcparticle::Flags>);
858+
mcparticle::ProducedByGenerator<mcparticle::Flags>,
859+
mcparticle::FromBackgroundEvent<mcparticle::Flags>,
860+
mcparticle::GetGenStatusCode<mcparticle::Flags, mcparticle::StatusCode>,
861+
mcparticle::GetProcess<mcparticle::Flags, mcparticle::StatusCode>);
855862

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

0 commit comments

Comments
 (0)