Project
Loading...
Searching...
No Matches
test_AnalysisDataModel.cxx
Go to the documentation of this file.
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 "Framework/ASoA.h"
15#include <catch_amalgamated.hpp>
16
17using namespace o2::framework;
18using namespace arrow;
19using namespace o2::soa;
20using namespace o2::aod;
21
22namespace o2::aod
23{
24namespace col
25{
29DECLARE_SOA_COLUMN(D, d, float);
30} // namespace col
31
32DECLARE_SOA_TABLE(XY, "AOD", "XY", col::X, col::Y);
33DECLARE_SOA_TABLE(ZD, "AOD", "ZD", col::Z, col::D);
34} // namespace o2::aod
35
36TEST_CASE("TestJoinedTablesContains")
37{
38 TableBuilder XYBuilder;
39 // FIXME: using full tracks, instead of stored because of unbound dynamic
40 // column (normalized phi)
41 auto xyWriter = XYBuilder.cursor<XY>();
42 xyWriter(0, 0, 0);
43 auto tXY = XYBuilder.finalize();
44
45 TableBuilder ZDBuilder;
46 auto zdWriter = ZDBuilder.cursor<ZD>();
47 zdWriter(0, 7, 1);
48 auto tZD = ZDBuilder.finalize();
49
51
52 Test tests{{tXY, tZD}, 0};
53 REQUIRE(tests.asArrowTable()->num_columns() != 0);
54 REQUIRE(tests.asArrowTable()->num_columns() ==
55 tXY->num_columns() + tZD->num_columns());
56 auto tests2 = join(XY{tXY}, ZD{tZD});
57 static_assert(std::same_as<Test::table_t, decltype(tests2)::table_t>,
58 "Joined tables should have the same type, regardless how we construct them");
59
61 REQUIRE(FullTracks::contains<o2::aod::Tracks>());
62 REQUIRE(!FullTracks::contains<o2::aod::Collisions>());
63}
#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_,...)
Definition ASoA.h:3052
#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_)
Definition ASoA.h:2314
Test
Definition Utils.h:55
uint32_t col
Definition RawData.h:4
std::shared_ptr< arrow::Table > finalize()
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
constexpr auto join(Ts const &... t)
Definition ASoA.h:3228
TEST_CASE("TestJoinedTablesContains")