File indexing completed on 2025-08-06 08:10:21
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Detector/detail/BlueprintDrawer.hpp"
0010
0011 #include <vector>
0012
0013 namespace {
0014
0015
0016
0017
0018
0019 std::string shapeStr(
0020 const Acts::Experimental::detail::BlueprintDrawer::Options::Node& node) {
0021 return "[shape=\"" + node.shape + "\";style=\"filled\";fillcolor=\"" +
0022 node.color + "\"];";
0023 }
0024
0025
0026
0027
0028
0029
0030 std::string labelStr(
0031 const Acts::Experimental::detail::BlueprintDrawer::Options::Node& node,
0032 const std::string& label, const std::vector<std::string>& info = {}) {
0033 std::string lText = "[label=<<font face=\"";
0034 lText += node.face;
0035 lText += "\" point-size=\"";
0036 lText += std::to_string(node.labelText);
0037 lText += "\">" + label;
0038 if (!info.empty()) {
0039 lText += "</font><br/>";
0040 lText += "<font face=\"";
0041 lText += node.face;
0042 lText += "\" point-size=\"";
0043 lText += std::to_string(node.infoText);
0044 lText += "\">";
0045 for (const auto& i : info) {
0046 lText += i;
0047 lText += "<br/>";
0048 }
0049 }
0050 lText += "</font>";
0051 lText += ">];";
0052 return lText;
0053 }
0054
0055 }
0056
0057 void Acts::Experimental::detail::BlueprintDrawer::dotStream(
0058 std::ostream& ss, const Acts::Experimental::Blueprint::Node& node,
0059 const Options& options) {
0060
0061 if (node.isRoot()) {
0062 ss << "digraph " << options.graphName << " {" << '\n';
0063 ss << node.name << " " << labelStr(options.root, node.name, node.auxiliary)
0064 << '\n';
0065 ss << node.name << " " << shapeStr(options.root) << '\n';
0066
0067 } else if (node.isLeaf()) {
0068 ss << node.name << " " << labelStr(options.leaf, node.name, node.auxiliary)
0069 << '\n';
0070 ss << node.name << " "
0071 << ((node.internalsBuilder != nullptr) ? shapeStr(options.leaf)
0072 : shapeStr(options.gap))
0073 << '\n';
0074 } else {
0075 ss << node.name << " "
0076 << labelStr(options.branch, node.name, node.auxiliary) << '\n';
0077 ss << node.name << " " << shapeStr(options.branch) << '\n';
0078 }
0079
0080 for (const auto& c : node.children) {
0081 ss << node.name << " -> " << c->name << ";" << '\n';
0082 dotStream(ss, *c, options);
0083 }
0084
0085
0086 Options::Node shape = node.isLeaf() ? options.shape : options.virtualShape;
0087 ss << node.name + "_shape " << shapeStr(shape) << '\n';
0088 ss << node.name + "_shape "
0089 << labelStr(shape, VolumeBounds::s_boundsTypeNames[node.boundsType],
0090 {"t = " + toString(node.transform.translation(), 1),
0091 "b = " + toString(node.boundaryValues, 1)})
0092 << '\n';
0093 ss << node.name << " -> " << node.name + "_shape [ arrowhead = \"none\" ];"
0094 << '\n';
0095
0096
0097 if (node.internalsBuilder != nullptr) {
0098 ss << node.name + "_int " << shapeStr(options.internals) << '\n';
0099 ss << node.name << " -> " << node.name + "_int;" << '\n';
0100 }
0101
0102 if (node.geoIdGenerator != nullptr) {
0103 ss << node.name + "_geoID " << shapeStr(options.geoID) << '\n';
0104 ss << node.name << " -> " << node.name + "_geoID;" << '\n';
0105 }
0106
0107 if (node.rootVolumeFinderBuilder != nullptr) {
0108 ss << node.name + "_roots " << shapeStr(options.roots) << '\n';
0109 ss << node.name << " -> " << node.name + "_roots;" << '\n';
0110 }
0111
0112 if (node.isRoot()) {
0113 ss << "}" << '\n';
0114 }
0115 }