All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Types | Private Member Functions | List of all members
cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > Class Template Reference

CountersMap with access optimized for Hough Transform algorithm. More...

#include <HoughBaseAlg.h>

Inheritance diagram for cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >:
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >

Public Types

using CounterMap_t = HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
 This class. More...
 
using Base_t = lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
 Base class. More...
 
using BaseMap_t = typename Base_t::BaseMap_t
 
using Allocator_t = typename Base_t::Allocator_t
 
using Key_t = typename Base_t::Key_t
 
using SubCounter_t = typename Base_t::SubCounter_t
 
using CounterBlock_t = typename Base_t::CounterBlock_t
 
using const_iterator = typename Base_t::const_iterator
 
using PairValue_t = std::pair< const_iterator, SubCounter_t >
 Pair identifying a counter and its current value. More...
 
- Public Types inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
using Key_t = KEY
 type of counter key in the map More...
 
using Counter_t = COUNTER
 type of the single counter More...
 
using Allocator_t = ALLOC
 type of the single counter More...
 
using CounterMap_t = CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
 This class. More...
 
using SubCounter_t = Counter_t
 Type of the subcounter (that is, the actual counter) More...
 
using CounterBlock_t = typename Traits_t::CounterBlock_t
 
using BaseMap_t = typename Traits_t::template BaseMap_t< typename std::allocator_traits< Allocator_t >::template rebind_alloc< typename Traits_t::MapValue_t > >
 Type of the map used in the implementation. More...
 
using value_type = std::pair< const Key_t, SubCounter_t >
 
using mapped_type = SubCounter_t
 
using allocator_type = Allocator_t
 type of the single counter More...
 

Public Member Functions

 HoughTransformCounters ()
 Default constructor (empty map) More...
 
 HoughTransformCounters (Allocator_t alloc)
 Constructor, specifies an allocator. More...
 
SubCounter_t set (Key_t key, SubCounter_t value)
 Sets the specified counter to a count value. More...
 
SubCounter_t increment (Key_t key)
 Increments by 1 the specified counter. More...
 
SubCounter_t decrement (Key_t key)
 Decrements by 1 the specified counter. More...
 
SubCounter_t set (Key_t key_begin, Key_t key_end, SubCounter_t value)
 Sets the specified range of counters to a count value. More...
 
void increment (Key_t key_begin, Key_t key_end)
 Increments by 1 the specified range of counters. More...
 
PairValue_t increment_and_get_max (Key_t key_begin, Key_t key_end)
 Increments by 1 the specified counters and returns the maximum. More...
 
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. More...
 
void decrement (Key_t key_begin, Key_t key_end)
 Decrements by 1 the specified range of counters. More...
 
PairValue_t get_max (SubCounter_t current_max) const
 Returns the largest counter. More...
 
PairValue_t get_max () const
 Increments by 1 the specified counters and returns the maximum. More...
 
- Public Member Functions inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
 CountersMap ()
 Default constructor (empty map) More...
 
 CountersMap (Allocator_t alloc)
 Constructor, specifies an allocator. More...
 
SubCounter_t operator[] (Key_t key) const
 Read-only access to an element; returns 0 if no counter is present. More...
 
SubCounter_t set (Key_t key, SubCounter_t value)
 Sets the specified counter to a count. More...
 
SubCounter_t increment (Key_t key)
 Increments by 1 the specified counter. More...
 
SubCounter_t decrement (Key_t key)
 Decrements by 1 the specified counter. More...
 
bool empty () const
 Returns whether the map has no counters. More...
 
std::make_unsigned< Key_t >::type n_counters () const
 Returns the number of allocated counters. More...
 
template<typename OALLOC >
bool is_equal (const std::map< Key_t, SubCounter_t, std::less< Key_t >, OALLOC > &to, Key_t &first_difference) const
 Returns whether the counters in this map are equivalent to another. More...
 
template<typename OALLOC >
bool is_equal (const std::map< Key_t, SubCounter_t, std::less< Key_t >, OALLOC > &to) const
 Returns whether the counters in this map are equivalent to another. More...
 
