ATLAS Offline Software
ThinningDecisionBase.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4  */
13 #ifndef ATHENAKERNEL_THINNINGDECISIONBASE_H
14 #define ATHENAKERNEL_THINNINGDECISIONBASE_H
15 
16 
17 #include "AthenaKernel/ILockable.h"
18 #include "boost/dynamic_bitset.hpp"
19 #include <vector>
20 #include <string>
21 
22 
23 namespace SG {
24 
25 
39 {
40 public:
42  static const std::size_t RemovedIdx = static_cast<std::size_t>(-1);
43 
44  enum class Op {
45  Set = 0,
46  And = 1,
47  Or = 2
48  };
49 
50 
57  ThinningDecisionBase (size_t sz = 0);
58 
59 
64  void resize (const size_t size);
65 
66 
70  bool thinned (size_t ndx) const;
71 
72 
76  size_t size() const;
77 
78 
82  size_t thinnedSize() const;
83 
84 
88  void thinAll();
89 
90 
94  void keepAll();
95 
96 
101  void thin (size_t ndx);
102 
103 
109  void keep (size_t ndx);
110 
111 
121  void thin (size_t ndx, bool flag, Op op = Op::Set);
122 
123 
133  void keep (size_t ndx, bool flag, Op op = Op::Set);
134 
135 
145  void thin (const std::vector<bool>& v, Op op = Op::Set);
146 
147 
157  void keep (const std::vector<bool>& v, Op op = Op::Set);
158 
159 
169  void thin (const ThinningDecisionBase& other, Op op = Op::Set);
170 
171 
181  void keep (const ThinningDecisionBase& other, Op op = Op::Set);
182 
183 
187  void buildIndexMap();
188 
189 
199  size_t index (size_t ndxOrig) const;
200 
201 
202 private:
204  boost::dynamic_bitset<> m_mask;
205 
207  std::vector<size_t> m_indexMap;
208 };
209 
210 
211 } // namespace SG
212 
213 
215 
216 
217 #endif // not ATHENAKERNEL_THINNINGDECISIONBASE_H
fitman.sz
sz
Definition: fitman.py:527
SG::ThinningDecisionBase::resize
void resize(const size_t size)
Change the number of elements.
Definition: ThinningDecisionBase.cxx:33
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::ThinningDecisionBase
Hold thinning decisions for one container.
Definition: ThinningDecisionBase.h:39
SG::ThinningDecisionBase::m_indexMap
std::vector< size_t > m_indexMap
Mapping from original indices to thinned indices.
Definition: ThinningDecisionBase.h:207
ILockable.h
Interface to allow an object to lock itself when made const in SG.
SG::ThinningDecisionBase::thinned
bool thinned(size_t ndx) const
Return true if element ndx should be thinned.
ThinningDecisionBase.icc
SG::ThinningDecisionBase::keep
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Definition: ThinningDecisionBase.cxx:84
SG::ThinningDecisionBase::keepAll
void keepAll()
Mark that all elements should be kept (not thinned).
Definition: ThinningDecisionBase.cxx:60
SG::ThinningDecisionBase::thinnedSize
size_t thinnedSize() const
Return the size of the container being thinned after thinning.
Definition: ThinningDecisionBase.cxx:42
SG::ThinningDecisionBase::Op::And
@ And
master.flag
bool flag
Definition: master.py:29
SG::ThinningDecisionBase::Op::Set
@ Set
SG::ThinningDecisionBase::RemovedIdx
static const std::size_t RemovedIdx
Flag used to show that an index has been thinned away.
Definition: ThinningDecisionBase.h:42
Set
struct _Set Set
Represents a set of values.
Definition: set.h:59
SG::ThinningDecisionBase::m_mask
boost::dynamic_bitset m_mask
Thinning map. Set to 1 for thinned elements.
Definition: ThinningDecisionBase.h:204
SG::ThinningDecisionBase::buildIndexMap
void buildIndexMap()
Build the index map.
Definition: ThinningDecisionBase.cxx:240
SG::ThinningDecisionBase::thin
void thin(size_t ndx)
Mark that index ndx in the container should be thinned away.
Definition: ThinningDecisionBase.cxx:70
SG::ThinningDecisionBase::Op
Op
Definition: ThinningDecisionBase.h:44
SG::ThinningDecisionBase::size
size_t size() const
Return the total size of the container being thinned.
python.PyAthena.v
v
Definition: PyAthena.py:154
SG::ThinningDecisionBase::index
size_t index(size_t ndxOrig) const
Return the index corresponding to ndxOrig after thinning.
SG::ThinningDecisionBase::Op::Or
@ Or
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::ThinningDecisionBase::ThinningDecisionBase
ThinningDecisionBase(size_t sz=0)
Constructor.
Definition: ThinningDecisionBase.cxx:23
SG::ThinningDecisionBase::thinAll
void thinAll()
Mark that all elements should be thinned away.
Definition: ThinningDecisionBase.cxx:51