ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 More...
 
virtual bool getBool (const SG::AuxElement &element, const CP::SystematicSet *sys) const override
 get the selection decoration More...
 
virtual std::string label () const override
 get the label of the accessor More...
 
virtual bool isBool () const override
 whether this accessor returns a simple boolean More...
 
virtual CP::SystematicSet getInputAffecting (const ISystematicsSvc &svc, const std::string &objectName) const override
 get the systematics when reading from the decoration More...
 
virtual StatusCode fillSystematics (const ISystematicsSvc &svc, const std::vector< CP::SystematicSet > &sysList, const std::string &objectName) override
 fill the systematic variations More...
 

Private Attributes

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

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  }

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  }

◆ 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  }

◆ 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  }

◆ 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  {
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:
base
std::string base
Definition: hcg.cxx:78
get_generator_info.result
result
Definition: get_generator_info.py:21
CP::SelectionType
uint32_t SelectionType
the type for selection decorations that are meant to hold a asg::AcceptData
Definition: SelectionHelpers.h:26
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
CP::SelectionAccessorList::m_label
std::string m_label
the label of the accessor
Definition: SelectionAccessorList.h:68
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CP::SelectionAccessorList::getBool
virtual bool getBool(const SG::AuxElement &element, const CP::SystematicSet *sys) const override
get the selection decoration
Definition: SelectionAccessorList.cxx:69
xAOD::JetAttributeAccessor::accessor
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
Definition: JetAccessorMap.h:26
CP::SelectionAccessorList::m_list
std::vector< std::unique_ptr< ISelectionReadAccessor > > m_list
the list of selection accessors I rely on
Definition: SelectionAccessorList.h:64
CP::selectionAccept
constexpr SelectionType selectionAccept()
the selection decoration to apply for objects that are selected
Definition: SelectionHelpers.h:35