Skip to content

Commit 778ad16

Browse files
committed
formatting
1 parent c4bba07 commit 778ad16

File tree

7 files changed

+695
-679
lines changed

7 files changed

+695
-679
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 597 additions & 577 deletions
Large diffs are not rendered by default.

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
#ifndef o2_framework_AnalysisHelpers_H_DEFINED
1212
#define o2_framework_AnalysisHelpers_H_DEFINED
1313

14-
#include "Framework/DataAllocator.h"
15-
#include "Framework/Traits.h"
16-
#include "Framework/TableBuilder.h"
1714
#include "Framework/ASoA.h"
18-
#include "Framework/OutputSpec.h"
19-
#include "Framework/OutputRef.h"
15+
#include "Framework/DataAllocator.h"
16+
#include "Framework/ExpressionHelpers.h"
17+
#include "Framework/IndexBuilderHelpers.h"
2018
#include "Framework/InputSpec.h"
21-
#include "Framework/OutputObjHeader.h"
22-
#include "Framework/StringHelpers.h"
2319
#include "Framework/Output.h"
24-
#include "Framework/IndexBuilderHelpers.h"
20+
#include "Framework/OutputObjHeader.h"
21+
#include "Framework/OutputRef.h"
22+
#include "Framework/OutputSpec.h"
2523
#include "Framework/Plugins.h"
26-
#include "Framework/ExpressionHelpers.h"
24+
#include "Framework/StringHelpers.h"
25+
#include "Framework/TableBuilder.h"
26+
#include "Framework/Traits.h"
2727

2828
#include <string>
2929
namespace o2::soa
@@ -35,8 +35,7 @@ constexpr auto tableRef2InputSpec()
3535
o2::aod::Hash<R.label_hash>::str,
3636
o2::aod::Hash<R.origin_hash>::origin,
3737
o2::aod::description(o2::aod::Hash<R.desc_hash>::str),
38-
R.version
39-
};
38+
R.version};
4039
}
4140

4241
template <TableRef R>
@@ -46,8 +45,7 @@ constexpr auto tableRef2OutputSpec()
4645
framework::OutputLabel{o2::aod::Hash<R.label_hash>::str},
4746
o2::aod::Hash<R.origin_hash>::origin,
4847
o2::aod::description(o2::aod::Hash<R.desc_hash>::str),
49-
R.version
50-
};
48+
R.version};
5149
}
5250

5351
template <TableRef R>
@@ -56,17 +54,15 @@ constexpr auto tableRef2Output()
5654
return framework::Output{
5755
o2::aod::Hash<R.origin_hash>::origin,
5856
o2::aod::description(o2::aod::Hash<R.desc_hash>::str),
59-
R.version
60-
};
57+
R.version};
6158
}
6259

6360
template <TableRef R>
6461
constexpr auto tableRef2OutputRef()
6562
{
6663
return framework::OutputRef{
6764
o2::aod::Hash<R.label_hash>::str,
68-
R.version
69-
};
65+
R.version};
7066
}
7167

7268
template <TableRef R>
@@ -76,10 +72,9 @@ constexpr auto tableRef2ConfigParamSpec()
7672
std::string{"iput:"} + o2::aod::Hash<R.label_hash>::str,
7773
framework::VariantType::String,
7874
aod::sourceSpec<R>(),
79-
{"\"\""}
80-
};
81-
}
75+
{"\"\""}};
8276
}
77+
} // namespace o2::soa
8378

8479
namespace o2::framework
8580
{
@@ -263,12 +258,12 @@ struct OutputForTableNG {
263258
/// means of the WritingCursor helper class, from which produces actually
264259
/// derives.
265260
template <soa::hasMetadata T>
266-
struct Produces : WritingCursor<typename soa::PackToTable<aod::MetadataTrait<T>::metadata::origin(), typename T::table_t::persistent_columns_t>::table>
267-
{};
261+
struct Produces : WritingCursor<typename soa::PackToTable<aod::MetadataTrait<T>::metadata::origin(), typename T::table_t::persistent_columns_t>::table> {
262+
};
268263

269264
template <soa::hasngMetadata T>
270-
struct ProducesNG : WritingCursorNG<T>
271-
{};
265+
struct ProducesNG : WritingCursorNG<T> {
266+
};
272267

273268
/// Use this to group together produces. Useful to separate them logically
274269
/// or simply to stay within the 100 elements per Task limit.
@@ -339,8 +334,7 @@ struct TableTransform {
339334
};
340335

341336
template <o2::aod::NGMetadata M, soa::TableRef Ref>
342-
struct TableTransformNG
343-
{
337+
struct TableTransformNG {
344338
using metadata = M;
345339
constexpr static auto sources = M::sources;
346340

@@ -404,8 +398,7 @@ struct Spawns : TableTransform<typename aod::MetadataTrait<framework::pack_head_
404398
};
405399

406400
template <typename T>
407-
struct SpawnsNG : TableTransformNG<typename aod::MetadataTraitNG<o2::aod::Hash<T::ref.desc_hash>>::metadata, T::ref>
408-
{
401+
struct SpawnsNG : TableTransformNG<typename aod::MetadataTraitNG<o2::aod::Hash<T::ref.desc_hash>>::metadata, T::ref> {
409402
using metadata = TableTransformNG<typename aod::MetadataTraitNG<o2::aod::Hash<T::ref.desc_hash>>::metadata, T::ref>::metadata;
410403
using extension_t = typename metadata::extension_table_t;
411404
using base_table_t = typename metadata::base_table_t;
@@ -485,7 +478,7 @@ struct Reduction {
485478

486479
template <typename Key, typename C>
487480
using reduced_t = Reduction<Key, C>::type;
488-
} // namespace
481+
} // namespace
489482

490483
template <typename Kind>
491484
struct IndexBuilder {
@@ -554,7 +547,8 @@ struct IndexBuilderNG {
554547

555548
auto sq = std::make_index_sequence<sizeof...(Cs)>();
556549

557-
auto columnBuilders = [&tables, &pool]<size_t... Is>(std::index_sequence<Is...>) -> std::array<std::shared_ptr<framework::SelfIndexColumnBuilder>, sizeof...(Cs)> {
550+
auto columnBuilders = [&tables, &pool ]<size_t... Is>(std::index_sequence<Is...>) -> std::array<std::shared_ptr<framework::SelfIndexColumnBuilder>, sizeof...(Cs)>
551+
{
558552
return {[](arrow::Table* table, arrow::MemoryPool* pool) {
559553
using T = framework::pack_element_t<Is, framework::pack<Cs...>>;
560554
if constexpr (!Key::template hasOriginal<refs[Is + 1]>()) {
@@ -564,7 +558,8 @@ struct IndexBuilderNG {
564558
return std::make_shared<SelfIndexColumnBuilder>(T::columnLabel(), pool);
565559
}
566560
}(tables[Is + 1].get(), pool)...};
567-
}(sq);
561+
}
562+
(sq);
568563

569564
std::array<bool, sizeof...(Cs)> finds;
570565

@@ -575,43 +570,41 @@ struct IndexBuilderNG {
575570
} else {
576571
idx = keyIndex->valueAt(counter);
577572
}
578-
finds = [&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>){
573+
finds = [&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>) {
579574
return std::array{
580-
[&idx, &columnBuilders](){
575+
[&idx, &columnBuilders]() {
581576
using T = typename framework::pack_element_t<Is, framework::pack<Cs...>>;
582577
return std::static_pointer_cast<typename Reduction<Key, T>::type>(columnBuilders[Is])->template find<T>(idx);
583-
}()
584-
...};
578+
}()...};
585579
}(sq);
586580
if constexpr (std::is_same_v<Kind, Sparse>) {
587-
[&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>){
588-
([&idx, &columnBuilders](){
581+
[&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>) {
582+
([&idx, &columnBuilders]() {
589583
using T = typename framework::pack_element_t<Is, framework::pack<Cs...>>;
590-
return std::static_pointer_cast<typename Reduction<Key, T>::type>(columnBuilders[Is])->template fill<T>(idx);}()
591-
, ...);
584+
return std::static_pointer_cast<typename Reduction<Key, T>::type>(columnBuilders[Is])->template fill<T>(idx); }(), ...);
592585
}(sq);
593586
self.fill<C1>(counter);
594587
} else if constexpr (std::is_same_v<Kind, Exclusive>) {
595588
if (std::none_of(finds.begin(), finds.end(), [](bool const x) { return x == false; })) {
596-
[&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>){
597-
([&idx, &columnBuilders](){
589+
[&idx, &columnBuilders]<size_t... Is>(std::index_sequence<Is...>) {
590+
([&idx, &columnBuilders]() {
598591
using T = typename framework::pack_element_t<Is, framework::pack<Cs...>>;
599592
return std::static_pointer_cast<typename Reduction<Key, T>::type>(columnBuilders[Is])->template fill<T>(idx);
600-
}()
601-
, ...);
593+
}(),
594+
...);
602595
}(sq);
603596
self.fill<C1>(counter);
604597
}
605598
}
606599
}
607600

608-
return [&label, &columnBuilders, &self]<size_t... Is>(std::index_sequence<Is...>){
601+
return [&label, &columnBuilders, &self]<size_t... Is>(std::index_sequence<Is...>) {
609602
return makeArrowTable(label,
610-
{self.template result<C1>(), [&columnBuilders](){
603+
{self.template result<C1>(), [&columnBuilders]() {
611604
using T = typename framework::pack_element_t<Is, framework::pack<Cs...>>;
612605
return std::static_pointer_cast<typename Reduction<Key, T>::type>(columnBuilders[Is])->template result<T>();
613606
}()...},
614-
{self.field(), [&columnBuilders](){
607+
{self.field(), [&columnBuilders]() {
615608
using T = typename framework::pack_element_t<Is, framework::pack<Cs...>>;
616609
return std::static_pointer_cast<typename Reduction<Key, T>::type>(columnBuilders[Is])->field();
617610
}()...});
@@ -811,7 +804,8 @@ auto getTableFromFilter(const T& table, soa::SelectionVector&& selection)
811804
return std::make_unique<o2::soa::Filtered<T>>(std::vector{table}, std::forward<soa::SelectionVector>(selection));
812805
}
813806

814-
template <soa::soaTable T> requires (!soa::soaFilteredTable<T>)
807+
template <soa::soaTable T>
808+
requires(!soa::soaFilteredTable<T>)
815809
auto getTableFromFilter(const T& table, soa::SelectionVector&& selection)
816810
{
817811
return std::make_unique<o2::soa::Filtered<T>>(std::vector{table.asArrowTable()}, std::forward<soa::SelectionVector>(selection));
@@ -823,7 +817,8 @@ auto getTableFromFilter(const T& table, soa::SelectionVector&& selection)
823817
return std::make_unique<o2::soa::FilteredNG<T>>(std::vector{table}, std::forward<soa::SelectionVector>(selection));
824818
}
825819

826-
template <soa::ngTable T> requires (!soa::ngFilteredTable<T>)
820+
template <soa::ngTable T>
821+
requires(!soa::ngFilteredTable<T>)
827822
auto getTableFromFilter(const T& table, soa::SelectionVector&& selection)
828823
{
829824
return std::make_unique<o2::soa::FilteredNG<T>>(std::vector{table.asArrowTable()}, std::forward<soa::SelectionVector>(selection));
@@ -1054,13 +1049,13 @@ struct PartitionNG {
10541049
return mFiltered->size();
10551050
}
10561051
};
1057-
} // namespace o2::framework
1052+
} // namespace o2::framework
10581053

10591054
namespace o2::soa
10601055
{
10611056
/// On-the-fly adding of expression columns
10621057
template <typename T, typename... Cs>
1063-
requires (soa::is_soa_table_like_v<T>)
1058+
requires(soa::is_soa_table_like_v<T>)
10641059
auto Extend(T const& table)
10651060
{
10661061
static_assert((soa::is_type_spawnable_v<Cs> && ...), "You can only extend a table with expression columns");
@@ -1069,7 +1064,7 @@ auto Extend(T const& table)
10691064
}
10701065

10711066
template <typename T, typename... Cs>
1072-
requires (framework::is_base_of_template_v<TableNG, T>)
1067+
requires(framework::is_base_of_template_v<TableNG, T>)
10731068
auto Extend(T const& table)
10741069
{
10751070
static_assert((soa::is_type_spawnable_v<Cs> && ...), "You can only extend a table with expression columns");
@@ -1080,7 +1075,7 @@ auto Extend(T const& table)
10801075
/// Template function to attach dynamic columns on-the-fly (e.g. inside
10811076
/// process() function). Dynamic columns need to be compatible with the table.
10821077
template <typename T, typename... Cs>
1083-
requires (soa::is_soa_table_like_v<T>)
1078+
requires(soa::is_soa_table_like_v<T>)
10841079
auto Attach(T const& table)
10851080
{
10861081
static_assert((framework::is_base_of_template_v<o2::soa::DynamicColumn, Cs> && ...), "You can only attach dynamic columns");
@@ -1089,13 +1084,13 @@ auto Attach(T const& table)
10891084
}
10901085

10911086
template <typename T, typename... Cs>
1092-
requires (framework::is_base_of_template_v<TableNG, T>)
1087+
requires(framework::is_base_of_template_v<TableNG, T>)
10931088
auto Attach(T const& table)
10941089
{
10951090
static_assert((framework::is_base_of_template_v<o2::soa::DynamicColumn, Cs> && ...), "You can only attach dynamic columns");
10961091
using output_t = JoinNG<T, o2::soa::TableNG<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Cs...>>;
10971092
return output_t{{table.asArrowTable()}, table.offset()};
10981093
}
1099-
} // namespace o2::soa
1094+
} // namespace o2::soa
11001095

1101-
#endif // o2_framework_AnalysisHelpers_H_DEFINED
1096+
#endif // o2_framework_AnalysisHelpers_H_DEFINED

Framework/Core/include/Framework/AnalysisManagers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ struct ServiceManager<Service<T>> {
582582

583583
static bool prepare(InitContext& context, Service<T>& service)
584584
{
585-
if constexpr (requires {T::instance();}) {
585+
if constexpr (requires { T::instance(); }) {
586586
service.service = &(T::instance()); // Sigh...
587587
return true;
588588
} else {
@@ -597,7 +597,7 @@ struct ServiceManager<Service<T>> {
597597
{
598598
// FIXME: for the moment we only need endOfStream to be
599599
// stateless. In the future we might want to pass it EndOfStreamContext
600-
if constexpr (requires {T::endOfStream();}) {
600+
if constexpr (requires { T::endOfStream(); }) {
601601
service.service->endOfStream();
602602
return true;
603603
}

Framework/Core/test/test_ASoA.cxx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ TEST_CASE("TestTableIterationNG")
234234
REQUIRE(*i == 1);
235235

236236
arrow::ChunkedArray* chunks[2] = {
237-
table->column(0).get(),
238-
table->column(1).get()};
237+
table->column(0).get(),
238+
table->column(1).get()};
239239
o2::aod::PointsNG::iterator tests(chunks, {table->num_rows(), 0});
240240
REQUIRE(tests.x() == 0);
241241
REQUIRE(tests.y() == 0);
@@ -745,10 +745,10 @@ TEST_CASE("TestConcatTablesNG")
745745
rowWriterD(0, 23, 15);
746746
auto tableD = builderD.finalize();
747747

748-
using TestA = InPlaceTableNG<0, o2::soa::Index<>, o2::aod::test::X, o2::aod::test::Y>;//o2::aod::TestA;
749-
using TestB = InPlaceTableNG<0, o2::soa::Index<>, o2::aod::test::X>;//o2::aod::TestB;
750-
using TestC = InPlaceTableNG<0, o2::aod::test::Z>;//o2::aod::TestC;
751-
using TestD = InPlaceTableNG<0, o2::aod::test::X, o2::aod::test::Z>;//o2::aod::TestD;
748+
using TestA = InPlaceTableNG<0, o2::soa::Index<>, o2::aod::test::X, o2::aod::test::Y>; // o2::aod::TestA;
749+
using TestB = InPlaceTableNG<0, o2::soa::Index<>, o2::aod::test::X>; // o2::aod::TestB;
750+
using TestC = InPlaceTableNG<0, o2::aod::test::Z>; // o2::aod::TestC;
751+
using TestD = InPlaceTableNG<0, o2::aod::test::X, o2::aod::test::Z>; // o2::aod::TestD;
752752
using ConcatTest = ConcatNG<TestA, TestB>;
753753
using JoinedTest = JoinNG<TestA, TestC>;
754754
using NestedJoinTest = JoinNG<JoinedTest, TestD>;
@@ -765,7 +765,7 @@ TEST_CASE("TestConcatTablesNG")
765765

766766
static_assert(std::is_same_v<NestedConcatTest::columns_t, o2::framework::pack<o2::aod::test::X>>, "Bad nested concat");
767767

768-
// Hardcode a selection for the first 5 odd numbers
768+
// Hardcode a selection for the first 5 odd numbers
769769
using FilteredTest = FilteredNG<TestA>;
770770
using namespace o2::framework;
771771
expressions::Filter testf = (o2::aod::test::x == 1) || (o2::aod::test::x == 3);
@@ -1110,7 +1110,7 @@ TEST_CASE("TestFilteredOperatorsNG")
11101110
auto tableA = builderA.finalize();
11111111
REQUIRE(tableA->num_rows() == 8);
11121112

1113-
using TestA = InPlaceTableNG<0, o2::soa::Index<>, o2::aod::test::X, o2::aod::test::Y>; //o2::soa::Table<OriginEnc{"AOD"}, o2::soa::Index<>, o2::aod::test::X, o2::aod::test::Y>;
1113+
using TestA = InPlaceTableNG<0, o2::soa::Index<>, o2::aod::test::X, o2::aod::test::Y>; // o2::soa::Table<OriginEnc{"AOD"}, o2::soa::Index<>, o2::aod::test::X, o2::aod::test::Y>;
11141114
using FilteredTest = FilteredNG<TestA>;
11151115
using namespace o2::framework;
11161116

@@ -1284,11 +1284,11 @@ TEST_CASE("TestNestedFilteringNG")
12841284
TEST_CASE("TestEmptyTables")
12851285
{
12861286
TableBuilder bPoints;
1287-
[[maybe_unused]]auto pwriter = bPoints.cursor<o2::aod::Points>();
1287+
[[maybe_unused]] auto pwriter = bPoints.cursor<o2::aod::Points>();
12881288
auto pempty = bPoints.finalize();
12891289

12901290
TableBuilder bInfos;
1291-
[[maybe_unused]]auto iwriter = bInfos.cursor<o2::aod::Infos>();
1291+
[[maybe_unused]] auto iwriter = bInfos.cursor<o2::aod::Infos>();
12921292
auto iempty = bInfos.finalize();
12931293

12941294
o2::aod::Points p{pempty};
@@ -1304,11 +1304,11 @@ TEST_CASE("TestEmptyTables")
13041304
TEST_CASE("TestEmptyTablesNG")
13051305
{
13061306
TableBuilder bPoints;
1307-
[[maybe_unused]]auto pwriter = bPoints.cursor<o2::aod::PointsNG>();
1307+
[[maybe_unused]] auto pwriter = bPoints.cursor<o2::aod::PointsNG>();
13081308
auto pempty = bPoints.finalize();
13091309

13101310
TableBuilder bInfos;
1311-
[[maybe_unused]]auto iwriter = bInfos.cursor<o2::aod::InfosNG>();
1311+
[[maybe_unused]] auto iwriter = bInfos.cursor<o2::aod::InfosNG>();
13121312
auto iempty = bInfos.finalize();
13131313

13141314
o2::aod::PointsNG p{pempty};
@@ -1777,7 +1777,7 @@ namespace o2::aod
17771777
{
17781778
DECLARE_SOA_TABLE(PointsSelfRef, "TEST", "PTSSR", test::OtherPointId, test::PointSeqIdSlice, test::PointSetIds);
17791779
DECLARE_SOA_TABLE_NG(PointsSelfRefNG, "TEST", "PTSSR", test::OtherPointId, test::PointSeqIdSlice, test::PointSetIds);
1780-
}
1780+
} // namespace o2::aod
17811781

17821782
TEST_CASE("TestSelfIndexRecursion")
17831783
{

0 commit comments

Comments
 (0)