1 #ifndef CALORECO_PHMAKEGROUPS_H
2 #define CALORECO_PHMAKEGROUPS_H
16 #include <boost/bind.hpp>
17 #include <boost/graph/adjacency_list.hpp>
18 #include <boost/graph/connected_components.hpp>
22 std::multimap<int, Hit>& groups)
24 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> Graph;
29 std::sort(hits.begin(), hits.end());
35 for (
unsigned int i = 0; i < hits.size(); i++)
37 for (
unsigned int j = i + 1; j < hits.size(); j++)
39 if (hits[i].is_adjacent(hits[j])) add_edge(i, j, G);
46 std::vector<int> component(num_vertices(G));
48 connected_components(G, &component[0]);
54 for (
unsigned int i = 0; i < component.size(); i++)
56 comps.insert(component[i]);
57 groups.insert(std::make_pair(component[i], hits[i]));