1 #ifndef RECOTOOL_CMATCHMANAGER_CXX 2 #define RECOTOOL_CMATCHMANAGER_CXX 10 throw CMTException(
"Default ctor needs # planes as an argument!");
58 {
return (n == 1 || n == 0) ? 1 :
CMFactorial(n - 1) *
n;}
65 std::vector<bool> v(n,
false);
67 std::vector<std::vector<size_t> > res;
71 std::vector<size_t>
tmp;
74 for(
size_t i=0; i<
n; ++i) {
if(v[i]) tmp.push_back(i); }
76 }
while (std::next_permutation(v.begin(),v.end()));
84 std::vector<size_t> ctr(seed.size(),0);
86 std::vector<std::vector<size_t> > res;
90 res.push_back(std::vector<size_t>(seed.size(),0));
91 for(
size_t index=0; index<ctr.size(); ++index)
93 (*res.rbegin())[index] = ctr.at(index);
95 for(
size_t i=0; i<ctr.size(); ++i) {
97 size_t index = (size_t)(ctr.size()-i-1);
101 if(ctr.at(index) < seed.at(index))
110 for(
auto const&
value : ctr)
112 abort = abort && (!(
value));
122 std::vector<std::vector<std::pair<size_t,size_t> > > result;
125 for(
size_t i=0; i<seed.size(); ++i) {
128 if(seed.size() < 2+i)
break;
134 for(
auto const& plane_comb : plane_comb_v){
137 std::vector<size_t> cluster_seed_v;
138 cluster_seed_v.reserve(plane_comb.size());
139 for(
auto const& index : plane_comb) cluster_seed_v.push_back(seed[index]);
145 result.push_back(
std::vector<std::pair<size_t,size_t> >());
146 for(
size_t i=0; i<cluster_comb.size(); ++i)
148 (*result.rbegin()).push_back(std::make_pair(plane_comb.at(i),cluster_comb.at(i)));
159 TStopwatch localWatch;
166 if(
_planes.size()<2)
return false;
170 throw CMTException(
"Found more plane IDs than specified number of planes!");
173 std::vector<std::vector<size_t> > cluster_array;
176 cluster_array.reserve(
_planes.size());
182 for(
size_t plane=0; plane<
_nplanes; ++plane){
186 plane_to_index[plane] = cluster_array.size();
188 cluster_array.push_back(std::vector<size_t>());
197 cluster_array.at( plane_to_index.at(
_in_clusters.at((*riter).second).Plane()) ).push_back((*riter).second);
200 std::vector<size_t>
seed;
201 seed.reserve(cluster_array.size());
202 for(
auto const& clusters_per_plane : cluster_array)
204 seed.push_back(clusters_per_plane.size());
209 for(
auto const& comb : combinations) {
211 std::vector<const cluster::ClusterParamsAlg*> ptr_v;
213 std::vector<unsigned int> tmp_index_v;
215 tmp_index_v.reserve(comb.size());
217 ptr_v.reserve(comb.size());
219 for(
auto const& plane_cluster : comb) {
221 auto const& in_cluster_index = cluster_array.at(plane_cluster.first).at(plane_cluster.second);
223 tmp_index_v.push_back(in_cluster_index);
233 <<
"Inspecting a pair (";
234 for(
auto const& index : tmp_index_v)
235 std::cout << index <<
" ";
236 std::cout<<
") \033[00m" << std::flush;
246 std::cout <<
" ... Time taken = " << localWatch.RealTime() <<
" [s]" << std::endl;
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
std::string value(boost::any const &)
Class def header for a class CMatchManager.