ATLAS Offline Software
|
Hold thinning decisions for one container. More...
#include <ThinningDecision.h>
Public Types | |
enum | Op { Op::Set = 0, Op::And = 1, Op::Or = 2 } |
Public Member Functions | |
ThinningDecision (const DataLink< SG::AuxVectorBase > &link) | |
Constructor. More... | |
ThinningDecision (const std::string &key) | |
Constructor. More... | |
const DataLink< SG::AuxVectorBase > & | link () const |
Return link to object being thinned. More... | |
virtual void | lock () override |
Called when the object is locked in SG. 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 | thin (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 | thin (const ThinningDecisionBase &other, Op op=Op::Set) |
Set the thinning state for the container from a bitmask. More... | |
void | keep (size_t ndx) |
Mark that index ndx in the container should be kept (not thinned away). More... | |
void | keep (size_t ndx, bool flag, Op op=Op::Set) |
Set thinning state for one element. More... | |
void | keep (const std::vector< bool > &v, 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 | |
DataLink< SG::AuxVectorBase > | m_link |
Link to the object being thinned. More... | |
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 essentially holds a bitmap of the elements to be thinned from the container, as well as the mapping of indices before and after thinning (the latter available only after the container has been locked in SG). See the base class ThinningDecisionBase
for further details.
Definition at line 38 of file ThinningDecision.h.
|
stronginherited |
Enumerator | |
---|---|
Set | |
And | |
Or |
Definition at line 44 of file ThinningDecisionBase.h.
SG::ThinningDecision::ThinningDecision | ( | const DataLink< SG::AuxVectorBase > & | link | ) |
Constructor.
link | Link to the container being thinned. |
Initialized with all elements kept.
Definition at line 24 of file ThinningDecision.cxx.
SG::ThinningDecision::ThinningDecision | ( | const std::string & | key | ) |
Constructor.
key | SG key of the container being thinned. |
Initialized with all elements kept.
Definition at line 40 of file ThinningDecision.cxx.
|
inherited |
|
inherited |
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.
|
inherited |
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.
|
inherited |
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.
|
inherited |
Mark that all elements should be kept (not thinned).
Definition at line 60 of file ThinningDecisionBase.cxx.
const DataLink< SG::AuxVectorBase > & SG::ThinningDecision::link | ( | ) | const |
Return link to object being thinned.
Definition at line 49 of file ThinningDecision.cxx.
|
overridevirtual |
Called when the object is locked in SG.
Build the index map.
Implements ILockable.
Definition at line 60 of file ThinningDecision.cxx.
|
inherited |
Change the number of elements.
size | The new number of elements. |
Definition at line 33 of file ThinningDecisionBase.cxx.
|
inherited |
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.
|
inherited |
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.
|
inherited |
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.
|
inherited |
Mark that all elements should be thinned away.
Definition at line 51 of file ThinningDecisionBase.cxx.
|
inherited |
Return true if element ndx
should be thinned.
|
inherited |
Return the size of the container being thinned after thinning.
Definition at line 42 of file ThinningDecisionBase.cxx.
|
privateinherited |
Mapping from original indices to thinned indices.
Definition at line 207 of file ThinningDecisionBase.h.
|
private |
Link to the object being thinned.
Definition at line 76 of file ThinningDecision.h.
|
privateinherited |
Thinning map. Set to 1 for thinned elements.
Definition at line 204 of file ThinningDecisionBase.h.
|
staticinherited |
Flag used to show that an index has been thinned away.
Definition at line 42 of file ThinningDecisionBase.h.