ATLAS Offline Software
Loading...
Searching...
No Matches
ThinningHandleBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
10
11
15
16
17namespace SG {
18
19
28 const std::string& sgkey,
29 const EventContext& ctx)
30 : m_decisionHandle (dkey, ctx),
31 m_decision (std::make_unique<ThinningDecision> (sgkey))
32{
33}
34
35
42{
43 StatusCode sc = StatusCode::FAILURE;
44 try {
45 sc = m_decisionHandle.record (std::move (m_decision));
46 }
47 catch (const GaudiException&) {
48 sc = StatusCode::FAILURE;
49 }
50 if (sc.isFailure()) {
51 MsgStream msg (Athena::getMessageSvc(), "ThinningHandleBase");
52 msg << MSG::ERROR
53 << "Can't record SG::ThinningDecision object: "
54 << m_decisionHandle.store() << "+" << m_decisionHandle.key()
55 << endmsg;
56 }
57}
58
59
64void ThinningHandleBase::thin (size_t ndx)
65{
66 m_decision->thin (ndx);
67}
68
69
75void ThinningHandleBase::keep (size_t ndx)
76{
77 m_decision->keep (ndx);
78}
79
80
90void ThinningHandleBase::thin (const std::vector<bool>& v, Op op /*= Op::Set*/)
91{
92 m_decision->thin (v, op);
93}
94
95
105void ThinningHandleBase::keep (const std::vector<bool>& v, Op op /*= Op::Set*/)
106{
107 m_decision->keep (v, op);
108}
109
119void ThinningHandleBase::thin (const ThinningDecisionBase& other, Op op /*= Op::Set*/)
120{
121 m_decision->thin (other, op);
122}
123
124
134void ThinningHandleBase::keep (const ThinningDecisionBase& other, Op op /*= Op::Set*/)
135{
136 m_decision->keep (other, op);
137}
138
139
144{
145 return m_decision->thinAll();
146}
147
148
153{
154 return m_decision->keepAll();
155}
156
157
162{
163 return *m_decision;
164}
165
166
167} // namespace SG
#define endmsg
Exceptions that can be thrown from StoreGate.
static Double_t sc
Handle for requesting thinning: factor out type-independent code.
Hold thinning decisions for one container.
Hold thinning decisions for one container.
void thin(size_t ndx)
Mark that index ndx in the container should be thinned away.
ThinningHandleBase(const WriteHandleKey< ThinningDecision > &dkey, const std::string &sgkey, const EventContext &ctx)
Constructor.
void thinAll()
Mark that all elements should be thinned away.
const ThinningDecision & decision() const
Return the thinning object we're building.
void keepAll()
Mark that all elements should be kept (not thinned).
std::unique_ptr< ThinningDecision > m_decision
The thinning object we're building.
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
WriteHandle< ThinningDecision > m_decisionHandle
Handle for writing the decision object.
ThinningDecision::Op Op
Property holding a SG store/key/clid from which a WriteHandle is made.
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
Forward declaration.
STL namespace.
MsgStream & msg
Definition testRead.cxx:32