ATLAS Offline Software
Loading...
Searching...
No Matches
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.
 ~ThinningHandleBase ()
 Destructor.
void thin (size_t ndx)
 Mark that index ndx in the container should be thinned away.
void keep (size_t ndx)
 Mark that index ndx in the container should be kept (not thinned away).
void thin (const std::vector< bool > &v, Op op=Op::Set)
 Set the thinning state for the container from a bitmask.
void keep (const std::vector< bool > &v, Op op=Op::Set)
 Set the thinning state for the container from a bitmask.
void thin (const ThinningDecisionBase &other, Op op=Op::Set)
 Set the thinning state for the container from a bitmask.
void keep (const ThinningDecisionBase &other, Op op=Op::Set)
 Set the thinning state for the container from a bitmask.
void thinAll ()
 Mark that all elements should be thinned away.
void keepAll ()
 Mark that all elements should be kept (not thinned).
const ThinningDecisiondecision () const
 Return the thinning object we're building.

Private Attributes

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

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

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}
std::unique_ptr< ThinningDecision > m_decision
The thinning object we're building.
WriteHandle< ThinningDecision > m_decisionHandle
Handle for writing the decision object.

◆ ~ThinningHandleBase()

SG::ThinningHandleBase::~ThinningHandleBase ( )

Destructor.

Records the thinning decision object in StoreGate.

Definition at line 41 of file ThinningHandleBase.cxx.

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}
#define endmsg
static Double_t sc
IMessageSvc * getMessageSvc(bool quiet=false)
::StatusCode StatusCode
StatusCode definition for legacy code.
MsgStream & msg
Definition testRead.cxx:32

Member Function Documentation

◆ decision()

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

Return the thinning object we're building.

Definition at line 161 of file ThinningHandleBase.cxx.

162{
163 return *m_decision;
164}

◆ 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 105 of file ThinningHandleBase.cxx.

106{
107 m_decision->keep (v, op);
108}

◆ 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 134 of file ThinningHandleBase.cxx.

135{
136 m_decision->keep (other, op);
137}

◆ 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 75 of file ThinningHandleBase.cxx.

76{
77 m_decision->keep (ndx);
78}

◆ keepAll()

void SG::ThinningHandleBase::keepAll ( )

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

Definition at line 152 of file ThinningHandleBase.cxx.

153{
154 return m_decision->keepAll();
155}

◆ 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 90 of file ThinningHandleBase.cxx.

91{
92 m_decision->thin (v, op);
93}

◆ 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 119 of file ThinningHandleBase.cxx.

120{
121 m_decision->thin (other, op);
122}

◆ 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 64 of file ThinningHandleBase.cxx.

65{
66 m_decision->thin (ndx);
67}

◆ thinAll()

void SG::ThinningHandleBase::thinAll ( )

Mark that all elements should be thinned away.

Definition at line 143 of file ThinningHandleBase.cxx.

144{
145 return m_decision->thinAll();
146}

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: