Belle II Software  release-05-01-25
DataFlowVisualization Class Reference

class to visualize data flow between modules. More...

#include <DataFlowVisualization.h>

Collaboration diagram for DataFlowVisualization:

Public Member Functions

 DataFlowVisualization (const DependencyMap *dependencyMap)
 Constructor.
 
void visualizePath (const std::string &filename, const Path &path)
 Create graphs with datastore inputs/outputs of each module in path. More...
 

Static Public Member Functions

static void executeModuleAndCreateIOPlot (const std::string &module)
 Create independent I/O graph for a single module (without requiring a steering file). More...
 

Private Member Functions

void generateModulePlot (std::ofstream &file, const Module &mod, bool steeringFileFlow=false)
 Create I/O graph for a single module (written to file).
 
bool checkArrayUnknown (const std::string &name, const DependencyMap::ModuleInfo &info)
 If the given array name isn't found in any of info's fields, it is added to m_unknownArrays (and true returned).
 

Static Private Member Functions

static void plotPath (std::ofstream &file, const Path &path, const std::string &pathName="")
 Create a subgraph for the given Path (including conditional paths).
 

Private Attributes

const DependencyMapm_map
 Stores information on inputs/outputs of each module, as obtained by require()/createEntry();.
 
std::set< std::string > m_allInputs
 set of all inputs (including optionals), for steering file visualisation.
 
std::set< std::string > m_allOutputs
 set of all outputs, for steering file visualisation.
 
std::set< std::string > m_unknownArrays
 set of array only being used in relations, for steering file visualisation.
 
std::string m_fillcolor [DependencyMap::c_NEntryTypes]
 fill colors.
 
std::string m_arrowcolor [DependencyMap::c_NEntryTypes]
 arrow colors.
 

Detailed Description

class to visualize data flow between modules.

Definition at line 34 of file DataFlowVisualization.h.

Member Function Documentation

◆ executeModuleAndCreateIOPlot()

void executeModuleAndCreateIOPlot ( const std::string &  module)
static

Create independent I/O graph for a single module (without requiring a steering file).

Output will be saved to ModuleName.dot.

Definition at line 167 of file DataFlowVisualization.cc.

168 {
169  // construct given module and gearbox
170  std::shared_ptr<Module> modulePtr = ModuleManager::Instance().registerModule(module);
171  std::shared_ptr<Module> gearboxPtr = ModuleManager::Instance().registerModule("Gearbox");
172 
173  // call initialize() method
174  //may throw some ERRORs, but that's OK.
175  // TODO:(ignore missing inputs)
176  gearboxPtr->initialize();
178  modulePtr->initialize();
179 
180  // create plot
181  const std::string filename = module + ".dot";
182  DataFlowVisualization v(&DataStore::Instance().getDependencyMap());
183  std::ofstream file(filename.c_str());
184  v.generateModulePlot(file, *modulePtr, false);
185 
186  //clean up to avoid problems with ~TROOT
187  modulePtr->terminate();
188  gearboxPtr->terminate();
189 }

◆ visualizePath()

void visualizePath ( const std::string &  filename,
const Path path 
)

Create graphs with datastore inputs/outputs of each module in path.

Parameters
filenamefile saved to (in DOT format).
pathPath to visualize.

Definition at line 40 of file DataFlowVisualization.cc.


The documentation for this class was generated from the following files:
Belle2::ModuleManager::registerModule
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
Definition: ModuleManager.cc:84
Belle2::Module::terminate
virtual void terminate()
This method is called at the end of the event processing.
Definition: Module.h:178
Belle2::DataStore::getDependencyMap
DependencyMap & getDependencyMap()
Return map of depedencies between modules.
Definition: DataStore.h:512
Belle2::ModuleManager::Instance
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
Definition: ModuleManager.cc:28
Belle2::DataStore::Instance
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
Belle2::DependencyMap::setModule
void setModule(const Module &mod)
Set the current module (for getCurrentModuleInfo())
Definition: DependencyMap.h:53
alignment.constraints_generator.filename
filename
File name.
Definition: constraints_generator.py:224
Belle2::DataFlowVisualization
class to visualize data flow between modules.
Definition: DataFlowVisualization.h:34
Belle2::Module::initialize
virtual void initialize()
Initialize the Module.
Definition: Module.h:111