11 #include "TStopwatch.h" 23 throw CMTException(
"Default ctor needs # planes as an argument!");
81 std::vector<std::vector<size_t>>
85 if (!n || !r) exit(1);
88 std::vector<bool> v(n,
false);
90 std::vector<std::vector<size_t>> res;
94 std::vector<size_t>
tmp;
97 for (
size_t i = 0; i <
n; ++i) {
98 if (v[i]) tmp.push_back(i);
101 }
while (std::next_permutation(v.begin(), v.end()));
106 std::vector<std::vector<size_t>>
110 std::vector<size_t> ctr(seed.size(), 0);
112 std::vector<std::vector<size_t>> res;
116 res.push_back(std::vector<size_t>(seed.size(), 0));
121 for (
size_t i = 0; i < ctr.size(); ++i) {
123 size_t index = (size_t)(ctr.size() - i - 1);
127 if (ctr.at(index) < seed.at(index))
break;
133 for (
auto const&
value : ctr)
135 abort = abort && (!(
value));
142 std::vector<std::vector<std::pair<size_t, size_t>>>
146 std::vector<std::vector<std::pair<size_t, size_t>>>
result;
149 for (
size_t i = 0; i < seed.size(); ++i) {
152 if (seed.size() < 2 + i)
break;
158 for (
auto const& plane_comb : plane_comb_v) {
161 std::vector<size_t> cluster_seed_v;
162 cluster_seed_v.reserve(plane_comb.size());
163 for (
auto const&
index : plane_comb)
164 cluster_seed_v.push_back(seed[
index]);
170 result.push_back(
std::vector<std::pair<size_t, size_t>>());
171 for (
size_t i = 0; i < cluster_comb.size(); ++i)
173 (*result.rbegin()).
push_back(std::make_pair(plane_comb.at(i), cluster_comb.at(i)));
183 TStopwatch localWatch;
190 if (
_planes.size() < 2)
return false;
193 throw CMTException(
"Found more plane IDs than specified number of planes!");
196 std::vector<std::vector<size_t>> cluster_array;
199 cluster_array.reserve(
_planes.size());
205 for (
size_t plane = 0; plane <
_nplanes; ++plane) {
207 plane_to_index[plane] = cluster_array.size();
209 cluster_array.push_back(std::vector<size_t>());
215 cluster_array.at(plane_to_index.at(
_in_clusters.at((*riter).second).Plane()))
216 .push_back((*riter).second);
219 std::vector<size_t> seed;
220 seed.reserve(cluster_array.size());
221 for (
auto const& clusters_per_plane : cluster_array)
222 seed.push_back(clusters_per_plane.size());
227 for (
auto const& comb : combinations) {
229 std::vector<const cluster::ClusterParamsAlg*> ptr_v;
231 std::vector<unsigned int> tmp_index_v;
232 tmp_index_v.reserve(comb.size());
234 ptr_v.reserve(comb.size());
236 for (
auto const& plane_cluster : comb) {
237 auto const& in_cluster_index =
238 cluster_array.at(plane_cluster.first).at(plane_cluster.second);
240 tmp_index_v.push_back(in_cluster_index);
246 std::cout <<
" \033[93m" 247 <<
"Inspecting a pair (";
248 for (
auto const&
index : tmp_index_v)
249 std::cout <<
index <<
" ";
258 std::cout <<
" ... Time taken = " << localWatch.RealTime() <<
" [s]" <<
std::endl;
Class def header for a class CMatchBookKeeper.
Class def header for a class CFloatAlgoBase.
Class def header for a class CPriorityAlgoBase.
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
Class def header for exception classes in CMTException.
QTextStream & flush(QTextStream &s)
Class def header for a class CMatchManager.
Class def header for a class CMManagerBase.
QTextStream & endl(QTextStream &s)