Skip to content

Instantly share code, notes, and snippets.

@vgenty
Created May 2, 2018 19:53
Show Gist options
  • Save vgenty/711c5be0e5511bc876e3a2d8b4aefcd3 to your computer and use it in GitHub Desktop.
Save vgenty/711c5be0e5511bc876e3a2d8b4aefcd3 to your computer and use it in GitHub Desktop.
std::vector< std::vector< larcv::Pixel2D > > RadialSegmentSearch::defineProjectedDiamondBoundary( const std::vector<float>& center3d, const std::vector<larcv:\
:Image2D>& img_v, const float radius ) {
// we define a rhombus around the center3d point.
// it is formed from the intersection of the U,V wires
// we also define the box around the enclosing Y-wires
const larcv::ImageMeta& meta = img_v.front().meta();
Double_t upstreampt[3] = {center3d[0],center3d[1],center3d[2]};
Double_t dnstreampt[3] = {center3d[0],center3d[1],center3d[2]};
upstreampt[2] -= radius;
dnstreampt[2] += radius;
// we get the U and V wire bounds
float wirebounds[3][2];
for (size_t p=0; p<img_v.size(); p++) {
wirebounds[p][0] = larutil::Geometry::GetME()->WireCoordinate( upstreampt, (larcv::PlaneID_t)p );
wirebounds[p][1] = larutil::Geometry::GetME()->WireCoordinate( dnstreampt, (larcv::PlaneID_t)p );
if ( wirebounds[p][0]<meta.min_x() ) wirebounds[p][0] = 0;
if ( wirebounds[p][1]>=meta.max_x() ) wirebounds[p][1] = meta.max_x()-1;
}
int colbounds[3][2] = {0};
for (size_t p=0; p<3; p++) {
colbounds[p][0] = meta.col( wirebounds[p][0] );
colbounds[p][1] = meta.col( wirebounds[p][1] );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment