Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
42 changes: 33 additions & 9 deletions 42 Framework/Core/include/Framework/ASoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -1382,11 +1382,28 @@ using JoinBase = decltype(join(std::declval<Ts>()...));
template <typename T1, typename T2>
using ConcatBase = decltype(concat(std::declval<T1>(), std::declval<T2>()));

template <typename T1, typename T2>
constexpr auto is_binding_compatible_v()
template <typename B, typename E>
struct EquivalentIndex {
constexpr static bool value = false;
};

template <typename B, typename E>
constexpr bool is_index_equivalent_v = EquivalentIndex<B, E>::value;

template <typename T, typename... Os>
constexpr bool are_bindings_compatible_v(framework::pack<Os...>&&)
{
return framework::pack_size(
framework::intersected_pack_t<originals_pack_t<T1>, originals_pack_t<T2>>{}) > 0;
if constexpr (is_type_with_originals_v<T>) {
return (are_bindings_compatible_v<Os>(originals_pack_t<T>{}) || ...);
} else {
return ((std::is_same_v<T, Os> || is_index_equivalent_v<T, Os>) || ...);
}
}

template <typename T, typename B>
constexpr bool is_binding_compatible_v()
{
return are_bindings_compatible_v<T>(originals_pack_t<B>{});
}

} // namespace o2::soa
Expand All @@ -1397,6 +1414,12 @@ constexpr auto is_binding_compatible_v()
using metadata = std::void_t<T>; \
}

#define DECLARE_EQUIVALENT_FOR_INDEX(_Base_, _Equiv_) \
template <> \
struct EquivalentIndex<_Base_, _Equiv_> { \
constexpr static bool value = true; \
}

#define DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
static constexpr const char* mLabel = _Label_; \
Expand Down Expand Up @@ -1549,7 +1572,7 @@ constexpr auto is_binding_compatible_v()

#define DECLARE_SOA_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")

///ARRAY
/// ARRAY
#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) \
struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
Expand Down Expand Up @@ -1628,7 +1651,7 @@ constexpr auto is_binding_compatible_v()

#define DECLARE_SOA_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")

///NORMAL
/// NORMAL
#define DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) \
struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
Expand Down Expand Up @@ -1701,7 +1724,7 @@ constexpr auto is_binding_compatible_v()

#define DECLARE_SOA_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")

///SELF
/// SELF
#define DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
Expand Down Expand Up @@ -1808,7 +1831,7 @@ constexpr auto is_binding_compatible_v()
void const* mBinding = nullptr; \
};

#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, #_Name_)
#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
/// SELF ARRAY
#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
Expand Down Expand Up @@ -1867,7 +1890,8 @@ constexpr auto is_binding_compatible_v()
void const* mBinding = nullptr; \
};

#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, #_Name_)
#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)

/// A dynamic column is a column whose values are derived
/// from those of other real columns. These can be used for
/// example to provide different coordinate systems (e.g. polar,
Expand Down
35 changes: 31 additions & 4 deletions 35 Framework/Core/include/Framework/AnalysisDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Mother0, mother0, int, "McParticles_Mother0")
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Mother1, mother1, int, "McParticles_Mother1"); //! Track index of the last mother
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Daughter0, daughter0, int, "McParticles_Daughter0"); //! Track index of the first daugther
DECLARE_SOA_SELF_INDEX_COLUMN_FULL(Daughter1, daughter1, int, "McParticles_Daughter1"); //! Track index of the last daugther
DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(Daughters, daughters); //! Daughter tracks (possibly empty) slice
DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(Mothers, mothers); //! Mother tracks (possible empty) array
DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(Mothers, mothers); //! Mother tracks (possible empty) array. Iterate over mcParticle.mothers_as<aod::McParticles>())
DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(Daughters, daughters); //! Daughter tracks (possibly empty) slice. Check for non-zero with mcParticle.has_daughters(). Iterate over mcParticle.daughters_as<aod::McParticles>())
DECLARE_SOA_COLUMN(Weight, weight, float); //! MC weight
DECLARE_SOA_COLUMN(Px, px, float); //! Momentum in x in GeV/c
DECLARE_SOA_COLUMN(Py, py, float); //! Momentum in y in GeV/c
Expand Down Expand Up @@ -847,7 +847,7 @@ DECLARE_SOA_EXPRESSION_COLUMN(Y, y, float, //! Particle rapidity, conditionally
(aod::mcparticle::e - aod::mcparticle::pz))));
} // namespace mcparticle

