ATLAS Offline Software
Loading...
Searching...
No Matches
CP::SelectionAccessorList Class Referencefinal

the SelectionAccesor for list of selection decorations More...

#include <SelectionAccessorList.h>

Inheritance diagram for CP::SelectionAccessorList:
Collaboration diagram for CP::SelectionAccessorList:

Public Member Functions

 SelectionAccessorList (std::vector< std::unique_ptr< ISelectionReadAccessor > > val_list)
virtual SelectionType getBits (const SG::AuxElement &element, const CP::SystematicSet *sys) const override
 get the selection decoration
virtual bool getBool (const SG::AuxElement &element, const CP::SystematicSet *sys) const override
 get the selection decoration
virtual std::string label () const override
 get the label of the accessor
virtual bool isBool () const override
 whether this accessor returns a simple boolean
virtual CP::SystematicSet getInputAffecting (const ISystematicsSvc &svc, const std::string &objectName) const override
 get the systematics when reading from the decoration
virtual StatusCode fillSystematics (const ISystematicsSvc &svc, const std::vector< CP::SystematicSet > &sysList, const std::string &objectName) override
 fill the systematic variations

Private Attributes

std::vector< std::unique_ptr< ISelectionReadAccessor > > m_list
 the list of selection accessors I rely on
std::string m_label
 the label of the accessor

Detailed Description

the SelectionAccesor for list of selection decorations

Definition at line 21 of file SelectionAccessorList.h.

Constructor & Destructor Documentation

◆ SelectionAccessorList()

CP::SelectionAccessorList::SelectionAccessorList ( std::vector< std::unique_ptr< ISelectionReadAccessor > > val_list)

Definition at line 22 of file SelectionAccessorList.cxx.

24 : m_list (std::move (val_list))
25 {
26 for (const std::unique_ptr<ISelectionReadAccessor> &acc : m_list)
27 {
28 if (!m_label.empty())
29 m_label.append(" && ");
30
31 m_label.append(acc->label());
32 }
33
34 m_label = "( " + m_label + " )";
35 }
std::string m_label
the label of the accessor
std::vector< std::unique_ptr< ISelectionReadAccessor > > m_list
the list of selection accessors I rely on
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.

Member Function Documentation

◆ fillSystematics()

StatusCode CP::SelectionAccessorList::fillSystematics ( const ISystematicsSvc & svc,
const std::vector< CP::SystematicSet > & sysList,
const std::string & objectName )
overridevirtual

fill the systematic variations

Implements CP::ISelectionReadAccessor.

Definition at line 110 of file SelectionAccessorList.cxx.

114 {
115 using namespace msgSelectionHelpers;
116
117 for (auto& base : m_list)
118 ANA_CHECK (base->fillSystematics (svc, sysList, objectName));
119 return StatusCode::SUCCESS;
120 }
#define ANA_CHECK(EXP)
check whether the given expression was successful
std::string base
Definition hcg.cxx:81

◆ getBits()

SelectionType CP::SelectionAccessorList::getBits ( const SG::AuxElement & element,
const CP::SystematicSet * sys ) const
overridevirtual

get the selection decoration

Implements CP::ISelectionReadAccessor.

Definition at line 39 of file SelectionAccessorList.cxx.

42 {
43 // total number of bits in SelectionType
44 constexpr size_t SelectionTotalBits = 8 * sizeof (SelectionType);
45
46 // if we have more cuts than bits, just return true/false
47 if (m_list.size() > SelectionTotalBits)
48 {
49 if (getBool (element, sys))
50 return selectionAccept();
51 else
52 return 0;
53 }
54
56 for (std::size_t iter = 0; iter != m_list.size(); ++ iter)
57 {
58 if (m_list[iter]->getBool (element, sys) == false)
59 {
60 result = result & ~(SelectionType (1) << iter);
61 }
62 }
63 return result;
64 }
virtual bool getBool(const SG::AuxElement &element, const CP::SystematicSet *sys) const override
get the selection decoration
uint32_t SelectionType
the type for selection decorations that are meant to hold a asg::AcceptData
constexpr SelectionType selectionAccept()
the selection decoration to apply for objects that are selected

◆ getBool()

bool CP::SelectionAccessorList::getBool ( const SG::AuxElement & element,
const CP::SystematicSet * sys ) const
overridevirtual

get the selection decoration

Implements CP::ISelectionReadAccessor.

Definition at line 68 of file SelectionAccessorList.cxx.

71 {
72 for (auto& accessor : m_list)
73 {
74 if (!accessor->getBool (element, sys))
75 return false;
76 }
77 return true;
78 }
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.

◆ getInputAffecting()

CP::SystematicSet CP::SelectionAccessorList::getInputAffecting ( const ISystematicsSvc & svc,
const std::string & objectName ) const
overridevirtual

get the systematics when reading from the decoration

Implements CP::ISelectionReadAccessor.

Definition at line 97 of file SelectionAccessorList.cxx.

100 {
101 CP::SystematicSet result;
102
103 for (auto& base : m_list)
104 result.insert (base->getInputAffecting (svc, objectName));
105 return result;
106 }

◆ isBool()

bool CP::SelectionAccessorList::isBool ( ) const
overridevirtual

whether this accessor returns a simple boolean

Implements CP::ISelectionReadAccessor.

Definition at line 89 of file SelectionAccessorList.cxx.

91 {
92 return false;
93 }

◆ label()

std::string CP::SelectionAccessorList::label ( ) const
overridevirtual

get the label of the accessor

Implements CP::ISelectionReadAccessor.

Definition at line 81 of file SelectionAccessorList.cxx.

83 {
84 return m_label;
85 }

Member Data Documentation

◆ m_label

std::string CP::SelectionAccessorList::m_label
private

the label of the accessor

Definition at line 68 of file SelectionAccessorList.h.

◆ m_list

std::vector<std::unique_ptr<ISelectionReadAccessor> > CP::SelectionAccessorList::m_list
private

the list of selection accessors I rely on

Definition at line 64 of file SelectionAccessorList.h.


The documentation for this class was generated from the following files: