|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +#include <TH1.h> |
| 13 | +#include "Framework/ASoA.h" |
| 14 | +#include "Framework/AnalysisDataModel.h" |
| 15 | +#include "Framework/Expressions.h" |
| 16 | +#include "Framework/AnalysisHelpers.h" |
| 17 | +#include "Framework/AnalysisTask.h" |
| 18 | +#include "Framework/Condition.h" |
| 19 | +#include "SimulationDataFormat/O2DatabasePDG.h" |
| 20 | + |
| 21 | +#include <catch_amalgamated.hpp> |
| 22 | + |
| 23 | +using namespace o2::framework; |
| 24 | +using namespace o2::soa; |
| 25 | +using namespace o2; |
| 26 | + |
| 27 | +struct P { |
| 28 | + void process1(aod::Collisions const&) |
| 29 | + { |
| 30 | + } |
| 31 | + |
| 32 | + PROCESS_SWITCH(P, process1, "", true); |
| 33 | +}; |
| 34 | + |
| 35 | +TEST_CASE("IdentificationConcepts") |
| 36 | +{ |
| 37 | + // ASoA |
| 38 | + int i; |
| 39 | + REQUIRE(not_void<decltype(i)>); |
| 40 | + |
| 41 | + REQUIRE(is_persistent_column<o2::aod::track::CollisionId>); |
| 42 | + |
| 43 | + REQUIRE(is_self_index_column<o2::aod::mcparticle::DaughtersIdSlice>); |
| 44 | + |
| 45 | + REQUIRE(!is_index_column<o2::aod::mcparticle::DaughtersIdSlice>); |
| 46 | + REQUIRE(is_index_column<o2::aod::track::CollisionId>); |
| 47 | + REQUIRE(is_index_column<o2::aod::indices::CollisionIds>); |
| 48 | + |
| 49 | + REQUIRE(o2::aod::is_aod_hash<o2::aod::Hash<"AOD"_h>>); |
| 50 | + REQUIRE(o2::aod::is_origin_hash<o2::aod::Hash<"AOD"_h>>); |
| 51 | + |
| 52 | + REQUIRE(has_parent_t<o2::aod::Track>); |
| 53 | + |
| 54 | + REQUIRE(is_metadata<o2::aod::TracksIUExtensionMetadata>); |
| 55 | + |
| 56 | + REQUIRE(is_metadata_trait<o2::aod::MetadataTrait<o2::aod::Hash<"TRACK/0"_h>>>); |
| 57 | + |
| 58 | + REQUIRE(has_metadata<o2::aod::MetadataTrait<o2::aod::Hash<"TRACK/0"_h>>>); |
| 59 | + |
| 60 | + REQUIRE(has_extension<o2::aod::MetadataTrait<o2::aod::Hash<"EXTRACK/0"_h>>::metadata>); |
| 61 | + |
| 62 | + REQUIRE(is_spawnable_column<o2::aod::track::Pt>); |
| 63 | + |
| 64 | + REQUIRE(is_indexing_column<Index<>>); |
| 65 | + |
| 66 | + REQUIRE(is_dynamic_column<o2::aod::track::Energy<o2::aod::track::Signed1Pt, o2::aod::track::Tgl>>); |
| 67 | + |
| 68 | + REQUIRE(is_marker_column<o2::soa::Marker<1>>); |
| 69 | + |
| 70 | + REQUIRE(is_column<o2::aod::track::Pt>); |
| 71 | + REQUIRE(is_column<Index<>>); |
| 72 | + REQUIRE(is_column<o2::aod::track::Energy<o2::aod::track::Signed1Pt, o2::aod::track::Tgl>>); |
| 73 | + REQUIRE(is_column<o2::soa::Marker<1>>); |
| 74 | + |
| 75 | + REQUIRE(is_table<o2::aod::Collisions>); |
| 76 | + |
| 77 | + REQUIRE(is_iterator<o2::aod::Collision>); |
| 78 | + |
| 79 | + REQUIRE(with_originals<o2::aod::Collisions>); |
| 80 | + |
| 81 | + REQUIRE(with_sources<o2::aod::MetadataTrait<o2::aod::Hash<"MA_RN3_SP/0"_h>>::metadata>); |
| 82 | + |
| 83 | + REQUIRE(with_base_table<o2::aod::Tracks>); |
| 84 | + |
| 85 | + REQUIRE(is_index_table<o2::aod::Run3MatchedSparse>); |
| 86 | + |
| 87 | + Preslice<o2::aod::Tracks> ps = o2::aod::track::collisionId; |
| 88 | + REQUIRE(is_preslice<decltype(ps)>); |
| 89 | + |
| 90 | + REQUIRE(has_filtered_policy<soa::Filtered<o2::aod::Tracks>::iterator>); |
| 91 | + |
| 92 | + REQUIRE(is_filtered_iterator<soa::Filtered<o2::aod::Tracks>::iterator>); |
| 93 | + |
| 94 | + REQUIRE(is_filtered_table<soa::Filtered<o2::aod::Tracks>>); |
| 95 | + |
| 96 | + REQUIRE(is_filtered<soa::Filtered<o2::aod::Tracks>::iterator>); |
| 97 | + REQUIRE(is_filtered<soa::Filtered<o2::aod::Tracks>>); |
| 98 | + |
| 99 | + REQUIRE(is_not_filtered_table<o2::aod::Collisions>); |
| 100 | + |
| 101 | + REQUIRE(is_join<o2::aod::Tracks>); |
| 102 | + |
| 103 | + auto tl = []() -> SmallGroups<o2::aod::Collisions> { return {std::vector<std::shared_ptr<arrow::Table>>{}, SelectionVector{}, 0}; }; |
| 104 | + REQUIRE(is_smallgroups<decltype(tl())>); |
| 105 | + |
| 106 | + // AnalysisHelpers |
| 107 | + REQUIRE(is_producable<o2::aod::Collisions>); |
| 108 | + |
| 109 | + Produces<o2::aod::Collisions> prod; |
| 110 | + REQUIRE(is_produces<decltype(prod)>); |
| 111 | + |
| 112 | + struct : ProducesGroup { |
| 113 | + Produces<o2::aod::Collisions> p; |
| 114 | + } prodg; |
| 115 | + REQUIRE(is_produces_group<decltype(prodg)>); |
| 116 | + |
| 117 | + REQUIRE(is_spawnable<o2::aod::Tracks>); |
| 118 | + |
| 119 | + Spawns<o2::aod::Tracks> spw; |
| 120 | + REQUIRE(is_spawns<decltype(spw)>); |
| 121 | + |
| 122 | + Builds<o2::aod::Run3MatchedSparse> bld; |
| 123 | + REQUIRE(is_builds<decltype(bld)>); |
| 124 | + |
| 125 | + OutputObj<TH1F> oo{"test"}; |
| 126 | + REQUIRE(is_outputobj<decltype(oo)>); |
| 127 | + |
| 128 | + Service<o2::O2DatabasePDG> srv; |
| 129 | + REQUIRE(is_service<decltype(srv)>); |
| 130 | + |
| 131 | + Partition<o2::aod::Tracks> part = o2::aod::track::collisionId >= 0; |
| 132 | + REQUIRE(is_partition<decltype(part)>); |
| 133 | + |
| 134 | + // AnalysisTask |
| 135 | + Enumeration<0, 1> en; |
| 136 | + REQUIRE(is_enumeration<decltype(en)>); |
| 137 | + |
| 138 | + // Condition |
| 139 | + Condition<int> c{""}; |
| 140 | + REQUIRE(is_condition<decltype(c)>); |
| 141 | + |
| 142 | + struct : ConditionGroup { |
| 143 | + Condition<float> c{""}; |
| 144 | + } cg; |
| 145 | + REQUIRE(is_condition_group<decltype(cg)>); |
| 146 | + |
| 147 | + // Configurable |
| 148 | + Configurable<int> cc{"", 1, ""}; |
| 149 | + REQUIRE(is_configurable<decltype(cc)>); |
| 150 | + |
| 151 | + ConfigurableAxis ca{"", {0, 1, 2, 3}, ""}; |
| 152 | + REQUIRE(is_configurable_axis<decltype(ca)>); |
| 153 | + |
| 154 | + REQUIRE(is_process_configurable<decltype(P::doprocess1)>); |
| 155 | + |
| 156 | + struct : ConfigurableGroup { |
| 157 | + Configurable<int> c{"", 1, ""}; |
| 158 | + } ccg; |
| 159 | + REQUIRE(is_configurable_group<decltype(ccg)>); |
| 160 | + |
| 161 | + // Expressions |
| 162 | + expressions::Filter f = o2::aod::track::pt > 1.0f; |
| 163 | + REQUIRE(expressions::is_filter<decltype(f)>); |
| 164 | +} |
0 commit comments