DECLARE_SOA_TABLE_FULL(StoredMcParticles, "McParticles", "AOD", "MCPARTICLE", //! On disk version of the MC particle table
DECLARE_SOA_TABLE_FULL(StoredMcParticles_000, "McParticles", "AOD", "MCPARTICLE", //! MC particle table, version 000
o2::soa::Index<>, mcparticle::McCollisionId,
mcparticle::PdgCode, mcparticle::StatusCode, mcparticle::Flags,
mcparticle::Mother0Id, mcparticle::Mother1Id,
Expand All @@ -860,15 +860,42 @@ DECLARE_SOA_TABLE_FULL(StoredMcParticles, "McParticles", "AOD", "MCPARTICLE", //
mcparticle::GetProcess<mcparticle::Flags, mcparticle::StatusCode>,
mcparticle::IsPhysicalPrimary<mcparticle::Flags>);

DECLARE_SOA_EXTENDED_TABLE(McParticles, StoredMcParticles, "MCPARTICLE", //! Basic MC particle properties
DECLARE_SOA_TABLE_FULL(StoredMcParticles_001, "McParticles_001", "AOD", "MCPARTICLE_001", //! MC particle table, version 001
o2::soa::Index<>, mcparticle::McCollisionId,
mcparticle::PdgCode, mcparticle::StatusCode, mcparticle::Flags,
mcparticle::MothersIds, mcparticle::DaughtersIdSlice, mcparticle::Weight,
mcparticle::Px, mcparticle::Py, mcparticle::Pz, mcparticle::E,
mcparticle::Vx, mcparticle::Vy, mcparticle::Vz, mcparticle::Vt,
mcparticle::ProducedByGenerator<mcparticle::Flags>,
mcparticle::FromBackgroundEvent<mcparticle::Flags>,
mcparticle::GetGenStatusCode<mcparticle::Flags, mcparticle::StatusCode>,
mcparticle::GetProcess<mcparticle::Flags, mcparticle::StatusCode>,
mcparticle::IsPhysicalPrimary<mcparticle::Flags>);

DECLARE_SOA_EXTENDED_TABLE(McParticles_000, StoredMcParticles_000, "MCPARTICLE", //! Basic MC particle properties
mcparticle::Phi,
mcparticle::Eta,
mcparticle::Pt,
mcparticle::P,
mcparticle::Y);

DECLARE_SOA_EXTENDED_TABLE(McParticles_001, StoredMcParticles_001, "MCPARTICLE_001", //! Basic MC particle properties
mcparticle::Phi,
mcparticle::Eta,
mcparticle::Pt,
mcparticle::P,
mcparticle::Y);

using McParticles = McParticles_000;
using McParticle = McParticles::iterator;
} // namespace aod
namespace soa
{
DECLARE_EQUIVALENT_FOR_INDEX(aod::StoredMcParticles_000, aod::StoredMcParticles_001);
}

namespace aod
{
namespace mctracklabel
{
DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle
Expand Down
4 changes: 3 additions & 1 deletion 4 Framework/Core/src/AODReaderHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ AlgorithmSpec AODReaderHelpers::aodSpawnerCallback(std::vector<InputSpec>& reque
} else if (description == header::DataDescription{"FWDTRACKCOV"}) {
outputs.adopt(Output{origin, description}, maker(o2::aod::FwdTracksCovExtensionMetadata{}));
} else if (description == header::DataDescription{"MCPARTICLE"}) {
outputs.adopt(Output{origin, description}, maker(o2::aod::McParticlesExtensionMetadata{}));
outputs.adopt(Output{origin, description}, maker(o2::aod::McParticles_000ExtensionMetadata{}));
} else if (description == header::DataDescription{"MCPARTICLE_001"}) {
outputs.adopt(Output{origin, description}, maker(o2::aod::McParticles_001ExtensionMetadata{}));
} else {
throw runtime_error("Not an extended table");
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.