11 #include "TStopwatch.h" 23 throw CMTException(
"Default ctor needs # planes as an argument!");
78 if (!n || !r) exit(1);
81 std::vector<bool> v(n,
false);
83 std::vector<std::vector<size_t>> res;
87 std::vector<size_t>
tmp;
90 for (
size_t i = 0; i <
n; ++i) {
91 if (v[i]) tmp.push_back(i);
94 }
while (std::next_permutation(v.begin(), v.end()));
102 std::vector<size_t> ctr(seed.size(), 0);
104 std::vector<std::vector<size_t>> res;
108 res.push_back(std::vector<size_t>(seed.size(), 0));
109 for (
size_t index = 0; index < ctr.size(); ++index)
111 (*res.rbegin())[index] = ctr.at(index);
113 for (
size_t i = 0; i < ctr.size(); ++i) {
115 size_t index = (size_t)(ctr.size() - i - 1);
119 if (ctr.at(index) < seed.at(index))
break;
125 for (
auto const&
value : ctr)
127 abort = abort && (!(
value));
135 const std::vector<size_t>&
seed)
138 std::vector<std::vector<std::pair<size_t, size_t>>> result;
141 for (
size_t i = 0; i < seed.size(); ++i) {
144 if (seed.size() < 2 + i)
break;
150 for (
auto const& plane_comb : plane_comb_v) {
153 std::vector<size_t> cluster_seed_v;
154 cluster_seed_v.reserve(plane_comb.size());
155 for (
auto const& index : plane_comb)
156 cluster_seed_v.push_back(seed[index]);
162 result.push_back(
std::vector<std::pair<size_t, size_t>>());
163 for (
size_t i = 0; i < cluster_comb.size(); ++i)
165 (*result.rbegin()).push_back(std::make_pair(plane_comb.at(i), cluster_comb.at(i)));
174 TStopwatch localWatch;
181 if (
_planes.size() < 2)
return false;
184 throw CMTException(
"Found more plane IDs than specified number of planes!");
187 std::vector<std::vector<size_t>> cluster_array;
190 cluster_array.reserve(
_planes.size());
196 for (
size_t plane = 0; plane <
_nplanes; ++plane) {
198 plane_to_index[plane] = cluster_array.size();
200 cluster_array.push_back(std::vector<size_t>());
206 cluster_array.at(plane_to_index.at(
_in_clusters.at((*riter).second).Plane()))
207 .push_back((*riter).second);
210 std::vector<size_t>
seed;
211 seed.reserve(cluster_array.size());
212 for (
auto const& clusters_per_plane : cluster_array)
213 seed.push_back(clusters_per_plane.size());
218 for (
auto const& comb : combinations) {
220 std::vector<const cluster::ClusterParamsAlg*> ptr_v;
222 std::vector<unsigned int> tmp_index_v;
223 tmp_index_v.reserve(comb.size());
225 ptr_v.reserve(comb.size());
227 for (
auto const& plane_cluster : comb) {
228 auto const& in_cluster_index =
229 cluster_array.at(plane_cluster.first).at(plane_cluster.second);
231 tmp_index_v.push_back(in_cluster_index);
237 std::cout <<
" \033[93m" 238 <<
"Inspecting a pair (";
239 for (
auto const& index : tmp_index_v)
240 std::cout << index <<
" ";
241 std::cout <<
") \033[00m" << std::flush;
249 std::cout <<
" ... Time taken = " << localWatch.RealTime() <<
" [s]" << std::endl;
Class def header for a class CMatchBookKeeper.
Class def header for a class CFloatAlgoBase.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Class def header for a class CPriorityAlgoBase.
Class def header for exception classes in CMTException.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
Class def header for a class CMatchManager.
Class def header for a class CMManagerBase.