ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CP::SelectionAccessorReadSys Class Referencefinal

the SelectionAccesor for reading systematically varied decorations More...

#include <SelectionAccessorReadSys.h>

Inheritance diagram for CP::SelectionAccessorReadSys:
Collaboration diagram for CP::SelectionAccessorReadSys:

Public Member Functions

 SelectionAccessorReadSys (const std::string &val_selectionName)
 
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::unordered_map< CP::SystematicSet, std::tuple< std::string, std::unique_ptr< ISelectionReadAccessor > > > m_dataCache
 the map of accessor we use More...
 
std::string m_selectionName
 the selectionName for this accessor More...
 

Detailed Description

the SelectionAccesor for reading systematically varied decorations

Definition at line 22 of file SelectionAccessorReadSys.h.

Constructor & Destructor Documentation

◆ SelectionAccessorReadSys()

CP::SelectionAccessorReadSys::SelectionAccessorReadSys ( const std::string &  val_selectionName)

Definition at line 23 of file SelectionAccessorReadSys.cxx.

25  : m_selectionName (val_selectionName)
26  {}

Member Function Documentation

◆ fillSystematics()

StatusCode CP::SelectionAccessorReadSys::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 89 of file SelectionAccessorReadSys.cxx.

93  {
94  using namespace msgSelectionHelpers;
95 
96  std::string baseName = m_selectionName;
97  std::string suffix;
98  if (auto split = baseName.find (',');
99  split != std::string::npos)
100  {
101  suffix = baseName.substr (split);
102  baseName.resize (split);
103  }
104 
105  const CP::SystematicSet affecting
106  = svc.getDecorSystematics (objectName, baseName);
107  for (auto& sys : sysList)
108  {
109  CP::SystematicSet inputSys;
111  std::string decorName;
112  ANA_CHECK (svc.makeSystematicsName (decorName, baseName, inputSys));
113  ANA_MSG_DEBUG ("SysReadDecorHandle: " << decorName << " (" << sys.name() << ")");
114  std::unique_ptr<ISelectionReadAccessor> accessor;
116  m_dataCache.emplace (sys, std::make_tuple (decorName, std::move (accessor)));
117  }
118  return StatusCode::SUCCESS;
119  }

◆ getBits()

SelectionType CP::SelectionAccessorReadSys::getBits ( const SG::AuxElement element,
const CP::SystematicSet sys 
) const
overridevirtual

get the selection decoration

Implements CP::ISelectionReadAccessor.

Definition at line 30 of file SelectionAccessorReadSys.cxx.

33  {
34  if (sys == nullptr)
35  throw std::logic_error ("trying to read systematics accessor without systematic");
36  auto iter = m_dataCache.find (*sys);
37  if (iter == m_dataCache.end())
38  throw std::logic_error ("unknown systematic: " + sys->name());
39  return std::get<1>(iter->second)->getBits (element, sys);
40  }

◆ getBool()

bool CP::SelectionAccessorReadSys::getBool ( const SG::AuxElement element,
const CP::SystematicSet sys 
) const
overridevirtual

get the selection decoration

Implements CP::ISelectionReadAccessor.

Definition at line 44 of file SelectionAccessorReadSys.cxx.

47  {
48  if (sys == nullptr)
49  throw std::logic_error ("trying to read systematics accessor without systematic");
50  auto iter = m_dataCache.find (*sys);
51  if (iter == m_dataCache.end())
52  throw std::logic_error ("unknown systematic: " + sys->name());
53  return std::get<1>(iter->second)->getBool (element, sys);
54  }

◆ getInputAffecting()

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

get the systematics when reading from the decoration

Implements CP::ISelectionReadAccessor.

Definition at line 76 of file SelectionAccessorReadSys.cxx.

79  {
80  std::string baseName = m_selectionName;
81  if (auto split = baseName.find (',');
82  split != std::string::npos)
83  baseName.resize (split);
84  return svc.getDecorSystematics (objectName, baseName);
85  }

◆ isBool()

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

whether this accessor returns a simple boolean

Implements CP::ISelectionReadAccessor.

Definition at line 65 of file SelectionAccessorReadSys.cxx.

67  {
68  for (auto& item : m_dataCache)
69  if (!std::get<1>(item.second)->isBool())
70  return false;
71  return true;
72  }

◆ label()

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

get the label of the accessor

Implements CP::ISelectionReadAccessor.

Definition at line 57 of file SelectionAccessorReadSys.cxx.

59  {
60  return m_selectionName;
61  }

Member Data Documentation

◆ m_dataCache

std::unordered_map<CP::SystematicSet,std::tuple<std::string,std::unique_ptr<ISelectionReadAccessor> > > CP::SelectionAccessorReadSys::m_dataCache
private

the map of accessor we use

Definition at line 65 of file SelectionAccessorReadSys.h.

◆ m_selectionName

std::string CP::SelectionAccessorReadSys::m_selectionName
private

the selectionName for this accessor

Definition at line 69 of file SelectionAccessorReadSys.h.


The documentation for this class was generated from the following files:
CP::SelectionAccessorReadSys::m_dataCache
std::unordered_map< CP::SystematicSet, std::tuple< std::string, std::unique_ptr< ISelectionReadAccessor > > > m_dataCache
the map of accessor we use
Definition: SelectionAccessorReadSys.h:65
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
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::SelectionAccessorReadSys::m_selectionName
std::string m_selectionName
the selectionName for this accessor
Definition: SelectionAccessorReadSys.h:69
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
CP::makeSelectionReadAccessor
StatusCode makeSelectionReadAccessor(const std::string &expr, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
make the ISelectionReadAccessor for the given name
Definition: ISelectionAccessor.cxx:54
item
Definition: ItemListSvc.h:43
xAOD::JetAttributeAccessor::accessor
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
Definition: JetAccessorMap.h:26
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
CP::SystematicSet::filterForAffectingSystematics
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
Definition: SystematicSet.cxx:213
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288