Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WireCell::RayGrid::Grouping Class Reference

#include <RaySolving.h>

Classes

struct  node_t
 

Public Types

typedef size_t ident_t
 
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, node_tgraph_t
 
typedef boost::graph_traits< graph_t >::vertex_descriptor vertex_t
 
typedef std::vector< node_tcluster_t
 
typedef std::unordered_map< int, cluster_tclusterset_t
 

Public Member Functions

 Grouping ()=default
 
virtual ~Grouping ()=default
 
virtual void add (char ntype, ident_t chid, std::vector< ident_t > wids, float value, float weight=1.0)
 
clusterset_t clusters ()
 
graph_tgraph ()
 

Private Member Functions

vertex_t wire_node (ident_t wid)
 

Private Attributes

graph_t m_graph
 
std::unordered_map< ident_t, vertex_tm_wid2vtx
 

Detailed Description

Definition at line 21 of file RaySolving.h.

Member Typedef Documentation

Definition at line 40 of file RaySolving.h.

typedef std::unordered_map<int, cluster_t> WireCell::RayGrid::Grouping::clusterset_t

Definition at line 41 of file RaySolving.h.

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, node_t> WireCell::RayGrid::Grouping::graph_t

Definition at line 33 of file RaySolving.h.

Definition at line 26 of file RaySolving.h.

typedef boost::graph_traits<graph_t>::vertex_descriptor WireCell::RayGrid::Grouping::vertex_t

Definition at line 34 of file RaySolving.h.

Constructor & Destructor Documentation

WireCell::RayGrid::Grouping::Grouping ( )
default
virtual WireCell::RayGrid::Grouping::~Grouping ( )
virtualdefault

Member Function Documentation

void RayGrid::Grouping::add ( char  ntype,
ident_t  chid,
std::vector< ident_t wids,
float  value,
float  weight = 1.0 
)
virtual

Definition at line 21 of file RaySolving.cxx.

22 {
23  vertex_t node = boost::add_vertex(m_graph);
24  m_graph[node].ntype = ntype;
25  m_graph[node].ident = chid;
26  m_graph[node].value = value;
27  m_graph[node].weight = weight;
28 
29  for (const auto wid : wids) {
30  auto wnode = wire_node(wid);
31  boost::add_edge(node, wnode, m_graph);
32  }
33 }
vertex_t wire_node(ident_t wid)
Definition: RaySolving.cxx:6
boost::graph_traits< graph_t >::vertex_descriptor vertex_t
Definition: RaySolving.h:34
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
weight
Definition: test.py:257
RayGrid::Grouping::clusterset_t RayGrid::Grouping::clusters ( )

Definition at line 36 of file RaySolving.cxx.

37 {
38  clusterset_t ret;
39 
40  std::unordered_map<vertex_t, int> stripes;
41  int nstripes = boost::connected_components(m_graph, boost::make_assoc_property_map(stripes));
42  if (!nstripes) {
43  return ret;
44  }
45 
46  for (auto& vci : stripes) {
47  vertex_t vtx = vci.first;
48  char ntype = m_graph[vtx].ntype;
49  if (ntype == 'w') {
50  continue;
51  }
52  const size_t stripe_index = vci.second;
53  ret[stripe_index].push_back(m_graph[vtx]);
54  }
55  return ret;
56 }
std::unordered_map< int, cluster_t > clusterset_t
Definition: RaySolving.h:41
boost::graph_traits< graph_t >::vertex_descriptor vertex_t
Definition: RaySolving.h:34
graph_t& WireCell::RayGrid::Grouping::graph ( )
inline

Definition at line 46 of file RaySolving.h.

46 { return m_graph; }
RayGrid::Grouping::vertex_t RayGrid::Grouping::wire_node ( ident_t  wid)
private

Definition at line 6 of file RaySolving.cxx.

7 {
8  auto it = m_wid2vtx.find(wid);
9  if (it != m_wid2vtx.end()) {
10  return it->second;
11  }
12  vertex_t node = boost::add_vertex(m_graph);
13  m_wid2vtx[wid] = node;
14  m_graph[node].ntype = 'w';
15  m_graph[node].ident = wid;
16  m_graph[node].value = 0.0;
17  m_graph[node].weight = 1.0;
18  return node;
19 }
std::unordered_map< ident_t, vertex_t > m_wid2vtx
Definition: RaySolving.h:50
boost::graph_traits< graph_t >::vertex_descriptor vertex_t
Definition: RaySolving.h:34

Member Data Documentation

graph_t WireCell::RayGrid::Grouping::m_graph
private

Definition at line 49 of file RaySolving.h.

std::unordered_map<ident_t, vertex_t> WireCell::RayGrid::Grouping::m_wid2vtx
private

Definition at line 50 of file RaySolving.h.


The documentation for this class was generated from the following files: