ATLAS Offline Software
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
RoIsUnpackingToolBase Class Reference

Base class for RoI unpackers. More...

#include <RoIsUnpackingToolBase.h>

Inheritance diagram for RoIsUnpackingToolBase:
Collaboration diagram for RoIsUnpackingToolBase:

Public Member Functions

 RoIsUnpackingToolBase (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual StatusCode unpack (const EventContext &, const ROIB::RoIBResult &, const HLT::IDSet &) const override
 
virtual StatusCode unpack (const EventContext &, const xAOD::TrigComposite &, const HLT::IDSet &) const override
 

Protected Types

using ThrVec = std::vector< std::shared_ptr< TrigConf::L1Threshold > >
 
using ThrVecRef = std::reference_wrapper< const ThrVec >
 

Protected Member Functions

StatusCode getL1Thresholds (const TrigConf::L1Menu &l1Menu, const std::string &thrType, std::optional< ThrVecRef > &thrVec) const
 Retrieve a vector of thresholds with type thrType from L1Menu. More...
 
StatusCode decodeMapping (std::function< bool(const std::string &)> &&filter)
 Fills mapping from L1 threshold -> to HLT chain. More...
 
void addChainsToDecision (HLT::Identifier thresholdId, TrigCompositeUtils::Decision *d, const HLT::IDSet &activeChains) const
 

Static Protected Member Functions

static std::string getProbeThresholdName (const std::string &thresholdName)
 Concatenate the probe identifier string with the threshold name string. More...
 

Protected Attributes

ToolHandle< GenericMonitoringToolm_monTool { this, "MonTool", "", "Monitoring tool" }
 
ToolHandle< IRoiUpdaterToolm_roiupdater { this, "RoiUpdater", "", "Roi Updater" }
 
std::map< HLT::Identifier, HLT::IDVecm_thresholdToChainMapping
 
std::map< HLT::Identifier, HLT::Identifierm_legToChainMapping
 

Detailed Description

Base class for RoI unpackers.

Provides common features needed by all unpackers. By itself it does not do anything useful.

Definition at line 32 of file RoIsUnpackingToolBase.h.

Member Typedef Documentation

◆ ThrVec

using RoIsUnpackingToolBase::ThrVec = std::vector<std::shared_ptr<TrigConf::L1Threshold> >
protected

Definition at line 73 of file RoIsUnpackingToolBase.h.

◆ ThrVecRef

using RoIsUnpackingToolBase::ThrVecRef = std::reference_wrapper<const ThrVec>
protected

Definition at line 74 of file RoIsUnpackingToolBase.h.

Constructor & Destructor Documentation

◆ RoIsUnpackingToolBase()

RoIsUnpackingToolBase::RoIsUnpackingToolBase ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 10 of file RoIsUnpackingToolBase.cxx.

13  : base_class(type, name, parent) {}

Member Function Documentation

◆ addChainsToDecision()

void RoIsUnpackingToolBase::addChainsToDecision ( HLT::Identifier  thresholdId,
TrigCompositeUtils::Decision d,
const HLT::IDSet activeChains 
) const
protected

Definition at line 88 of file RoIsUnpackingToolBase.cxx.

90  {
91  auto chains = m_thresholdToChainMapping.find( thresholdId );
92  if ( chains == m_thresholdToChainMapping.end() ) {
93  ATH_MSG_DEBUG("Threshold not known " << thresholdId);
94  return;
95  }
96 
98  for ( auto chainId: chains->second ) {
99  if ( activeChains.find(chainId) != activeChains.end() ) {
100  ids.insert( chainId.numeric() );
101  ATH_MSG_DEBUG( "Added " << chainId << " to the RoI/threshold decision " << thresholdId );
102  } else { // maybe it is a leg?
103  auto legIterator = m_legToChainMapping.find( chainId );
104  if ( legIterator != m_legToChainMapping.end() ) {
105  // this is a leg we care about, need to check if respective chain was active, and activate
106  if ( activeChains.find( legIterator->second ) != activeChains.end() ) {
107  ids.insert( chainId.numeric() );
108  ATH_MSG_DEBUG( "Added " << chainId << " to the RoI/threshold decision " << thresholdId );
109  }
110  }
111  }
112  }
114  ATH_MSG_DEBUG( "Number of decisions in this RoI after adding chains using threshold " << thresholdId
115  << " " << TrigCompositeUtils::decisionIDs( d ).size() );
116 }

◆ decodeMapping()

StatusCode RoIsUnpackingToolBase::decodeMapping ( std::function< bool(const std::string &)> &&  filter)
protected

Fills mapping from L1 threshold -> to HLT chain.

  • filter Function that, using the threshold name, defines if this decoder instance should take care of this threshold

Definition at line 52 of file RoIsUnpackingToolBase.cxx.

52  {
54  ATH_CHECK( hltMenuHandle.isValid() );
55  // Cleanup in case there was a stop/start transition
57 
58  for ( const TrigConf::Chain& chain: *hltMenuHandle ) {
59  const HLT::Identifier chainIdentifier(chain.name());
60  const std::vector<std::string> thresholds{ chain.l1thresholds() };
61  const std::vector<size_t> legMultiplicities{ chain.legMultiplicities() };
62  if (thresholds.size() != legMultiplicities.size()) {
63  ATH_MSG_ERROR("Encountered a chain " << chain.name() << " with " << legMultiplicities.size()
64  << " legs but only " << thresholds.size() << " thresholds. These should be the same.");
65  return StatusCode::FAILURE;
66  }
67  size_t counter = 0;
68  for ( const std::string& th: thresholds ) {
69  if ( filter(th) ) {
70  const HLT::Identifier thresholdIdentifier(th);
71  m_thresholdToChainMapping[ thresholdIdentifier ].push_back( chainIdentifier );
72  ATH_MSG_DEBUG( "Associating " << chainIdentifier << " with threshold " << th );
73  if ( thresholds.size() > 1 ) {
74  HLT::Identifier legIdentifier = TrigCompositeUtils::createLegName(chainIdentifier, counter);
75  m_thresholdToChainMapping[ thresholdIdentifier ].push_back( legIdentifier );
76  m_legToChainMapping.insert( std::make_pair( legIdentifier, chainIdentifier ) );
77  ATH_MSG_DEBUG( "Associating additional chain leg " << legIdentifier
78  << " with threshold " << thresholdIdentifier );
79  }
80  }
81  ++counter;
82  }
83  }
84  return StatusCode::SUCCESS;
85 }

◆ getL1Thresholds()

StatusCode RoIsUnpackingToolBase::getL1Thresholds ( const TrigConf::L1Menu l1Menu,
const std::string &  thrType,
std::optional< ThrVecRef > &  thrVec 
) const
protected

Retrieve a vector of thresholds with type thrType from L1Menu.

Parameters
[in]l1MenuThe L1Menu object
[in]thrTypeThe threshold type, e.g. EM, MU, eTAU
[out]thrVecThe output will be passed into this parameter
Returns
FAILURE on exception reading the menu (e.g. thrType not in menu), SUCCESS otherwise

Definition at line 33 of file RoIsUnpackingToolBase.cxx.

35  {
36  try {
37  thrVec = ThrVecRef(l1Menu.thresholds(thrType));
38  }
39  catch (const std::exception& ex) {
40  ATH_MSG_ERROR("Failed to retrieve " << thrType << " thresholds from L1 menu. Exception:" << ex.what());
41  return StatusCode::FAILURE;
42  }
43  return StatusCode::SUCCESS;
44 }

◆ getProbeThresholdName()

std::string RoIsUnpackingToolBase::getProbeThresholdName ( const std::string &  thresholdName)
staticprotected

Concatenate the probe identifier string with the threshold name string.

Creates an alternate threshold name, used by lower pT probe legs of tag+probe chains.

Definition at line 47 of file RoIsUnpackingToolBase.cxx.

47  {
48  return "PROBE" + thresholdName;
49 }

◆ initialize()

StatusCode RoIsUnpackingToolBase::initialize ( )
overridevirtual

should this really be here if it is only accessed in derived classes ?

Reimplemented in MURoIsUnpackingTool, EMRoIsUnpackingTool, JRoIsUnpackingTool, RoIsUnpackingEmulationTool, TAURoIsUnpackingTool, METRoIsUnpackingTool, and FSRoIsUnpackingTool.

Definition at line 16 of file RoIsUnpackingToolBase.cxx.

16  {
17 
18  if ( !m_monTool.empty() ) ATH_CHECK( m_monTool.retrieve() );
21  if ( !m_roiupdater.empty() ) ATH_CHECK( m_roiupdater.retrieve() );
22 
23  ATH_CHECK( m_decisionsKey.initialize() );
28 
29  return StatusCode::SUCCESS;
30 }

◆ unpack() [1/2]

virtual StatusCode RoIsUnpackingToolBase::unpack ( const EventContext &  ,
const ROIB::RoIBResult ,
const HLT::IDSet  
) const
inlineoverridevirtual

◆ unpack() [2/2]

virtual StatusCode RoIsUnpackingToolBase::unpack ( const EventContext &  ,
const xAOD::TrigComposite ,
const HLT::IDSet  
) const
inlineoverridevirtual

Definition at line 44 of file RoIsUnpackingToolBase.h.

46  { return StatusCode::SUCCESS; }

Member Data Documentation

◆ m_decisionsKey

SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> RoIsUnpackingToolBase::m_decisionsKey
protected
Initial value:
{
this, "Decisions", "RoIDecisions", "Decisions for each RoI"}

Definition at line 51 of file RoIsUnpackingToolBase.h.

◆ m_decisionsKeyProbe

SG::WriteHandleKey<TrigCompositeUtils::DecisionContainer> RoIsUnpackingToolBase::m_decisionsKeyProbe
protected
Initial value:
{
this, "DecisionsProbe", "", "Optional secondary set of Decisions for each RoI for probe a.k.a. delayed a.k.a. rerun chains"}

Definition at line 54 of file RoIsUnpackingToolBase.h.

◆ m_HLTMenuKey

SG::ReadHandleKey<TrigConf::HLTMenu> RoIsUnpackingToolBase::m_HLTMenuKey
protected
Initial value:
{
this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", "Name of the HLTMenu object to read configuration from"}

Definition at line 63 of file RoIsUnpackingToolBase.h.

◆ m_l1MenuKey

SG::ReadHandleKey<TrigConf::L1Menu> RoIsUnpackingToolBase::m_l1MenuKey
protected
Initial value:
{
this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "Name of the L1Menu object to read configuration from"}

Definition at line 60 of file RoIsUnpackingToolBase.h.

◆ m_legToChainMapping

std::map<HLT::Identifier, HLT::Identifier> RoIsUnpackingToolBase::m_legToChainMapping
protected

Definition at line 71 of file RoIsUnpackingToolBase.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool> RoIsUnpackingToolBase::m_monTool { this, "MonTool", "", "Monitoring tool" }
protected

Definition at line 67 of file RoIsUnpackingToolBase.h.

◆ m_roiupdater

ToolHandle<IRoiUpdaterTool> RoIsUnpackingToolBase::m_roiupdater { this, "RoiUpdater", "", "Roi Updater" }
protected

Definition at line 68 of file RoIsUnpackingToolBase.h.

◆ m_thresholdToChainMapping

std::map<HLT::Identifier, HLT::IDVec> RoIsUnpackingToolBase::m_thresholdToChainMapping
protected

Definition at line 70 of file RoIsUnpackingToolBase.h.

◆ m_trigRoIsKey

SG::WriteHandleKey<TrigRoiDescriptorCollection> RoIsUnpackingToolBase::m_trigRoIsKey
protected
Initial value:
{
this, "OutputTrigRoIs", "", "Name of the RoIs collection produced by the unpacker"}

Definition at line 57 of file RoIsUnpackingToolBase.h.


The documentation for this class was generated from the following files:
RoIsUnpackingToolBase::m_roiupdater
ToolHandle< IRoiUpdaterTool > m_roiupdater
Definition: RoIsUnpackingToolBase.h:68
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
hist_file_dump.d
d
Definition: hist_file_dump.py:137
RoIsUnpackingToolBase::ThrVecRef
std::reference_wrapper< const ThrVec > ThrVecRef
Definition: RoIsUnpackingToolBase.h:74
TrigCompositeUtils::insertDecisionIDs
void insertDecisionIDs(const Decision *src, Decision *dest)
Appends the decision IDs of src to the dest decision object.
Definition: TrigCompositeUtilsRoot.cxx:80
covarianceTool.filter
filter
Definition: covarianceTool.py:514
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
RoIsUnpackingToolBase::m_decisionsKeyProbe
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKeyProbe
Definition: RoIsUnpackingToolBase.h:54
python.TriggerHandler.th
th
Definition: TriggerHandler.py:296
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
RoIsUnpackingToolBase::m_legToChainMapping
std::map< HLT::Identifier, HLT::Identifier > m_legToChainMapping
Definition: RoIsUnpackingToolBase.h:71
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
calibdata.exception
exception
Definition: calibdata.py:496
TrigConf::L1Menu::thresholds
std::vector< std::shared_ptr< TrigConf::L1Threshold > > thresholds() const
Access to list of all L1Thresholds.
Definition: L1Menu.cxx:267
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
RoIsUnpackingToolBase::m_decisionsKey
SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > m_decisionsKey
Definition: RoIsUnpackingToolBase.h:51
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
RoIsUnpackingToolBase::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: RoIsUnpackingToolBase.h:67
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
TrigCompositeUtils::createLegName
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
Definition: TrigCompositeUtilsRoot.cxx:166
RoIsUnpackingToolBase::m_trigRoIsKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_trigRoIsKey
Definition: RoIsUnpackingToolBase.h:57
RoIsUnpackingToolBase::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: RoIsUnpackingToolBase.h:60
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RoIsUnpackingToolBase::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: RoIsUnpackingToolBase.h:63
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
RoIsUnpackingToolBase::m_thresholdToChainMapping
std::map< HLT::Identifier, HLT::IDVec > m_thresholdToChainMapping
Definition: RoIsUnpackingToolBase.h:70
TrigConf::Chain
HLT chain configuration.
Definition: TrigConfData/TrigConfData/HLTChain.h:18
test_pyathena.counter
counter
Definition: test_pyathena.py:15
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30