const_iterator begin () const
 Returns an iterator to the begin of the counters. More...
 
const_iterator end () const
 Returns an iterator past-the-end of the counters. More...
 

Protected Types

using CounterKey_t = typename Base_t::CounterKey_t
 
- Protected Types inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
using BlockKey_t = Key_t
 type of block key More...
 
using CounterIndex_t = typename std::make_unsigned< Key_t >::type
 type of index in the block More...
 

Private Member Functions

SubCounter_t unchecked_set_range (Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start)
 
SubCounter_t unchecked_set_range (Key_t key_begin, Key_t key_end, SubCounter_t value)
 
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())
 
PairValue_t unchecked_add_range_max (Key_t key_begin, Key_t key_end, SubCounter_t delta, SubCounter_t min_max=std::numeric_limits< SubCounter_t >::min())
 

Additional Inherited Members

- Static Public Attributes inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
static constexpr size_t NCounters = Traits_t::NCounters
 Number of counters in one counter block. More...
 
static constexpr size_t NSubcounters = NCounters * SUBCOUNTERS
 Number of subcounters in one counter block. More...
 
- Protected Member Functions inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
Counter_t GetCounter (CounterKey_t key) const
 Returns the value of the counter at the specified split key. More...
 
SubCounter_t GetSubCounter (CounterKey_t key) const
 Returns the value of the subcounter at the specified split key. More...
 
Counter_tGetOrCreateCounter (CounterKey_t key)
 Returns the counter at the specified split key. More...
 
- Static Protected Member Functions inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
static CounterKey_t SplitKey (Key_t key)
 Returns a split key corresponding to the specified key. More...
 
static const_iterator make_const_iterator (typename BaseMap_t::const_iterator it, size_t ix)
 Creates a const_iterator (useful in derived classes) More...
 
- Protected Attributes inherited from lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >
BaseMap_t counter_map
 the actual data structure for counters More...
 

Detailed Description

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
class cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >

CountersMap with access optimized for Hough Transform algorithm.

Parameters
KEYthe type of the key of the counters map
COUNTERthe type of a basic counter (can be signed or unsigned)
BLOCKSIZEthe number of counters in a cluster
ALLOCallocator for the underlying STL map
SUBCOUNTERSsplit each counter in subcounters (not implemented yet)
See Also
CountersMap

In addition to the standard CountersMap interface, a special range increment, increment with max detection and decrement methods are provided.

Definition at line 281 of file HoughBaseAlg.h.

Member Typedef Documentation

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Allocator_t = typename Base_t::Allocator_t

Definition at line 290 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Base_t = lar::CountersMap<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS>

Base class.

Definition at line 286 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::BaseMap_t = typename Base_t::BaseMap_t

Definition at line 289 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::const_iterator = typename Base_t::const_iterator

Definition at line 294 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterBlock_t = typename Base_t::CounterBlock_t

Definition at line 293 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t = typename Base_t::CounterKey_t
protected

Definition at line 450 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterMap_t = HoughTransformCounters<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS>

This class.

Definition at line 284 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Key_t = typename Base_t::Key_t

Definition at line 291 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::PairValue_t = std::pair<const_iterator, SubCounter_t>

Pair identifying a counter and its current value.

Definition at line 297 of file HoughBaseAlg.h.

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::SubCounter_t = typename Base_t::SubCounter_t

Definition at line 292 of file HoughBaseAlg.h.

Constructor & Destructor Documentation

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::HoughTransformCounters ( )
inline

Default constructor (empty map)

Definition at line 300 of file HoughBaseAlg.h.

300 : Base_t() {}
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > Base_t
Base class.
Definition: HoughBaseAlg.h:286
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::HoughTransformCounters ( Allocator_t  alloc)
inline

Constructor, specifies an allocator.

Definition at line 303 of file HoughBaseAlg.h.

303 : Base_t(alloc) {}
lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS > Base_t
Base class.
Definition: HoughBaseAlg.h:286

Member Function Documentation

template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::decrement ( Key_t  key)
inline

Decrements by 1 the specified counter.

Parameters
keykey of the counter to be decreased
Returns
new value of the counter

Definition at line 334 of file HoughBaseAlg.h.

335  {
336  return Base_t::decrement(key);
337  }
SubCounter_t decrement(Key_t key)
Decrements by 1 the specified counter.
Definition: CountersMap.h:505
template<typename K , typename C , size_t S, typename A , unsigned int SC>
void cluster::HoughTransformCounters< K, C, S, A, SC >::decrement ( Key_t  key_begin,
Key_t  key_end 
)
inline

Decrements by 1 the specified range of counters.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
See Also
increment()

Definition at line 143 of file HoughBaseAlg.cxx.

144 {
145  unchecked_add_range_max(key_begin, key_end, -1, std::numeric_limits<SubCounter_t>::max());
146 } // cluster::HoughTransformCounters<>::decrement(begin, end)
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())
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::get_max ( SubCounter_t  current_max) const

Returns the largest counter.

Parameters
current_maxonly counters larger than this will be considered
Returns
pair with an iterator to the largest counter and its value
See Also
get_max(), increment_and_get_max(Key_t, Key_t)

All counters are parsed, and the first one with the largest count is returned. The return value consist of a pair: the second is the largest counter value, the first member is the constant iterator pointing to the first (lowest key) counter with that (get its key with const_iterator::key() method).

This method does not update the maximum if it's not (strictly) larger than current_max. If no such a maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()).

Definition at line 150 of file HoughBaseAlg.cxx.

151 {
153 
154  typename BaseMap_t::const_iterator iCBlock = Base_t::counter_map.begin(),
155  cend = Base_t::counter_map.end();
156  while (iCBlock != cend) {
157  const CounterBlock_t& block = iCBlock->second;
158  for (size_t index = 0; index < block.size(); ++index) {
159  if (block[index] > max.second)
160  max = {Base_t::make_const_iterator(iCBlock, index), block[index]};
161  ++iCBlock;
162  } // for elements in this block
163  } // while blocks
164  return max;
165 } // cluster::HoughTransformCounters<>::get_max(SubCounter_t)
const_iterator end() const
Returns an iterator past-the-end of the counters.
Definition: CountersMap.h:516
std::pair< const_iterator, SubCounter_t > PairValue_t
Pair identifying a counter and its current value.
Definition: HoughBaseAlg.h:297
static const_iterator make_const_iterator(typename BaseMap_t::const_iterator it, size_t ix)
Creates a const_iterator (useful in derived classes)
Definition: CountersMap.h:379
auto cend(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:579
BaseMap_t counter_map
the actual data structure for counters
Definition: CountersMap.h:359
typename Base_t::CounterBlock_t CounterBlock_t
Definition: HoughBaseAlg.h:293
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::get_max ( ) const
inline

Increments by 1 the specified counters and returns the maximum.

Parameters
current_maxonly counters larger than this will be considered
Returns
pair with an iterator to the largest counter and its value
See Also
get_max(SubCounter_t), increment_and_get_max(Key_t, Key_t)

This method works like get_max() method, except that it does not update the maximum if it's not (strictly) larger than current_max. If no such a maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()).

Definition at line 169 of file HoughBaseAlg.cxx.

170 {
171  return get_max(std::numeric_limits<SubCounter_t>::max());
172 }
PairValue_t get_max() const
Increments by 1 the specified counters and returns the maximum.
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::increment ( Key_t  key)
inline

Increments by 1 the specified counter.

Parameters
keykey of the counter to be increased
Returns
new value of the counter

Definition at line 323 of file HoughBaseAlg.h.

324  {
325  return Base_t::increment(key);
326  }
SubCounter_t increment(Key_t key)
Increments by 1 the specified counter.
Definition: CountersMap.h:500
template<typename K , typename C , size_t S, typename A , unsigned int SC>
void cluster::HoughTransformCounters< K, C, S, A, SC >::increment ( Key_t  key_begin,
Key_t  key_end 
)
inline

Increments by 1 the specified range of counters.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
See Also
decrement(), increment_and_get_max()

Definition at line 136 of file HoughBaseAlg.cxx.

137 {
138  unchecked_add_range_max(key_begin, key_end, +1, std::numeric_limits<SubCounter_t>::max());
139 } // cluster::HoughTransformCounters<>::increment(begin, end)
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())
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
PairValue_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::increment_and_get_max ( Key_t  key_begin,
Key_t  key_end 
)
inline

