10#ifndef XAOD_STANDALONE
21 const auto it = std::find(container.begin(), container.end(), toAdd);
22 if (it == container.end()) {
23 container.push_back(toAdd);
80 m_nodes.emplace_back( std::make_unique<NavGraphNode>(
node) );
84 if (comingFrom ==
nullptr) {
89 m_nodes.emplace_back( std::make_unique<NavGraphNode>(comingFrom) );
92 const bool newEdge = comingFromNodeObj->
linksTo( nodeObj );
105 std::vector<NavGraphNode*> returnVec;
106 returnVec.reserve(
m_nodes.size());
107 for (std::unique_ptr<NavGraphNode>& entry :
m_nodes) {
109 returnVec.push_back( &nodeObj );
125 std::vector<const Decision*> returnVec;
126 std::vector<std::unique_ptr<NavGraphNode>>
::iterator it;
128 if ((*it)->getKeep()) {
132 returnVec.push_back((*it)->node());
141 const std::vector<NavGraphNode*> myParents = toBeDeleted.
seeds();
142 const std::vector<NavGraphNode*> myChildren = toBeDeleted.
children();
147 bool newEdge = child->linksTo(parent);
156 child->dropLinks(&toBeDeleted);
160 parent->dropLinks(&toBeDeleted);
176 std::stringstream
ss;
177 for (
size_t i = 0; i < level; ++i) {
181 ss <<
"|-> " << nodeEL.
dataID() <<
" #" << nodeEL.
index() <<
" Name(" <<
node->
name() <<
") Passing(" <<
node->decisions().size() <<
")";
188#ifndef XAOD_STANDALONE
191 ss <<
" Feature(#" <<
index <<
", " << key <<
")";
197 log << msgLevel <<
ss.str() <<
endmsg;
a static registry of CLID->typeName entries.
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
ElementLink implementation for ROOT usage.
const ID_type & dataID() const
Get the key that we reference, as a string.
index_type index() const
Get the index of the element inside of its container.
Transient utility class to represent a node in a graph (m_decisionObject), and a vector of edges (m_f...
const std::vector< NavGraphNode * > & children() const
Return a vector of const pointers to the Decision object nodes which are the children of this NavGrap...
std::vector< NavGraphNode * > m_filteredSeeds
My seeds (edges in the graph), filtered on per-chain requirements.
const Decision * m_decisionObject
The Decision object node which I shadow.
static bool addIfNotDuplicate(std::vector< NavGraphNode * > &container, NavGraphNode *toAdd)
Internal helper function.
bool linksTo(NavGraphNode *to)
Form an edge in the graph from this node to another one.
void dropLinks(NavGraphNode *node)
Forget about any graph edges to the supplied node.
std::vector< NavGraphNode * > m_filteredChildren
Two-way linking information, used when thinning the graph.
bool m_keepFlag
Keep this node when slimming the NavGraph.
NavGraphNode(const Decision *me)
Construct a NavGraphNode shadowing a node in the full xAOD navigation graph.
void resetKeep()
Reset the keep flag to false upon finishing thinning.
void keep()
Flag this node as one to keep when the thin() operation is performed.
const std::vector< NavGraphNode * > & seeds() const
Return a vector of const pointers to the Decision object nodes which this NavGraphNode seeds from.
const Decision * node() const
Return a const pointer to the Decision object node which this NavGraphNode is shadowing.
std::vector< NavGraphNode * > allNodes()
Get all nodes.
void addNode(const Decision *node, const Decision *comingFrom=nullptr)
Add a new NavGraphNode which shadows the xAOD Decision object "node" from the full navigation graph.
std::vector< NavGraphNode * > m_finalNodes
Entry points into the navigation graph.
const std::vector< NavGraphNode * > & finalNodes() const
Get all final nodes.
std::map< const Decision *, size_t > m_nodePositionMap
Map of Decision pointer and index of the node(that contains the Decision) in m_nodes.
void printAllPaths(MsgStream &log, MSG::Level msgLevel=MSG::VERBOSE) const
Helper function.
void recursivePrintNavPath(const NavGraphNode &nav, size_t level, MsgStream &log, MSG::Level msgLevel) const
@bried Internal helper function.
std::vector< std::unique_ptr< NavGraphNode > > m_nodes
Vector of unique pointers to nodes in the graph.
size_t m_edges
Statistics on the number of edges, connecting the nodes in the graph.
std::vector< const Decision * > thin()
Perform thinning.
void rewireNodeForRemoval(NavGraphNode &toBeDeleted)
Take all seeds (parents) of the supplied node and connect them to all the node's children.
void name(const std::string &n)
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
const std::string & viewString()
xAOD::TrigComposite Decision
const std::string & roiString()
const std::string & featureString()
const std::string & initialRoIString()
ElementLink< DecisionContainer > decisionToElementLink(const Decision *d, const EventContext &ctx)
Takes a raw pointer to a Decision and returns an ElementLink to the Decision.
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.