ATLAS Offline Software
Loading...
Searching...
No Matches
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-2025 CERN for the benefit of the ATLAS collaboration
4 */
11
12
13#ifndef ATHENAKERNEL_THINNINGDECISIONBASE_H
14#define ATHENAKERNEL_THINNINGDECISIONBASE_H
15
16
17#include "SGCore/ILockable.h"
18#include "boost/dynamic_bitset.hpp"
19#include <vector>
20#include <string>
21
22
23namespace SG {
24
25
39{
40public:
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
202private:
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
static Double_t sz
static const std::size_t RemovedIdx
Flag used to show that an index has been thinned away.
std::vector< size_t > m_indexMap
Mapping from original indices to thinned indices.
ThinningDecisionBase(size_t sz=0)
Constructor.
void thinAll()
Mark that all elements should be thinned away.
void keepAll()
Mark that all elements should be kept (not thinned).
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
void thin(size_t ndx)
Mark that index ndx in the container should be thinned away.
bool thinned(size_t ndx) const
Return true if element ndx should be thinned.
void buildIndexMap()
Build the index map.
size_t index(size_t ndxOrig) const
Return the index corresponding to ndxOrig after thinning.
size_t size() const
Return the total size of the container being thinned.
size_t thinnedSize() const
Return the size of the container being thinned after thinning.
boost::dynamic_bitset m_mask
Thinning map. Set to 1 for thinned elements.
void resize(const size_t size)
Change the number of elements.
Forward declaration.