LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
CountersMap with access optimized for Hough Transform algorithm. More...
#include "HoughBaseAlg.h"
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... | |
using | Counter_t = COUNTER |
type of the single counter More... | |
using | value_type = std::pair< const Key_t, SubCounter_t > |
STL type definitions | |
using | mapped_type = SubCounter_t |
type of the single counter More... | |
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... | |
SubCounter_t | operator[] (Key_t key) const |
Read-only access to an element; returns 0 if no counter is present. 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... | |
Iterators (experimental) | |
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... | |
Static Public Attributes | |
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 Types | |
using | CounterKey_t = typename Base_t::CounterKey_t |
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... | |
Protected Member Functions | |
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_t & | GetOrCreateCounter (CounterKey_t key) |
Returns the counter at the specified split key. More... | |
Static Protected Member Functions | |
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 | |
BaseMap_t | counter_map |
the actual data structure for counters 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()) |
CountersMap with access optimized for Hough Transform algorithm.
KEY | the type of the key of the counters map |
COUNTER | the type of a basic counter (can be signed or unsigned) |
BLOCKSIZE | the number of counters in a cluster |
ALLOC | allocator for the underlying STL map |
SUBCOUNTERS | split each counter in subcounters (not implemented yet) |
In addition to the standard CountersMap interface, a special range increment, increment with max detection and decrement methods are provided.
Definition at line 279 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Allocator_t = typename Base_t::Allocator_t |
Definition at line 288 of file HoughBaseAlg.h.
|
inherited |
type of the single counter
Definition at line 171 of file CountersMap.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Base_t = lar::CountersMap<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS> |
Base class.
Definition at line 284 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::BaseMap_t = typename Base_t::BaseMap_t |
Definition at line 287 of file HoughBaseAlg.h.
|
protectedinherited |
type of block key
Definition at line 270 of file CountersMap.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::const_iterator = typename Base_t::const_iterator |
Definition at line 292 of file HoughBaseAlg.h.
|
inherited |
type of the single counter
Definition at line 139 of file CountersMap.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterBlock_t = typename Base_t::CounterBlock_t |
Definition at line 291 of file HoughBaseAlg.h.
|
protectedinherited |
type of index in the block
Definition at line 272 of file CountersMap.h.
|
protected |
Definition at line 433 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterMap_t = HoughTransformCounters<KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS> |
This class.
Definition at line 282 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::Key_t = typename Base_t::Key_t |
Definition at line 289 of file HoughBaseAlg.h.
|
inherited |
type of the single counter
Definition at line 170 of file CountersMap.h.
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 295 of file HoughBaseAlg.h.
using cluster::HoughTransformCounters< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::SubCounter_t = typename Base_t::SubCounter_t |
Definition at line 290 of file HoughBaseAlg.h.
|
inherited |
Definition at line 175 of file CountersMap.h.
|
inline |
Default constructor (empty map)
Definition at line 298 of file HoughBaseAlg.h.
|
inline |
Constructor, specifies an allocator.
Definition at line 301 of file HoughBaseAlg.h.
|
inlineinherited |
Returns an iterator to the begin of the counters.
Definition at line 525 of file CountersMap.h.
|
inline |
Decrements by 1 the specified counter.
key | key of the counter to be decreased |
Definition at line 323 of file HoughBaseAlg.h.
Referenced by cluster::HoughTransform::DoAddPointReturnMax().
|
inline |
Decrements by 1 the specified range of counters.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
Definition at line 132 of file HoughBaseAlg.cxx.
|
inlineinherited |
Returns whether the map has no counters.
Definition at line 228 of file CountersMap.h.
|
inlineinherited |
Returns an iterator past-the-end of the counters.
Definition at line 532 of file CountersMap.h.
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.
current_max | only counters larger than this will be considered |
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 140 of file HoughBaseAlg.cxx.
References util::cend(), and util::end().
|
inline |
Increments by 1 the specified counters and returns the maximum.
current_max | only counters larger than this will be considered |
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 159 of file HoughBaseAlg.cxx.
|
inlineprotectedinherited |
Returns the value of the counter at the specified split key.
Definition at line 607 of file CountersMap.h.
References lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::block, and lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::counter.
|
inlineprotectedinherited |
Returns the counter at the specified split key.
Definition at line 616 of file CountersMap.h.
References lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::block, and lar::CountersMap< KEY, COUNTER, SIZE, ALLOC, SUBCOUNTERS >::CounterKey_t::counter.
|
inlineprotectedinherited |
Returns the value of the subcounter at the specified split key.
Definition at line 365 of file CountersMap.h.
|
inline |
Increments by 1 the specified counter.
key | key of the counter to be increased |
Definition at line 316 of file HoughBaseAlg.h.
|
inline |
Increments by 1 the specified range of counters.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
Definition at line 125 of file HoughBaseAlg.cxx.
|
inline |
Increments by 1 the specified counters and returns the maximum.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
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 366 of file HoughBaseAlg.h.
Referenced by cluster::HoughTransform::DoAddPointReturnMax().
|
inline |
Increments by 1 the specified counters and returns the maximum.
key_begin | key of the first counter to be increased |
key_end | key of the first counter not to be increased |
current_max | only counters larger than this will be considered |
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 385 of file HoughBaseAlg.h.
|
inherited |
Returns whether the counters in this map are equivalent to another.
to | a STL map |
first_difference | key of the first difference |
The maps are considered equal if all keys in each are present in the other, and their counters have the same value, with one exception: counters in CountersMap can not to exist in the other map, but only if their count is 0 (these should be plenty of them since counters are created in blocks).
If there is a key in one map but not in the other, first_difference stores that key; if a counter is present in both maps but with a different count, first_difference reports the key of that counter. If no difference is found, first_difference is left untouched.
Definition at line 540 of file CountersMap.h.
|
inlineinherited |
Returns whether the counters in this map are equivalent to another.
to | a STL map |
Definition at line 263 of file CountersMap.h.
|
inlinestaticprotectedinherited |
Creates a const_iterator (useful in derived classes)
Definition at line 374 of file CountersMap.h.
|
inlineinherited |
Returns the number of allocated counters.
Definition at line 231 of file CountersMap.h.
|
inlineinherited |
Read-only access to an element; returns 0 if no counter is present.
Definition at line 187 of file CountersMap.h.
References util::begin(), util::end(), and value.
|
inline |
Sets the specified counter to a count value.
key | key of the counter to be set |
value | the count value |
Definition at line 309 of file HoughBaseAlg.h.
References value.
|
inline |
Sets the specified range of counters to a count value.
key_begin | key of the first counter to be set |
key_end | key of the first counter not to be set |
value | the count value |
Definition at line 333 of file HoughBaseAlg.h.
References value.
|
inlinestaticprotectedinherited |
Returns a split key corresponding to the specified key.
Definition at line 371 of file CountersMap.h.
|
private |
Definition at line 202 of file HoughBaseAlg.cxx.
References util::end(), art::left(), n, and value.
|
inlineprivate |
Definition at line 236 of file HoughBaseAlg.cxx.
|
private |
Definition at line 166 of file HoughBaseAlg.cxx.
References util::end(), art::left(), n, and value.
|
inlineprivate |
Definition at line 192 of file HoughBaseAlg.cxx.
|
protectedinherited |
the actual data structure for counters
Definition at line 358 of file CountersMap.h.
|
staticinherited |
Number of counters in one counter block.
Definition at line 146 of file CountersMap.h.
|
staticinherited |
Number of subcounters in one counter block.
Definition at line 149 of file CountersMap.h.