forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdumpDataModel.cxx
More file actions
153 lines (138 loc) · 4.58 KB
/
dumpDataModel.cxx
File metadata and controls
153 lines (138 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "Framework/AnalysisDataModel.h"
#include "Analysis/SecondaryVertex.h"
#include "Analysis/Jet.h"
#include <fmt/printf.h>
#include <map>
using namespace o2::framework;
using namespace o2::aod;
using namespace o2::soa;
static int count = 0;
template <typename C>
void printColumn(char const* fg, char const* bg)
{
if constexpr (!is_index_column_v<C>) {
fmt::printf("<TR><TD color='%s' bgcolor='%s'>%s</TD></TR>", fg, bg, C::label());
}
}
template <typename C>
void printIndexColumn(char const* fg, char const* bg)
{
if constexpr (is_index_column_v<C>) {
fmt::printf("<TR><TD color='%s' bgcolor='%s'>%s</TD></TR>", fg, bg, C::label());
}
}
template <typename C, typename T>
void printIndex()
{
auto a = MetadataTrait<typename C::binding_t>::metadata::label();
auto b = MetadataTrait<T>::metadata::label();
fmt::printf("%s -> %s []\n", a, b);
}
template <typename... C>
void dumpColumns(pack<C...>, const char* fg, const char* bg)
{
(printColumn<C>(fg, bg), ...);
fmt::printf("%s", "\n");
}
template <typename... C>
void dumpIndexColumns(pack<C...>, char const* fg, char const* bg)
{
(printIndexColumn<C>(fg, bg), ...);
fmt::printf("%s", "\n");
}
template <typename T, typename... C>
void dumpIndex(pack<C...>)
{
(printIndex<C, T>(), ...);
fmt::printf("%s", "\n");
}
struct Style {
const char* color;
const char* background;
const char* fontcolor;
const char* headerfontcolor;
const char* headerbgcolor;
const char* methodcolor;
const char* methodbgcolor;
const char* indexcolor;
const char* indexbgcolor;
};
static Style styles[] = {
{"black", "gray80", "black", "black", "gray70", "black", "gray60", "black", "gray50"},
{"/reds9/2", "/reds9/4", "white", "white", "/reds9/7", "black", "/reds9/6", "/reds9/1", "/reds9/5"}};
Style const& getDefaultStyle()
{
return styles[0];
}
enum struct StyleType : int {
DEFAULT = 0,
RED = 1,
};
template <typename T>
void dumpTable(bool index = true, enum StyleType styleId = StyleType::DEFAULT)
{
auto style = styles[static_cast<int>(styleId)];
// nodes.push_back({MetadataTrait<T>::metadata::label(), nodeCount});
auto label = MetadataTrait<T>::metadata::label();
fmt::printf(R"(%s[color="%s" cellpadding="0" fillcolor="%s" fontcolor="%s" label = <
<TABLE cellpadding='2' cellspacing='0' cellborder='0' ><TH cellpadding='0' bgcolor="black"><TD bgcolor="%s"><font color="%s">%s</font></TD></TH>)",
label, style.color, style.background, style.fontcolor, style.headerbgcolor, style.headerfontcolor, label);
if (pack_size(typename T::iterator::persistent_columns_t{}) -
pack_size(typename T::iterator::external_index_columns_t{})) {
dumpColumns(typename T::iterator::persistent_columns_t{}, style.color, style.background);
fmt::printf("%s", "HR");
}
if (pack_size(typename T::iterator::dynamic_columns_t{})) {
dumpColumns(typename T::iterator::dynamic_columns_t{}, style.methodcolor, style.methodbgcolor);
fmt::printf("%s", "HR");
}
dumpIndexColumns(typename T::iterator::external_index_columns_t{}, style.indexcolor, style.indexbgcolor);
fmt::printf("%s", "</TABLE>\n>]\n");
if (index)
dumpIndex<T>(typename T::iterator::external_index_columns_t{});
}
template <typename... Ts>
void dumpCluster()
{
fmt::printf(R"(subgraph cluster_%d {
node[shape=plain,style=filled,fillcolor=gray95]
edge[dir=back, arrowtail=empty]
)",
count++);
(dumpTable<Ts>(false), ...);
fmt::printf("%s", "}\n");
(dumpIndex<Ts>(typename Ts::iterator::external_index_columns_t{}), ...);
}
int main(int argc, char** argv)
{
fmt::printf("%s", R"(digraph hierarchy {
size="5,5"
node[shape=plain,style=filled,fillcolor=gray95]
edge[dir=back, arrowtail=empty]
)");
dumpCluster<Tracks, TracksCov, TracksExtra>();
dumpTable<Collisions>();
dumpTable<Calos>();
dumpTable<CaloTriggers>();
dumpTable<Muons>();
dumpTable<MuonClusters>();
dumpTable<Zdcs>();
dumpTable<VZeros>();
dumpTable<V0s>();
dumpTable<Cascades>();
dumpTable<Timeframes>();
// dumpTable<SecVtx2Prong>(true, StyleType::RED);
dumpTable<Cand2Prong>(true, StyleType::RED);
dumpTable<Jets>();
dumpTable<JetConstituents>();
fmt::printf("%s\n", R"(})");
}