122 std::vector<sbn::PCAngle> ret;
124 std::cout <<
"Flattening angles for branch: " << i_branch <<
" plane: " << plane.plane.Plane <<
" hierarchy: ";
125 for (
int id: plane.branchHierarchy[i_branch])
std::cout <<
id <<
" ";
129 for (
unsigned i_branch_hierarchy = 0; i_branch_hierarchy < plane.branchHierarchy[i_branch].size(); i_branch_hierarchy++) {
131 unsigned this_branch =
std::distance(plane.branchIDs.begin(), std::find(plane.branchIDs.begin(), plane.branchIDs.end(), plane.branchHierarchy[i_branch][i_branch_hierarchy]));
132 if (this_branch == plane.branchIDs.size()) {
136 std::cout <<
"BRANCH CHECK: " << plane.branchHierarchy[i_branch][i_branch_hierarchy] <<
" " << this_branch <<
" " << i_branch << std::endl;
137 for (
int i = plane.angles[this_branch].size()-1; i >= 0; i--) {
139 bool is_complete = (plane.angles[this_branch][i].complete || allow_incomplete) &&
140 plane.angles[this_branch][i].dist_to_lo > min_dist && plane.angles[this_branch][i].dist_to_hi > min_dist &&
141 plane.angles[this_branch][i].angle > -99.;
143 if (!is_complete)
continue;
146 bool found_hit =
false;
147 if (i_branch_hierarchy > 0) {
148 int i_check_branch_hierarchy = i_branch_hierarchy - 1;
149 unsigned chk_branch = plane.branchIDs.size();
150 int check_hitID = plane.angles[this_branch][i].hitID;
151 while (i_check_branch_hierarchy >= 0 && chk_branch == plane.branchIDs.size()) {
152 chk_branch =
std::distance(plane.branchIDs.begin(), std::find(plane.branchIDs.begin(), plane.branchIDs.end(), plane.branchHierarchy[i_branch][i_check_branch_hierarchy]));
153 i_check_branch_hierarchy --;
155 if (chk_branch < plane.branchIDs.size()) {
156 for (
unsigned j = 0; j < plane.angles[chk_branch].size(); j++) {
157 if (plane.angles[chk_branch][j].hitID == check_hitID) {
165 if (found_hit)
continue;
168 ret.push_back(plane.angles[this_branch][i]);
173 std::reverse(ret.begin(), ret.end());
176 unsigned n_branch_hits = 0;
177 for (
unsigned i = 0; i < plane.angles[i_branch].size(); i++) {
178 n_branch_hits += (plane.angles[i_branch][i].complete || allow_incomplete) &&
179 plane.angles[i_branch][i].dist_to_lo > min_dist && plane.angles[i_branch][i].dist_to_hi > min_dist &&
180 plane.angles[i_branch][i].angle > -99.;
184 unsigned branch_start = ret.size() - n_branch_hits;
185 return {ret, branch_start};
then if[["$THISISATEST"==1]]
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
BEGIN_PROLOG could also be cout