All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HoughBaseAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // HoughBaseAlg.h
3 //
4 // HoughBaseAlg class
5 //
6 // Ben Carls (bcarls@fnal.gov)
7 // Some optimization by Gianluca Petrillo (petrillo@fnal.gov)
8 //
9 // Hough transform algorithm
10 // ============================================================================
11 //
12 // This implementation is a pattern recognition algorithm trying to detect
13 // straight lines in a image.
14 // In our application, the image is a hitmap on a wire plane, represented by
15 // wire number as one coordinate and drift time as the other.
16 // For each hit coordinate, all straight lines through that coordinate are
17 // recorded on counters, one for each line. If a counter rises to two, it
18 // mesans that there are two hits who can cast that line, i.e. there are two
19 // hits on that line.
20 // A line can be represented by two independent parameters, therefore we need a
21 // two-dimension parameter space to represent all of them (two degrees of
22 // freedom).
23 // Since there are infinite straight lines, each counter represents not just
24 // one line but a small region of parameter space.
25 // Passing by one point constraints one of the two parameters, therefore the
26 // parameter set of a generic line passing by a given point has one degree of
27 // freedom.
28 // We follow the custom of choosing as parameters of an arbitrary line passing
29 // through a point (x, y) the angle (from "x" axis) of the line, and the
30 // distance of the line from the chosen point. Fixing the point, we can assign
31 // freedom to the angle (that has a limited range by definition) and then
32 // the distance will be defined by some functional form d(angle).
33 // The shape (d vs. a) of the set of parameters of all lines passing by a point
34 // is a sinusoidal curve. We can define the angle to be between 0 and pi
35 // (half a period) and the distance potentially covers the whole real axis
36 // (but actually it will be never larger than the distance of the selected
37 // point from the origin).
38 //
39 // The implementation of the algorithm is based on a "accumulator", the set
40 // of counters of how many hits are passed by a given line (represented by
41 // its tow parameters). The accumulator is a two-dimensional container of
42 // counters, with the first dimension given by the angle and the second by the
43 // distance.
44 // In this scenario, all angles are sampled, therefore each angle will have
45 // at least one count per hit (somewhere at some distance d).
46 // Each angle will see one entry per hit.
47 // We choose to have a large number of sampled angles (the current standard
48 // configuration says 10800), therefore most of the counters will be empty.
49 // The sinusoidal shape can be steep enough that got example the angle a(1)
50 // has d(a1)=30 and the next angle (a2) has d(a2)=50. In this case we cover
51 // also the distances between 31 and 50, (assigning them, as an approximation,
52 // to a2). In this way we don't leave gaps and make sure that each two
53 // sinusoidal curves cross in at least one point, or, equivalently, that we
54 // can always find at least one straight line throw any two points.
55 // This translates in having very often the counts at a given angle clustered
56 // around some distances.
57 //
58 // We need to discretize the angles and the distances. Tests show that for a
59 // "natural" plane size of 9600 (TDC counts) x ~3000 (wires), we need to use
60 // O(10000) angles and to oversample the distance, that typically goes in the
61 // range [0-10000], by some factor (5 in the default parameters).
62 // The oversampling factor is just an artifact of the fact that we use integral
63 // distances but we want to have a resolution better than "1" -- we just
64 // multiply the distance by e.g. 5 and we get that the distace "1" actually
65 // means 1/5 = 0.2.
66 // Note that the algorithm is usually applied to subsets of that plane rather
67 // than on the full plane, making the typical distance range somehow smaller.
68 //
69 // The fastest data structure for the accumulator is a two-dimensional array.
70 // The proper size of this array would be some gigabyte, that makes this
71 // approach unfeasible. Since the dimension of angles has a very clear number
72 // of "bins" (covering always a fixed 0-pi range), but for each given angle
73 // the counters actually used are a few, a sparse structure (associative
74 // container, or "map") is used to describe all the counters at a given angle,
75 // with key the parameter r (discretized).
76 // Since all the angles always have data, the outer container is a vector
77 // whose index is the parameter a (also discretized).
78 // Therefore, for a given line (a, r), we can find how many hits pass though
79 // it by finding the associative container of the angle a from a vector,
80 // and in there looking for an entry with d as key: accum[a][d].
81 //
82 // Optimization
83 // ----------------------------------------------------------------------------
84 //
85 // Given the constraints and data structure described above, it turns out that
86 // a lot of time is spent creating new counters. On each hit, and each angle,
87 // one or more elements of the associative containers must be created.
88 // In total, millions of counter instances ar used at once.
89 // The standard C++ implementation of it, std::map, dynamically a new node
90 // each time a new counter is required, and in the end it frees them one by
91 // one. Both operations are very time-demanding.
92 // We used a custom memory allocator (BulkAllocator) that prepares memory
93 // for chunks of nodes and then returns a preallocated space at each request
94 // for a new node. The allocator is designed to be fast, giving up features:
95 // nodes are never really freed, that saves a lot of book-keeping.
96 // A lot of tricky aspects of it are documented in its own header file.
97 // Also freeing the memory is fast, since it implies the deletion of a few
98 // (very large) chunks rather than millions.
99 // The other aspect taking a lot of time is the lookup of a counter: where is
100 // counter (a,d)? the location of a is fast (constant time, from a vector).
101 // The location of d is the next best thing, a binary tree with log(N) access
102 // time. Unfortunately a balanced tree needs to be rebalanced often, and that
103 // takes a lot of time. Also, N may be "small" (O(1000)), but there are still
104 // million insertions and look ups.
105 // We use here a replacement of the plain map. Since it often happens that,
106 // to "fill the gaps", sequential counters are allocated and increased,
107 // we have blocks of couners allocated together (in the current version, 64
108 // of them). This can save memory in case of crowded spaces: the overhead
109 // for each node is 40 bytes, whether it is a single counter or a block of
110 // 64). Look up within the same block becomes constant-time.
111 // Also, to access sequences of counters, special code is used so that we
112 // take advantage of the result from the previous look up to perform the next
113 // one, including also the insertion of a new counter block after an existing
114 // one.
115 // Finally, the algorithm acts when it finds a relatively small number of
116 // aligned hits, afterward removing the hits already clustered. The hit count
117 // keeps small all the time: we use a signed char as basic data type for
118 // the counters, allowing a maximum of 127 aligned hits. This saves a lot of
119 // memory, at the cost of a small slow-down for large (e.g. 64-bit) bus
120 // architectures. No check is performed for overflow; that can also be
121 // implemented at a small cost.
122 //
123 //
124 ////////////////////////////////////////////////////////////////////////
125 #ifndef HOUGHBASEALG_H
126 #define HOUGHBASEALG_H
127 
128 #include <array>
129 #include <map>
130 #include <memory> // std::allocator<>
131 #include <string>
132 #include <utility> // std::pair<>
133 #include <vector>
134 
135 namespace art {
136  class Event;
137 }
138 #include "canvas/Persistency/Common/Ptr.h"
139 #include "canvas/Persistency/Common/PtrVector.h"
140 namespace fhicl {
141  class ParameterSet;
142 }
143 
145 
146 namespace CLHEP {
147  class HepRandomEngine;
148 }
149 namespace detinfo {
150  class DetectorClocksData;
151  class DetectorPropertiesData;
152 }
154 #include "lardataobj/RecoBase/Hit.h"
155 
156 struct houghCorner {
157  double strength = 0;
158  double p0 = 0;
159  double p1 = 0;
160  houghCorner(double strengthTemp = 0, double p0Temp = 0, double p1Temp = 0)
161  {
162  strength = strengthTemp;
163  p0 = p0Temp;
164  p1 = p1Temp;
165  }
166 
167  bool
168  operator<(const houghCorner& houghCornerComp) const
169  {
170  return (strength < houghCornerComp.strength);
171  }
172 };
173 
174 // This stores information about merged lines
175 struct mergedLines {
176  double totalQ = 0;
177  double pMin0 = 0;
178  double pMin1 = 0;
179  double pMax0 = 0;
180  double pMax1 = 0;
181  int clusterNumber = -999999;
182  double showerLikeness = 0;
183  mergedLines(double totalQTemp = 0,
184  double pMin0Temp = 0,
185  double pMin1Temp = 0,
186  double pMax0Temp = 0,
187  double pMax1Temp = 0,
188  double clusterNumberTemp = -999999,
189  double showerLikenessTemp = 0)
190  {
191  totalQ = totalQTemp;
192  pMin0 = pMin0Temp;
193  pMin1 = pMin1Temp;
194  pMax0 = pMax0Temp;
195  pMax1 = pMax1Temp;
196  clusterNumber = clusterNumberTemp;
197  showerLikeness = showerLikenessTemp;
198  }
199 };
200 
201 struct protoTrack {
202  int clusterNumber = 999999;
203  int planeNumber = 999999;
204  int oldClusterNumber = 999999;
205  float clusterSlope = 999999;
206  float clusterIntercept = 999999;
207  float totalQ = -999999;
208  float pMin0 = 999999;
209  float pMin1 = 999999;
210  float pMax0 = -999999;
211  float pMax1 = -999999;
212  float iMinWire = 999999;
213  float iMaxWire = -999999;
214  float minWire = 999999;
215  float maxWire = -999999;
216  float isolation = -999999;
217  float showerLikeness = -999999;
218  bool merged = false;
219  bool showerMerged = false;
220  bool mergedLeft = false;
221  bool mergedRight = false;
222  std::vector<art::Ptr<recob::Hit>> hits;
224 
225  void
226  Init(unsigned int num = 999999,
227  unsigned int pnum = 999999,
228  float slope = 999999,
229  float intercept = 999999,
230  float totalQTemp = -999999,
231  float Min0 = 999999,
232  float Min1 = 999999,
233  float Max0 = -999999,
234  float Max1 = -999999,
235  int iMinWireTemp = 999999,
236  int iMaxWireTemp = -999999,
237  int minWireTemp = 999999,
238  int maxWireTemp = -999999,
239  std::vector<art::Ptr<recob::Hit>> hitsTemp = std::vector<art::Ptr<recob::Hit>>())
240  {
241  clusterNumber = num;
242  planeNumber = pnum;
243  oldClusterNumber = num;
244  clusterSlope = slope;
245  clusterIntercept = intercept;
246  totalQ = totalQTemp;
247  pMin0 = Min0;
248  pMin1 = Min1;
249  pMax0 = Max0;
250  pMax1 = Max1;
251  iMinWire = iMinWireTemp;
252  iMaxWire = iMaxWireTemp;
253  minWire = minWireTemp;
254  maxWire = maxWireTemp;
255  merged = false;
256  showerMerged = false;
257  showerLikeness = 0;
258  hits.swap(hitsTemp);
259  }
260 };
261 
262 namespace cluster {
263 
264  /**
265  * @brief CountersMap with access optimized for Hough Transform algorithm
266  * @param KEY the type of the key of the counters map
267  * @param COUNTER the type of a basic counter (can be signed or unsigned)
268  * @param BLOCKSIZE the number of counters in a cluster
269  * @param ALLOC allocator for the underlying STL map
270  * @param SUBCOUNTERS split each counter in subcounters (not implemented yet)
271  * @see CountersMap
272  *
273  * In addition to the standard CountersMap interface, a special range
274  * increment, increment with max detection and decrement methods are provided.
275  */
276  template <typename KEY,
277  typename COUNTER,
278  size_t SIZE,
279  typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>,
280  unsigned int SUBCOUNTERS = 1>
281  class HoughTransformCounters : public lar::CountersMap<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS> {
282  public:
283  /// This class
285  /// Base class
287 
288  // import useful types
289  using BaseMap_t = typename Base_t::BaseMap_t;
291  using Key_t = typename Base_t::Key_t;
295 
296  /// Pair identifying a counter and its current value
297  using PairValue_t = std::pair<const_iterator, SubCounter_t>;
298 
299  /// Default constructor (empty map)
301 
302  /// Constructor, specifies an allocator
304 
305  /**
306  * @brief Sets the specified counter to a count value
307  * @param key key of the counter to be set
308  * @param value the count value
309  * @return new value of the counter
310  */
313  {
314  return Base_t::set(key, value);
315  }
316 
317  /**
318  * @brief Increments by 1 the specified counter
319  * @param key key of the counter to be increased
320  * @return new value of the counter
321  */
324  {
325  return Base_t::increment(key);
326  }
327 
328  /**
329  * @brief Decrements by 1 the specified counter
330  * @param key key of the counter to be decreased
331  * @return new value of the counter
332  */
335  {
336  return Base_t::decrement(key);
337  }
338 
339  /**
340  * @brief Sets the specified range of counters to a count value
341  * @param key_begin key of the first counter to be set
342  * @param key_end key of the first counter not to be set
343  * @param value the count value
344  * @return new value of all the counters
345  * @see increment(), decrement(), increment_and_get_max()
346  */
348  set(Key_t key_begin, Key_t key_end, SubCounter_t value)
349  {
350  return unchecked_set_range(key_begin, key_end, value);
351  }
352 
353  /**
354  * @brief Increments by 1 the specified range of counters
355  * @param key_begin key of the first counter to be increased
356  * @param key_end key of the first counter not to be increased
357  * @see decrement(), increment_and_get_max()
358  */
359  void increment(Key_t key_begin, Key_t key_end);
360 
361  /**
362  * @brief Increments by 1 the specified counters and returns the maximum
363  * @param key_begin key of the first counter to be increased
364  * @param key_end key of the first counter not to be increased
365  * @return pair with an iterator to the largest counter and its value
366  * @see increment(Key_t, Key_t)
367  *
368  * This method works like the corresponding increment() method, and in
369  * addition it returns the location of the counter with the largest count
370  * (after the increase).
371  * The return value consist of a pair: the second is the largest counter
372  * value in the range after the increase, the first member is the constant
373  * iterator pointing to the first (lowest key) counter with that (get its
374  * key with const_iterator::key() method).
375  *
376  * If no maximum is found, the maximum in the return value is equal to
377  * current_max, while the iterator points to the end of the map (end()).
378  * Note that if all the counters are at the minimum possible value, no
379  * maximum will be returned.
380  */
382  increment_and_get_max(Key_t key_begin, Key_t key_end)
383  {
384  return unchecked_add_range_max(key_begin, key_end, +1);
385  }
386 
387  /**
388  * @brief Increments by 1 the specified counters and returns the maximum
389  * @param key_begin key of the first counter to be increased
390  * @param key_end key of the first counter not to be increased
391  * @param current_max only counters larger than this will be considered
392  * @return pair with an iterator to the largest counter and its value
393  * @see increment(Key_t, Key_t), increment_and_get_max(Key_t, Key_t)
394  *
395  * This method works like increment_and_get_max() method, except that it
396  * does not update the maximum if it's not (strictly) larger than
397  * current_max. If no such a maximum is found, the maximum in the return
398  * value is equal to current_max, while the iterator points to the end of
399  * the map (end()).
400  */
402  increment_and_get_max(Key_t key_begin, Key_t key_end, SubCounter_t current_max)
403  {
404  return unchecked_add_range_max(key_begin, key_end, +1, current_max);
405  }
406 
407  /**
408  * @brief Decrements by 1 the specified range of counters
409  * @param key_begin key of the first counter to be increased
410  * @param key_end key of the first counter not to be increased
411  * @see increment()
412  */
413  void decrement(Key_t key_begin, Key_t key_end);
414 
415  /**
416  * @brief Returns the largest counter
417  * @param current_max only counters larger than this will be considered
418  * @return pair with an iterator to the largest counter and its value
419  * @see get_max(), increment_and_get_max(Key_t, Key_t)
420  *
421  * All counters are parsed, and the first one with the largest count
422  * is returned.
423  * The return value consist of a pair: the second is the largest counter
424  * value, the first member is the constant iterator pointing to the first
425  * (lowest key) counter with that (get its key with const_iterator::key()
426  * method).
427  *
428  * This method does not update the maximum if it's not (strictly) larger
429  * than current_max. If no such a maximum is found, the maximum in the
430  * return value is equal to current_max, while the iterator points to the
431  * end of the map (end()).
432  */
433  PairValue_t get_max(SubCounter_t current_max) const;
434 
435  /**
436  * @brief Increments by 1 the specified counters and returns the maximum
437  * @param current_max only counters larger than this will be considered
438  * @return pair with an iterator to the largest counter and its value
439  * @see get_max(SubCounter_t), increment_and_get_max(Key_t, Key_t)
440  *
441  * This method works like get_max() method, except that it
442  * does not update the maximum if it's not (strictly) larger than
443  * current_max. If no such a maximum is found, the maximum in the return
444  * value is equal to current_max, while the iterator points to the end of
445  * the map (end()).
446  */
447  PairValue_t get_max() const;
448 
449  protected:
451 
452  private:
454  Key_t key_end,
456  typename BaseMap_t::iterator start);
459  Key_t key_begin,
460  Key_t key_end,
461  SubCounter_t delta,
462  typename BaseMap_t::iterator start,
463  SubCounter_t min_max = std::numeric_limits<SubCounter_t>::min());
465  Key_t key_begin,
466  Key_t key_end,
467  SubCounter_t delta,
468  SubCounter_t min_max = std::numeric_limits<SubCounter_t>::min());
469 
470  }; // class HoughTransformCounters
471 
472  class HoughBaseAlg {
473  public:
474  /// Data structure collecting charge information to be filled in cluster
475  struct ChargeInfo_t {
476  float integral = 0.0F;
477  float integral_stddev = 0.0F;
478  float summedADC = 0.0F;
479  float summedADC_stddev = 0.0F;
480 
481  ChargeInfo_t(float in, float in_stdev, float sum, float sum_stdev)
482  : integral(in), integral_stddev(in_stdev), summedADC(sum), summedADC_stddev(sum_stdev)
483  {}
484  }; // ChargeInfo_t
485 
486  explicit HoughBaseAlg(fhicl::ParameterSet const& pset);
487  virtual ~HoughBaseAlg() = default;
488 
489  size_t FastTransform(const std::vector<art::Ptr<recob::Cluster>>& clusIn,
490  std::vector<recob::Cluster>& ccol,
491  std::vector<art::PtrVector<recob::Hit>>& clusHitsOut,
492  CLHEP::HepRandomEngine& engine,
493  art::Event const& evt,
494  std::string const& label);
495 
496  size_t Transform(const detinfo::DetectorClocksData& clockData,
498  std::vector<art::Ptr<recob::Hit>> const& hits,
499  CLHEP::HepRandomEngine& engine,
500  std::vector<unsigned int>* fpointId_to_clusterId,
501  unsigned int clusterId, // The id of the cluster we are examining
502  unsigned int* nClusters,
503  std::vector<protoTrack>* protoTracks);
504 
505  // interface to look for lines only on a set of hits,without slope and
506  // totalQ arrays
507  size_t FastTransform(detinfo::DetectorClocksData const& clockData,
509  std::vector<art::Ptr<recob::Hit>> const& clusIn,
510  std::vector<art::PtrVector<recob::Hit>>& clusHitsOut,
511  CLHEP::HepRandomEngine& engine);
512 
513  // interface to look for lines only on a set of hits
514  size_t FastTransform(detinfo::DetectorClocksData const& clockData,
516  std::vector<art::Ptr<recob::Hit>> const& clusIn,
517  std::vector<art::PtrVector<recob::Hit>>& clusHitsOut,
518  CLHEP::HepRandomEngine& engine,
519  std::vector<double>& slope,
520  std::vector<ChargeInfo_t>& totalQ);
521 
522  size_t Transform(std::vector<art::Ptr<recob::Hit>> const& hits);
523 
525  std::vector<art::Ptr<recob::Hit>> const& hits,
526  double& slope,
527  double& intercept);
528 
529  // FIXME: Is this necessary? Document or remove!
530  // 2022-04-18 CHG
531  friend class HoughTransformClus;
532 
533  private:
534  void HLSSaveBMPFile(char const*, unsigned char*, int, int);
535 
536  int fMaxLines; ///< Max number of lines that can be found
537  int fMinHits; ///< Min number of hits in the accumulator to consider
538  ///< (number of hits required to be considered a line).
539  int fSaveAccumulator; ///< Save bitmap image of accumulator for debugging?
540  int fNumAngleCells; ///< Number of angle cells in the accumulator
541  ///< (a measure of the angular resolution of the line finder).
542  ///< If this number is too large than the number of votes
543  ///< that fall into the "correct" bin will be small and consistent with noise.
544  float
545  fMaxDistance; ///< Max distance that a hit can be from a line to be considered part of that line
546  float fMaxSlope; ///< Max slope a line can have
547  int
548  fRhoZeroOutRange; ///< Range in rho over which to zero out area around previously found lines in the accumulator
549  int
550  fThetaZeroOutRange; ///< Range in theta over which to zero out area around previously found lines in the accumulator
551  float fRhoResolutionFactor; ///< Factor determining the resolution in rho
552  int
553  fPerCluster; ///< Tells the original Hough algorithm to look at clusters individually, or all hits
554  ///< at once
555  int
556  fMissedHits; ///< Number of wires that are allowed to be missed before a line is broken up into
557  ///< segments
558  float
559  fMissedHitsDistance; ///< Distance between hits in a hough line before a hit is considered missed
560  float
561  fMissedHitsToLineSize; ///< Ratio of missed hits to line size for a line to be considered a fake
562  };
563 
564 } // namespace
565 
566 #endif // HOUGHBASEALG_H
typename Base_t::SubCounter_t SubCounter_t
Definition: HoughBaseAlg.h:292
double totalQ
Definition: HoughBaseAlg.h:176
typename Traits_t::CounterBlock_t CounterBlock_t
Definition: CountersMap.h:165
double showerLikeness
Definition: HoughBaseAlg.h:182
float fRhoResolutionFactor
Factor determining the resolution in rho.
Definition: HoughBaseAlg.h:551
process_name cluster
Definition: cheaterreco.fcl:51
float iMinWire
Definition: HoughBaseAlg.h:212
bool operator<(const houghCorner &houghCornerComp) const
Definition: HoughBaseAlg.h:168
KEY Key_t
type of counter key in the map
Definition: CountersMap.h:147
float isolation
Definition: HoughBaseAlg.h:216
Declaration of signal hit object.
SubCounter_t increment(Key_t key)
Increments by 1 the specified counter.
Definition: CountersMap.h:500
SubCounter_t set(Key_t key, SubCounter_t value)
Sets the specified counter to a count value.
Definition: HoughBaseAlg.h:312
int oldClusterNumber
Definition: HoughBaseAlg.h:204
double pMin1
Definition: HoughBaseAlg.h:178
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:450
size_t FastTransform(const std::vector< art::Ptr< recob::Cluster >> &clusIn, std::vector< recob::Cluster > &ccol, std::vector< art::PtrVector< recob::Hit >> &clusHitsOut, CLHEP::HepRandomEngine &engine, art::Event const &evt, std::string const &label)
std::pair< const_iterator, SubCounter_t > PairValue_t
Pair identifying a counter and its current value.
Definition: HoughBaseAlg.h:297
mergedLines(double totalQTemp=0, double pMin0Temp=0, double pMin1Temp=0, double pMax0Temp=0, double pMax1Temp=0, double clusterNumberTemp=-999999, double showerLikenessTemp=0)
Definition: HoughBaseAlg.h:183
Data structure collecting charge information to be filled in cluster.
Definition: HoughBaseAlg.h:475
int fMaxLines
Max number of lines that can be found.
Definition: HoughBaseAlg.h:536
PairValue_t unchecked_add_range_max(Key_t key_begin, Key_t key_end, SubCounter_t delta, typename BaseMap_t::iterator start, SubCounter_t min_max=std::numeric_limits< SubCounter_t >::min())
ChargeInfo_t(float in, float in_stdev, float sum, float sum_stdev)
Definition: HoughBaseAlg.h:481
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
float fMissedHitsDistance
Distance between hits in a hough line before a hit is considered missed.
Definition: HoughBaseAlg.h:559
int fNumAngleCells
that fall into the &quot;correct&quot; bin will be small and consistent with noise.
Definition: HoughBaseAlg.h:540
int fSaveAccumulator
Save bitmap image of accumulator for debugging?
Definition: HoughBaseAlg.h:539
typename Traits_t::template BaseMap_t< typename std::allocator_traits< Allocator_t >::template rebind_alloc< typename Traits_t::MapValue_t > > BaseMap_t
Type of the map used in the implementation.
Definition: CountersMap.h:171
friend class HoughTransformClus
Definition: HoughBaseAlg.h:531
bool showerMerged
Definition: HoughBaseAlg.h:219
SubCounter_t set(Key_t key_begin, Key_t key_end, SubCounter_t value)
Sets the specified range of counters to a count value.
Definition: HoughBaseAlg.h:348
float minWire
Definition: HoughBaseAlg.h:214
PairValue_t increment_and_get_max(Key_t key_begin, Key_t key_end, SubCounter_t current_max)
Increments by 1 the specified counters and returns the maximum.
Definition: HoughBaseAlg.h:402
HoughTransformCounters(Allocator_t alloc)
Constructor, specifies an allocator.
Definition: HoughBaseAlg.h:303
float fMaxDistance
Max distance that a hit can be from a line to be considered part of that line.
Definition: HoughBaseAlg.h:545
double pMax1
Definition: HoughBaseAlg.h:180
float fMaxSlope
Max slope a line can have.
Definition: HoughBaseAlg.h:546
float maxWire
Definition: HoughBaseAlg.h:215
Declaration of cluster object.
SubCounter_t decrement(Key_t key)
Decrements by 1 the specified counter.
Definition: CountersMap.h:505
float totalQ
Definition: HoughBaseAlg.h:207
SubCounter_t decrement(Key_t key)
Decrements by 1 the specified counter.
Definition: HoughBaseAlg.h:334
HoughTransformCounters()
Default constructor (empty map)
Definition: HoughBaseAlg.h:300
int fRhoZeroOutRange
Range in rho over which to zero out area around previously found lines in the accumulator.
Definition: HoughBaseAlg.h:548
double strength
Definition: HoughBaseAlg.h:157
PairValue_t get_max() const
Increments by 1 the specified counters and returns the maximum.
CountersMap with access optimized for Hough Transform algorithm.
Definition: HoughBaseAlg.h:281
ALLOC Allocator_t
type of the single counter
Definition: CountersMap.h:149
float iMaxWire
Definition: HoughBaseAlg.h:213
Structure with the index of the counter, split as needed.
Definition: CountersMap.h:296
float clusterSlope
Definition: HoughBaseAlg.h:205
float showerLikeness
Definition: HoughBaseAlg.h:217
double pMax0
Definition: HoughBaseAlg.h:179
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
Contains all timing reference information for the detector.
typename Base_t::Key_t Key_t
Definition: HoughBaseAlg.h:291
double pMin0
Definition: HoughBaseAlg.h:177
std::vector< art::Ptr< recob::Hit > > hits
Definition: HoughBaseAlg.h:222
bool mergedLeft
Definition: HoughBaseAlg.h:220
SubCounter_t increment(Key_t key)
Increments by 1 the specified counter.
Definition: HoughBaseAlg.h:323
void Init(unsigned int num=999999, unsigned int pnum=999999, float slope=999999, float intercept=999999, float totalQTemp=-999999, float Min0=999999, float Min1=999999, float Max0=-999999, float Max1=-999999, int iMinWireTemp=999999, int iMaxWireTemp=-999999, int minWireTemp=999999, int maxWireTemp=-999999, std::vector< art::Ptr< recob::Hit >> hitsTemp=std::vector< art::Ptr< recob::Hit >>())
Definition: HoughBaseAlg.h:226
HoughBaseAlg(fhicl::ParameterSet const &pset)
Map storing counters in a compact way.
Definition: CountersMap.h:138
temporary value
size_t Transform(const detinfo::DetectorClocksData &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> const &hits, CLHEP::HepRandomEngine &engine, std::vector< unsigned int > *fpointId_to_clusterId, unsigned int clusterId, unsigned int *nClusters, std::vector< protoTrack > *protoTracks)
Counter_t SubCounter_t
Type of the subcounter (that is, the actual counter)
Definition: CountersMap.h:162
Map of counters, stored compactly.
TCEvent evt
Definition: DataStructs.cxx:8
int fThetaZeroOutRange
Range in theta over which to zero out area around previously found lines in the accumulator.
Definition: HoughBaseAlg.h:550
typename Base_t::const_iterator const_iterator
Definition: HoughBaseAlg.h:294
float clusterIntercept
Definition: HoughBaseAlg.h:206
SubCounter_t set(Key_t key, SubCounter_t value)
Sets the specified counter to a count.
Definition: CountersMap.h:495
PairValue_t increment_and_get_max(Key_t key_begin, Key_t key_end)
Increments by 1 the specified counters and returns the maximum.
Definition: HoughBaseAlg.h:382
bool mergedRight
Definition: HoughBaseAlg.h:221
houghCorner(double strengthTemp=0, double p0Temp=0, double p1Temp=0)
Definition: HoughBaseAlg.h:160
float fMissedHitsToLineSize
Ratio of missed hits to line size for a line to be considered a fake.
Definition: HoughBaseAlg.h:561
auto const detProp
void HLSSaveBMPFile(char const *, unsigned char *, int, int)
SubCounter_t unchecked_set_range(Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start)
virtual ~HoughBaseAlg()=default
int clusterNumber
Definition: HoughBaseAlg.h:202