ATLAS Offline Software
ThinningHandleBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
13 #include "StoreGate/exceptions.h"
15 
16 
17 namespace 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  if (m_decisionHandle.record (std::move (m_decision)).isFailure()) {
44  MsgStream msg (Athena::getMessageSvc(), "ThinningHandleBase");
45  msg << MSG::ERROR
46  << "Can't record SG::ThinningDecision object: "
47  << m_decisionHandle.store() << "+" << m_decisionHandle.key()
48  << endmsg;
49  }
50 }
51 
52 
57 void ThinningHandleBase::thin (size_t ndx)
58 {
59  m_decision->thin (ndx);
60 }
61 
62 
68 void ThinningHandleBase::keep (size_t ndx)
69 {
70  m_decision->keep (ndx);
71 }
72 
73 
83 void ThinningHandleBase::thin (const std::vector<bool>& v, Op op /*= Op::Set*/)
84 {
85  m_decision->thin (v, op);
86 }
87 
88 
98 void ThinningHandleBase::keep (const std::vector<bool>& v, Op op /*= Op::Set*/)
99 {
100  m_decision->keep (v, op);
101 }
102 
112 void ThinningHandleBase::thin (const ThinningDecisionBase& other, Op op /*= Op::Set*/)
113 {
114  m_decision->thin (other, op);
115 }
116 
117 
127 void ThinningHandleBase::keep (const ThinningDecisionBase& other, Op op /*= Op::Set*/)
128 {
129  m_decision->keep (other, op);
130 }
131 
132 
137 {
138  return m_decision->thinAll();
139 }
140 
141 
146 {
147  return m_decision->keepAll();
148 }
149 
150 
155 {
156  return *m_decision;
157 }
158 
159 
160 } // namespace SG
SG::ThinningHandleBase::thinAll
void thinAll()
Mark that all elements should be thinned away.
Definition: ThinningHandleBase.cxx:136
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
SG::ThinningHandleBase::keepAll
void keepAll()
Mark that all elements should be kept (not thinned).
Definition: ThinningHandleBase.cxx:145
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
SG::ThinningDecisionBase
Hold thinning decisions for one container.
Definition: ThinningDecisionBase.h:39
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
SG::ThinningHandleBase::keep
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Definition: ThinningHandleBase.cxx:68
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
exceptions.h
Exceptions that can be thrown from StoreGate.
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
SG::ThinningHandleBase::ThinningHandleBase
ThinningHandleBase(const WriteHandleKey< ThinningDecision > &dkey, const std::string &sgkey, const EventContext &ctx)
Constructor.
Definition: ThinningHandleBase.cxx:27
SG::ThinningDecision
Hold thinning decisions for one container.
Definition: ThinningDecision.h:40
SG::ThinningHandleBase::decision
const ThinningDecision & decision() const
Return the thinning object we're building.
Definition: ThinningHandleBase.cxx:154
SG::ThinningHandleBase::m_decision
std::unique_ptr< ThinningDecision > m_decision
The thinning object we're building.
Definition: ThinningHandleBase.h:141
SG::ThinningHandleBase::thin
void thin(size_t ndx)
Mark that index ndx in the container should be thinned away.
Definition: ThinningHandleBase.cxx:57
SG::ThinningDecisionBase::Op
Op
Definition: ThinningDecisionBase.h:44
python.PyAthena.v
v
Definition: PyAthena.py:154
SG::ThinningHandleBase::~ThinningHandleBase
~ThinningHandleBase()
Destructor.
Definition: ThinningHandleBase.cxx:41
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::ThinningHandleBase::m_decisionHandle
WriteHandle< ThinningDecision > m_decisionHandle
Handle for writing the decision object.
Definition: ThinningHandleBase.h:138
ThinningHandleBase.h
Handle for requesting thinning: factor out type-independent code.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7