ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
SG::ThinningHandleBase Class Reference

Handle for requesting thinning: factor out type-independent code. More...

#include <ThinningHandleBase.h>

Inheritance diagram for SG::ThinningHandleBase:
Collaboration diagram for SG::ThinningHandleBase:

Public Types

using Op = ThinningDecision::Op
 

Public Member Functions

 ThinningHandleBase (const WriteHandleKey< ThinningDecision > &dkey, const std::string &sgkey, const EventContext &ctx)
 Constructor. More...
 
 ~ThinningHandleBase ()
 Destructor. More...
 
void thin (size_t ndx)
 Mark that index ndx in the container should be thinned away. More...
 
void keep (size_t ndx)
 Mark that index ndx in the container should be kept (not thinned away). More...
 
void thin (const std::vector< bool > &v, Op op=Op::Set)
 Set the thinning state for the container from a bitmask. More...
 
void keep (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 (const ThinningDecisionBase &other, Op op=Op::Set)
 Set the thinning state for the container from a bitmask. More...
 
void thinAll ()
 Mark that all elements should be thinned away. More...
 
void keepAll ()
 Mark that all elements should be kept (not thinned). More...
 
const ThinningDecisiondecision () const
 Return the thinning object we're building. More...
 

Private Attributes

WriteHandle< ThinningDecisionm_decisionHandle
 Handle for writing the decision object. More...
 
std::unique_ptr< ThinningDecisionm_decision
 The thinning object we're building. More...
 

Detailed Description

Handle for requesting thinning: factor out type-independent code.

Base class for ThinningHandle, which factors out the code that doesn't depend on the type of object being thinned.

Definition at line 31 of file ThinningHandleBase.h.

Member Typedef Documentation

◆ Op

Definition at line 34 of file ThinningHandleBase.h.

Constructor & Destructor Documentation

◆ ThinningHandleBase()

SG::ThinningHandleBase::ThinningHandleBase ( const WriteHandleKey< ThinningDecision > &  dkey,
const std::string &  sgkey,
const EventContext &  ctx 
)
explicit

Constructor.

Parameters
dkeyHandle key to use to write the ThinningDecision.
sgkeyStoreGate key of the object being thinned.
ctxEvent context.

Definition at line 26 of file ThinningHandleBase.cxx.

30  : m_decisionHandle (dkey, ctx),
31  m_decision (std::make_unique<ThinningDecision> (sgkey))
32 {
33 }

◆ ~ThinningHandleBase()

SG::ThinningHandleBase::~ThinningHandleBase ( )

Destructor.

Records the thinning decision object in StoreGate.

Definition at line 41 of file ThinningHandleBase.cxx.

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 }

Member Function Documentation

◆ decision()

const ThinningDecision & SG::ThinningHandleBase::decision ( ) const

Return the thinning object we're building.

Definition at line 154 of file ThinningHandleBase.cxx.

155 {
156  return *m_decision;
157 }

◆ keep() [1/3]

void SG::ThinningHandleBase::keep ( const std::vector< bool > &  v,
Op  op = Op::Set 
)

Set the thinning state for the container from a bitmask.

Parameters
vThinning state mask; should have the same size as the container. Element ndx should be kept if bit ndx is set in the map.
opLogical operation for combining with existing thinning state. Set — Keep if flag is true (overwriting anything originally set for this element). 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 98 of file ThinningHandleBase.cxx.

99 {
100  m_decision->keep (v, op);
101 }

◆ keep() [2/3]

void SG::ThinningHandleBase::keep ( const ThinningDecisionBase other,
Op  op = Op::Set 
)

Set the thinning state for the container from a bitmask.

Parameters
otherThinning state mask; should have the same size as the container. Element ndx should be kept if bit ndx is set in the map.
opLogical operation for combining with existing thinning state. Set — Keep if flag is true (overwriting anything originally set for this element). 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 127 of file ThinningHandleBase.cxx.

128 {
129  m_decision->keep (other, op);
130 }

◆ keep() [3/3]

void SG::ThinningHandleBase::keep ( size_t  ndx)

Mark that index ndx in the container should be kept (not thinned away).

Parameters
ndxIndex of element to keep.

Definition at line 68 of file ThinningHandleBase.cxx.

69 {
70  m_decision->keep (ndx);
71 }

◆ keepAll()

void SG::ThinningHandleBase::keepAll ( )

Mark that all elements should be kept (not thinned).

Definition at line 145 of file ThinningHandleBase.cxx.

146 {
147  return m_decision->keepAll();
148 }

◆ thin() [1/3]

void SG::ThinningHandleBase::thin ( const std::vector< bool > &  v,
Op  op = Op::Set 
)

Set the thinning state for the container from a bitmask.

Parameters
vThinning state mask; should have the same size as the container. Element ndx should be thinned if bit ndx is set in the map.
opLogical operation for combining with existing thinning state. Set — Thin if flag is true (overwriting anything originally set for this element). 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 83 of file ThinningHandleBase.cxx.

84 {
85  m_decision->thin (v, op);
86 }

◆ thin() [2/3]

void SG::ThinningHandleBase::thin ( const ThinningDecisionBase other,
Op  op = Op::Set 
)

Set the thinning state for the container from a bitmask.

Parameters
otherThinning state mask; should have the same size as the container. Element ndx should be thinned if bit ndx is set in the map.
opLogical operation for combining with existing thinning state. Set — Thin if flag is true (overwriting anything originally set for this element). 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 112 of file ThinningHandleBase.cxx.

113 {
114  m_decision->thin (other, op);
115 }

◆ thin() [3/3]

void SG::ThinningHandleBase::thin ( size_t  ndx)

Mark that index ndx in the container should be thinned away.

Parameters
ndxIndex of element to thin.

Definition at line 57 of file ThinningHandleBase.cxx.

58 {
59  m_decision->thin (ndx);
60 }

◆ thinAll()

void SG::ThinningHandleBase::thinAll ( )

Mark that all elements should be thinned away.

Definition at line 136 of file ThinningHandleBase.cxx.

137 {
138  return m_decision->thinAll();
139 }

Member Data Documentation

◆ m_decision

std::unique_ptr<ThinningDecision> SG::ThinningHandleBase::m_decision
private

The thinning object we're building.

Definition at line 141 of file ThinningHandleBase.h.

◆ m_decisionHandle

WriteHandle<ThinningDecision> SG::ThinningHandleBase::m_decisionHandle
private

Handle for writing the decision object.

Definition at line 138 of file ThinningHandleBase.h.


The documentation for this class was generated from the following files:
common.sgkey
def sgkey(tool)
Definition: common.py:1028
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
SG::ThinningHandleBase::m_decision
std::unique_ptr< ThinningDecision > m_decision
The thinning object we're building.
Definition: ThinningHandleBase.h:141
python.PyAthena.v
v
Definition: PyAthena.py:154
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
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7