1 #ifndef CALORECO_PHMAKEGROUPS_H
2 #define CALORECO_PHMAKEGROUPS_H
13 #include <boost/bind/bind.hpp>
14 #pragma GCC diagnostic push
15 #pragma GCC diagnostic ignored "-Wshadow"
16 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
17 #include <boost/graph/adjacency_list.hpp>
18 #include <boost/graph/connected_components.hpp>
19 #pragma GCC diagnostic pop
26 std::multimap<int, Hit>& groups)
28 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> Graph;
39 for (
unsigned int i = 0;
i < hits.size();
i++)
41 for (
unsigned int j =
i + 1;
j < hits.size();
j++)
43 if (hits[
i].is_adjacent(hits[
j])) add_edge(
i, j, G);
50 std::vector<int> component(num_vertices(G));
52 connected_components(G, &component[0]);
58 for (
unsigned int i = 0;
i < component.size();
i++)
60 comps.insert(component[
i]);
61 groups.insert(std::make_pair(component[i], hits[i]));