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)
61 if (!loopManager->fToJit.empty())
71 std::vector<std::shared_ptr<GraphNode>> leaves;
72 for (
auto action : actions) {
74 leaves.push_back(action->GetGraph());
80std::shared_ptr<GraphNode>
86 auto duplicateDefineIt = sColumnsMap.find(columnPtr);
87 if (duplicateDefineIt != sColumnsMap.end()) {
88 auto duplicateDefine = duplicateDefineIt->second.lock();
89 return duplicateDefine;
92 auto node = std::make_shared<GraphNode>(
"Define\n" + columnName);
95 sColumnsMap[columnPtr] = node;
103 auto duplicateFilterIt = sFiltersMap.find(filterPtr);
104 if (duplicateFilterIt != sFiltersMap.end()) {
105 auto duplicateFilter = duplicateFilterIt->second.lock();
106 duplicateFilter->SetIsNew(
false);
107 return duplicateFilter;
109 auto filterName = (filterPtr->
HasName() ? filterPtr->
GetName() :
"Filter");
110 auto node = std::make_shared<GraphNode>(filterName);
112 sFiltersMap[filterPtr] = node;
121 auto duplicateRangeIt = sRangesMap.find(rangePtr);
122 if (duplicateRangeIt != sRangesMap.end()) {
123 auto duplicateRange = duplicateRangeIt->second.lock();
124 duplicateRange->SetIsNew(
false);
125 return duplicateRange;
127 auto node = std::make_shared<GraphNode>(
"Range");
130 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 BuildJittedNodes()
Jit all actions that required runtime column type inference, and clean the fToJit member variable.
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.