6namespace GraphDrawing {
11 std::stringstream dotStringLabels;
13 std::stringstream dotStringGraph;
17 dotStringLabels <<
"\t" << leaf->fCounter <<
" [label=\"" << leaf->fName <<
"\", style=\"filled\", fillcolor=\""
18 << leaf->fColor <<
"\", shape=\"" << leaf->fShape <<
"\"];\n";
19 if (leaf->fPrevNode) {
20 dotStringGraph <<
"\t" << leaf->fPrevNode->fCounter <<
" -> " << leaf->fCounter <<
";\n";
22 leaf = leaf->fPrevNode;
25 return "digraph {\n" + dotStringLabels.str() + dotStringGraph.str() +
"}";
31 std::stringstream dotStringLabels;
33 std::stringstream dotStringGraph;
35 for (
auto leaf : leaves) {
36 while (leaf && !leaf->fIsExplored) {
37 dotStringLabels <<
"\t" << leaf->fCounter <<
" [label=\"" << leaf->fName
38 <<
"\", style=\"filled\", fillcolor=\"" << leaf->fColor <<
"\", shape=\"" << leaf->fShape
40 if (leaf->fPrevNode) {
41 dotStringGraph <<
"\t" << leaf->fPrevNode->fCounter <<
" -> " << leaf->fCounter <<
";\n";
44 leaf->fIsExplored =
true;
45 leaf = leaf->fPrevNode;
48 return "digraph {\n" + dotStringLabels.str() + dotStringGraph.str() +
"}";
52 const std::shared_ptr<ROOT::Detail::RDF::RCustomColumnBase> &column)
70 std::vector<std::shared_ptr<GraphNode>> leaves;
71 for (
auto action : actions) {
73 leaves.push_back(action->GetGraph());
79std::shared_ptr<GraphNode>
85 auto duplicateDefineIt = sColumnsMap.find(columnPtr);
86 if (duplicateDefineIt != sColumnsMap.end()) {
87 auto duplicateDefine = duplicateDefineIt->second.lock();
88 return duplicateDefine;
91 auto node = std::make_shared<GraphNode>(
"Define\n" + columnName);
94 sColumnsMap[columnPtr] = node;
102 auto duplicateFilterIt = sFiltersMap.find(filterPtr);
103 if (duplicateFilterIt != sFiltersMap.end()) {
104 auto duplicateFilter = duplicateFilterIt->second.lock();
105 duplicateFilter->SetIsNew(
false);
106 return duplicateFilter;
108 auto filterName = (filterPtr->
HasName() ? filterPtr->
GetName() :
"Filter");
109 auto node = std::make_shared<GraphNode>(filterName);
111 sFiltersMap[filterPtr] = node;
120 auto duplicateRangeIt = sRangesMap.find(rangePtr);
121 if (duplicateRangeIt != sRangesMap.end()) {
122 auto duplicateRange = duplicateRangeIt->second.lock();
123 duplicateRange->SetIsNew(
false);
124 return duplicateRange;
126 auto node = std::make_shared<GraphNode>(
"Range");
129 sRangesMap[rangePtr] = node;
std::string GetName() const
The head node of a RDF computation graph.
std::vector< RDFInternal::RActionBase * > GetAllActions()
For all the actions, either booked or run.
void Jit()
Add RDF nodes that require just-in-time compilation to the computation graph.
static ColumnsNodesMap_t & GetStaticColumnsMap()
Stores the columns defined and which node in the graph defined them.
static FiltersNodesMap_t & GetStaticFiltersMap()
Stores the filters defined and which node in the graph defined them.
std::string FromGraphLeafToDot(std::shared_ptr< GraphNode > leaf)
Starting from any leaf (Action, Filter, Range) it draws the dot representation of the branch.
std::string FromGraphActionsToDot(std::vector< std::shared_ptr< GraphNode > > leaves)
Starting by an array of leaves, it draws the entire graph.
std::string RepresentGraph(ROOT::RDataFrame &rDataFrame)
Starting from the root node, prints the entire graph.
static RangesNodesMap_t & GetStaticRangesMap()
Stores the ranges defined and which node in the graph defined them.
RLoopManager * GetLoopManager() const
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
bool CheckIfDefaultOrDSColumn(const std::string &name, const std::shared_ptr< ROOT::Detail::RDF::RCustomColumnBase > &column)
std::shared_ptr< GraphNode > CreateRangeNode(const ROOT::Detail::RDF::RRangeBase *rangePtr)
std::shared_ptr< GraphNode > CreateDefineNode(const std::string &columnName, const ROOT::Detail::RDF::RCustomColumnBase *columnPtr)
std::shared_ptr< GraphNode > CreateFilterNode(const ROOT::Detail::RDF::RFilterBase *filterPtr)
bool IsInternalColumn(std::string_view colName)
Namespace for new ROOT classes and functions.