Increments by 1 the specified counters and returns the maximum.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
Returns
pair with an iterator to the largest counter and its value
See Also
increment(Key_t, Key_t)

This method works like the corresponding increment() method, and in addition it returns the location of the counter with the largest count (after the increase). The return value consist of a pair: the second is the largest counter value in the range after the increase, the first member is the constant iterator pointing to the first (lowest key) counter with that (get its key with const_iterator::key() method).

If no maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()). Note that if all the counters are at the minimum possible value, no maximum will be returned.

Definition at line 382 of file HoughBaseAlg.h.

383  {
384  return unchecked_add_range_max(key_begin, key_end, +1);
385  }
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())
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
PairValue_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::increment_and_get_max ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  current_max 
)
inline

Increments by 1 the specified counters and returns the maximum.

Parameters
key_beginkey of the first counter to be increased
key_endkey of the first counter not to be increased
current_maxonly counters larger than this will be considered
Returns
pair with an iterator to the largest counter and its value
See Also
increment(Key_t, Key_t), increment_and_get_max(Key_t, Key_t)

This method works like increment_and_get_max() method, except that it does not update the maximum if it's not (strictly) larger than current_max. If no such a maximum is found, the maximum in the return value is equal to current_max, while the iterator points to the end of the map (end()).

Definition at line 402 of file HoughBaseAlg.h.

403  {
404  return unchecked_add_range_max(key_begin, key_end, +1, current_max);
405  }
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())
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::set ( Key_t  key,
SubCounter_t  value 
)
inline

Sets the specified counter to a count value.

Parameters
keykey of the counter to be set
valuethe count value
Returns
new value of the counter

Definition at line 312 of file HoughBaseAlg.h.

313  {
314  return Base_t::set(key, value);
315  }
temporary value
SubCounter_t set(Key_t key, SubCounter_t value)
Sets the specified counter to a count.
Definition: CountersMap.h:495
template<typename KEY, typename COUNTER, size_t SIZE, typename ALLOC = std::allocator<std::pair<KEY, std::array<COUNTER, SIZE>>>, unsigned int SUBCOUNTERS = 1>
SubCounter_t cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::set ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  value 
)
inline

Sets the specified range of counters to a count value.

Parameters
key_beginkey of the first counter to be set
key_endkey of the first counter not to be set
valuethe count value
Returns
new value of all the counters
See Also
increment(), decrement(), increment_and_get_max()

Definition at line 348 of file HoughBaseAlg.h.

349  {
350  return unchecked_set_range(key_begin, key_end, value);
351  }
temporary value
SubCounter_t unchecked_set_range(Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start)
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::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() 
)
private

Definition at line 212 of file HoughBaseAlg.cxx.

219 {
221  if (key_begin > key_end) return max;
222  CounterKey_t key(key_begin);
223  size_t left = key_end - key_begin;
224  while (true) {
225  if ((iIP == Base_t::counter_map.end()) || (iIP->first != key.block)) {
226  // we don't have that block yet
227  iIP = Base_t::counter_map.insert(iIP, {key.block, {}});
228  } // if need to add a block
229  CounterBlock_t& block = iIP->second;
230  size_t n = std::min(left, Base_t::NCounters - key.counter);
231  left -= n;
232  while (n--) {
233  SubCounter_t value = (block[key.counter] += delta);
234  if (value > max.second) { max = {Base_t::make_const_iterator(iIP, key.counter), value}; }
235  ++(key.counter);
236  } // for key.counter
237  if (left <= 0) break;
238  key.next_block();
239  ++iIP;
240  } // while
241  return max;
242 } // cluster::HoughTransformCounters<>::unchecked_add_range_max()
typename Base_t::SubCounter_t SubCounter_t
Definition: HoughBaseAlg.h:292
const_iterator end() const
Returns an iterator past-the-end of the counters.
Definition: CountersMap.h:516
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:450
std::pair< const_iterator, SubCounter_t > PairValue_t
Pair identifying a counter and its current value.
Definition: HoughBaseAlg.h:297
static const_iterator make_const_iterator(typename BaseMap_t::const_iterator it, size_t ix)
Creates a const_iterator (useful in derived classes)
Definition: CountersMap.h:379
walls no left
Definition: selectors.fcl:105
BaseMap_t counter_map
the actual data structure for counters
Definition: CountersMap.h:359
typename Base_t::CounterBlock_t CounterBlock_t
Definition: HoughBaseAlg.h:293
temporary value
static constexpr size_t NCounters
Number of counters in one counter block.
Definition: CountersMap.h:156
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::PairValue_t cluster::HoughTransformCounters< K, C, S, A, SC >::unchecked_add_range_max ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  delta,
SubCounter_t  min_max = std::numeric_limits<SubCounter_t>::min() 
)
inlineprivate

Definition at line 246 of file HoughBaseAlg.cxx.

252 {
253  return unchecked_add_range_max(key_begin,
254  key_end,
255  delta,
256  Base_t::counter_map.lower_bound(CounterKey_t(key_begin).block),
257  min_max);
258 } // cluster::HoughTransformCounters<>::unchecked_add_range_max(no hint)
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:450
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())
BaseMap_t counter_map
the actual data structure for counters
Definition: CountersMap.h:359
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::SubCounter_t cluster::HoughTransformCounters< K, C, S, A, SC >::unchecked_set_range ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  value,
typename BaseMap_t::iterator  start 
)
private

Definition at line 176 of file HoughBaseAlg.cxx.

181 {
182  if (key_begin > key_end) return value;
183  CounterKey_t key(key_begin);
184  size_t left = key_end - key_begin;
185  while (true) {
186  if ((iIP == Base_t::counter_map.end()) || (iIP->first != key.block)) {
187  // we don't have that block yet
188  iIP = Base_t::counter_map.insert(iIP, {key.block, {}});
189  } // if need to add a block
190  CounterBlock_t& block = iIP->second;
191  size_t n = std::min(left, Base_t::NCounters - key.counter);
192  block.fill(key.counter, n, value);
193  if (left -= n <= 0) break;
194  key.next_block();
195  ++iIP;
196  } // while
197  return value;
198 } // cluster::HoughTransformCounters<>::unchecked_set_range()
const_iterator end() const
Returns an iterator past-the-end of the counters.
Definition: CountersMap.h:516
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:450
walls no left
Definition: selectors.fcl:105
BaseMap_t counter_map
the actual data structure for counters
Definition: CountersMap.h:359
typename Base_t::CounterBlock_t CounterBlock_t
Definition: HoughBaseAlg.h:293
temporary value
static constexpr size_t NCounters
Number of counters in one counter block.
Definition: CountersMap.h:156
template<typename K , typename C , size_t S, typename A , unsigned int SC>
cluster::HoughTransformCounters< K, C, S, A, SC >::SubCounter_t cluster::HoughTransformCounters< K, C, S, A, SC >::unchecked_set_range ( Key_t  key_begin,
Key_t  key_end,
SubCounter_t  value 
)
inlineprivate

Definition at line 202 of file HoughBaseAlg.cxx.

205 {
206  return unchecked_set_range(
207  key_begin, key_end, value, Base_t::counter_map.lower_bound(CounterKey_t(key_begin).block));
208 } // cluster::HoughTransformCounters<>::unchecked_set_range(no hint)
typename Base_t::CounterKey_t CounterKey_t
Definition: HoughBaseAlg.h:450
BaseMap_t counter_map
the actual data structure for counters
Definition: CountersMap.h:359
temporary value
SubCounter_t unchecked_set_range(Key_t key_begin, Key_t key_end, SubCounter_t value, typename BaseMap_t::iterator start)

The documentation for this class was generated from the following files: