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

the SelectionAccesor for reading systematically varied decorations More...

#include <SelectionWriteAccessorSys.h>

Inheritance diagram for CP::SelectionWriteAccessorSys:
Collaboration diagram for CP::SelectionWriteAccessorSys:

Public Member Functions

 SelectionWriteAccessorSys (const std::string &val_selectionName)
 
virtual void setBits (const SG::AuxElement &element, SelectionType selection, const CP::SystematicSet *sys) const override
 set the selection decoration More...
 
virtual void setBool (const SG::AuxElement &element, bool selection, const CP::SystematicSet *sys) const override
 set the selection decoration More...
 
virtual std::string label () const override
 get the label of the accessor More...
 
virtual StatusCode fillSystematics (const ISystematicsSvc &svc, const CP::SystematicSet &fullAffecting, 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< ISelectionWriteAccessor > > > 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 SelectionWriteAccessorSys.h.

Constructor & Destructor Documentation

◆ SelectionWriteAccessorSys()

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

Definition at line 23 of file SelectionWriteAccessorSys.cxx.

25  : m_selectionName (val_selectionName)
26  {}

Member Function Documentation

◆ fillSystematics()

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

fill the systematic variations

Implements CP::ISelectionWriteAccessor.

Definition at line 68 of file SelectionWriteAccessorSys.cxx.

73  {
74  using namespace msgSelectionHelpers;
75 
76  std::string baseName = m_selectionName;
77  std::string suffix;
78  if (auto split = baseName.find (',');
79  split != std::string::npos)
80  {
81  suffix = baseName.substr (split);
82  baseName.resize (split);
83  }
84 
85  for (auto& sys : sysList)
86  {
87  std::string decorName;
88  ANA_CHECK (svc.makeSystematicsName (decorName, baseName, sys));
89  ANA_MSG_DEBUG ("SelectionWriteAccessorSys: " << decorName << " (" << sys.name() << ")");
90  std::unique_ptr<ISelectionWriteAccessor> accessor;
92  m_dataCache.emplace (sys, std::make_tuple (decorName, std::move (accessor)));
93  }
94  ANA_CHECK (svc.setDecorSystematics (objectName, baseName, fullAffecting));
95  return StatusCode::SUCCESS;
96  }

◆ label()

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

get the label of the accessor

Implements CP::ISelectionWriteAccessor.

Definition at line 60 of file SelectionWriteAccessorSys.cxx.

62  {
63  return m_selectionName;
64  }

◆ setBits()

void CP::SelectionWriteAccessorSys::setBits ( const SG::AuxElement element,
SelectionType  selection,
const CP::SystematicSet sys 
) const
overridevirtual

set the selection decoration

Implements CP::ISelectionWriteAccessor.

Definition at line 30 of file SelectionWriteAccessorSys.cxx.

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

◆ setBool()

void CP::SelectionWriteAccessorSys::setBool ( const SG::AuxElement element,
bool  selection,
const CP::SystematicSet sys 
) const
overridevirtual

set the selection decoration

Implements CP::ISelectionWriteAccessor.

Definition at line 45 of file SelectionWriteAccessorSys.cxx.

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

Member Data Documentation

◆ m_dataCache

std::unordered_map<CP::SystematicSet,std::tuple<std::string,std::unique_ptr<ISelectionWriteAccessor> > > CP::SelectionWriteAccessorSys::m_dataCache
private

the map of accessor we use

Definition at line 59 of file SelectionWriteAccessorSys.h.

◆ m_selectionName

std::string CP::SelectionWriteAccessorSys::m_selectionName
private

the selectionName for this accessor

Definition at line 63 of file SelectionWriteAccessorSys.h.


The documentation for this class was generated from the following files:
CP::SelectionWriteAccessorSys::m_selectionName
std::string m_selectionName
the selectionName for this accessor
Definition: SelectionWriteAccessorSys.h:63
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
CP::makeSelectionWriteAccessor
StatusCode makeSelectionWriteAccessor(const std::string &name, std::unique_ptr< ISelectionWriteAccessor > &accessor, bool defaultToChar)
Produces a simple ISelectionWriteAccessor accessing the given decoration.
Definition: ISelectionAccessor.cxx:170
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
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
selection
std::string selection
Definition: fbtTestBasics.cxx:75
CP::SelectionWriteAccessorSys::m_dataCache
std::unordered_map< CP::SystematicSet, std::tuple< std::string, std::unique_ptr< ISelectionWriteAccessor > > > m_dataCache
the map of accessor we use
Definition: SelectionWriteAccessorSys.h:59
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
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288