LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
compare_to_range Struct Reference

Public Member Functions

 compare_to_range (int a, int b)
 
bool operator() (int i, int j)
 

Public Attributes

int a
 
int b
 

Detailed Description

Definition at line 230 of file CornerFinderAlg.cxx.

Constructor & Destructor Documentation

compare_to_range::compare_to_range ( int  a,
int  b 
)
inline

Definition at line 232 of file CornerFinderAlg.cxx.

233  {
234  this->a = a;
235  this->b = b;
236  }

Member Function Documentation

bool compare_to_range::operator() ( int  i,
int  j 
)
inline

Definition at line 237 of file CornerFinderAlg.cxx.

References util::abs().

238  {
239 
240  int mid = (b - a) / 2 + a;
241  if (i >= a && i <= b && j >= a && j <= b)
242  return std::abs(mid - i) < std::abs(mid - j);
243 
244  else if (j >= a && j <= b && (i < a || i > b))
245  return false;
246 
247  else if (i >= a && i <= b && (j < a || j > b))
248  return true;
249 
250  else
251  return true;
252  }
constexpr auto abs(T v)
Returns the absolute value of the argument.

Member Data Documentation

int compare_to_range::a

Definition at line 254 of file CornerFinderAlg.cxx.

int compare_to_range::b

Definition at line 255 of file CornerFinderAlg.cxx.


The documentation for this struct was generated from the following file: