![]() |
ATLAS Offline Software
|
Hold thinning decisions for one container. More...
#include <ThinningDecisionBase.h>
Public Types | |
| enum | Op { Op::Set = 0, Op::And = 1, Op::Or = 2 } |
Public Member Functions | |
| ThinningDecisionBase (size_t sz=0) | |
| Constructor. More... | |
| void | resize (const size_t size) |
| Change the number of elements. More... | |
| bool | thinned (size_t ndx) const |
Return true if element ndx should be thinned. More... | |
| size_t | size () const |
| Return the total size of the container being thinned. More... | |
| size_t | thinnedSize () const |
| Return the size of the container being thinned after thinning. More... | |
| void | thinAll () |
| Mark that all elements should be thinned away. More... | |
| void | keepAll () |
| Mark that all elements should be kept (not thinned). More... | |
| void | thin (size_t ndx) |
Mark that index ndx in the container should be thinned away. More... | |
| void | keep (size_t ndx) |
Mark that index ndx in the container should be kept (not thinned away). More... | |
| void | thin (size_t ndx, bool flag, Op op=Op::Set) |
| Set thinning state for one element. More... | |
| void | keep (size_t ndx, bool flag, Op op=Op::Set) |
| Set thinning state for one element. More... | |
| void | thin (const std::vector< bool > &v, Op op=Op::Set) |
| Set the thinning state for the container from a bitmask. More... | |
| void | keep (const std::vector< bool > &v, Op op=Op::Set) |
| Set the thinning state for the container from a bitmask. More... | |
| void | thin (const ThinningDecisionBase &other, Op op=Op::Set) |
| Set the thinning state for the container from a bitmask. More... | |
| void | keep (const ThinningDecisionBase &other, Op op=Op::Set) |
| Set the thinning state for the container from a bitmask. More... | |
| void | buildIndexMap () |
| Build the index map. More... | |
| size_t | index (size_t ndxOrig) const |
Return the index corresponding to ndxOrig after thinning. More... | |
Static Public Attributes | |
| static const std::size_t | RemovedIdx = static_cast<std::size_t>(-1) |
| Flag used to show that an index has been thinned away. More... | |
Private Attributes | |
| boost::dynamic_bitset | m_mask |
| Thinning map. Set to 1 for thinned elements. More... | |
| std::vector< size_t > | m_indexMap |
| Mapping from original indices to thinned indices. More... | |
Hold thinning decisions for one container.
This class is a wrapper around a bitmap that holds a set of thinning decisions for one container. If bit i is set in the map, then element i of the container has been thinned.
This class also holds a mapping of container indices before and after thinning. However, this is not available until @ buildIndexMap() has been called (which usually happens implicitly when the derived ThinningDecision object is recorded in StoreGate).
Definition at line 38 of file ThinningDecisionBase.h.
|
strong |
| Enumerator | |
|---|---|
| Set | |
| And | |
| Or | |
Definition at line 44 of file ThinningDecisionBase.h.
| SG::ThinningDecisionBase::ThinningDecisionBase | ( | size_t | sz = 0 | ) |
Constructor.
| sz | Number of elements in the container. |
Initialized with all elements kept.
| sz | Number of elements in the container. |
Definition at line 23 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::buildIndexMap | ( | ) |
| size_t SG::ThinningDecisionBase::index | ( | size_t | ndxOrig | ) | const |
Return the index corresponding to ndxOrig after thinning.
| ndxOrig | Original container index. |
Returns the index at which element ndxOrig ends up after thinning. If the element was thinned away, returns RemovedIdx.
This information is available only after buildIndexMap has been called.
Set the thinning state for the container from a bitmask.
| v | Thinning state mask; should have the same size as the container. Element ndx should be kept if bit ndx is set in the map. |
| op | Logical operation for combining with existing thinning state. Set — Keep if flag is true. And — Keep if flag is true and element was originally kept, else not. Or — Keep if flag is true or element was originally kept, else not. |
Definition at line 172 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::keep | ( | const ThinningDecisionBase & | other, |
| Op | op = Op::Set |
||
| ) |
Set the thinning state for the container from a bitmask.
| other | Thinning state mask; should have the same size as the container. Element ndx should be kept if bit ndx is set in the map. |
| op | Logical operation for combining with existing thinning state. Set — Keep if flag is true. And — Keep if flag is true and element was originally kept, else not. Or — Keep if flag is true or element was originally kept, else not. |
Definition at line 222 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::keep | ( | size_t | ndx | ) |
Mark that index ndx in the container should be kept (not thinned away).
| ndx | Index of element to keep. |
Definition at line 84 of file ThinningDecisionBase.cxx.
Set thinning state for one element.
| ndx | Index of element to alter. |
| flag | If true, keep this element; if false, thin it it. |
| op | Logical operation for combining with existing thinning state. Set — Keep if flag is true. And — Keep if flag is true and element was originally kept, else not. Or — Keep if flag is true or element was originally kept, else not. |
Definition at line 124 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::keepAll | ( | ) |
Mark that all elements should be kept (not thinned).
Definition at line 60 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::resize | ( | const size_t | size | ) |
Change the number of elements.
| size | The new number of elements. |
Definition at line 33 of file ThinningDecisionBase.cxx.
| size_t SG::ThinningDecisionBase::size | ( | ) | const |
Return the total size of the container being thinned.
Set the thinning state for the container from a bitmask.
| v | Thinning state mask; should have the same size as the container. Element ndx should be thinned if bit ndx is set in the map. |
| op | Logical operation for combining with existing thinning state. Set — Thin if flag is true. And — Thin if flag is true and element was originally thinned, else not. Or — Thin if flag is true or element was originally thinned, else not. |
Definition at line 146 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::thin | ( | const ThinningDecisionBase & | other, |
| Op | op = Op::Set |
||
| ) |
Set the thinning state for the container from a bitmask.
| other | Thinning state mask; should have the same size as the container. Element ndx should be thinned if bit ndx is set in the map. |
| op | Logical operation for combining with existing thinning state. Set — Thin if flag is true. And — Thin if flag is true and element was originally thinned, else not. Or — Thin if flag is true or element was originally thinned, else not. |
Definition at line 198 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::thin | ( | size_t | ndx | ) |
Mark that index ndx in the container should be thinned away.
| ndx | Index of element to thin. |
Definition at line 70 of file ThinningDecisionBase.cxx.
Set thinning state for one element.
| ndx | Index of element to alter. |
| flag | If true, thin this element; if false, keep it. |
| op | Logical operation for combining with existing thinning state. Set — Thin if flag is true. And — Thin if flag is true and element was originally thinned, else not. Or — Thin if flag is true or element was originally thinned, else not. |
Definition at line 102 of file ThinningDecisionBase.cxx.
| void SG::ThinningDecisionBase::thinAll | ( | ) |
Mark that all elements should be thinned away.
Definition at line 51 of file ThinningDecisionBase.cxx.
| bool SG::ThinningDecisionBase::thinned | ( | size_t | ndx | ) | const |
Return true if element ndx should be thinned.
| size_t SG::ThinningDecisionBase::thinnedSize | ( | ) | const |
Return the size of the container being thinned after thinning.
Definition at line 42 of file ThinningDecisionBase.cxx.
|
private |
Mapping from original indices to thinned indices.
Definition at line 207 of file ThinningDecisionBase.h.
|
private |
Thinning map. Set to 1 for thinned elements.
Definition at line 204 of file ThinningDecisionBase.h.
|
static |
Flag used to show that an index has been thinned away.
Definition at line 42 of file ThinningDecisionBase.h.
1.8.18