ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
ViewCreatorPreviousROITool Class Reference

#include <ViewCreatorPreviousROITool.h>

Inheritance diagram for ViewCreatorPreviousROITool:
Collaboration diagram for ViewCreatorPreviousROITool:

Public Member Functions

 ViewCreatorPreviousROITool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~ViewCreatorPreviousROITool ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode attachROILinks (TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
 Tool interface method. More...
 

Public Attributes

Gaudi::Property< std::string > m_roiSGKey
 
SG::WriteHandleKey< TrigRoiDescriptorCollectionm_roisWriteHandleKey
 

Detailed Description

Basic ROI provider tool which retrieves and re-attaches an existing "roi" ElementLink. This implies running the EventView spawned for the Decision object on the ROIDescriptor originating from the previous step.

This basic tool should be replaced with more advanced slice-specific ones where appropriate.

Definition at line 18 of file ViewCreatorPreviousROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorPreviousROITool()

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

Definition at line 13 of file ViewCreatorPreviousROITool.cxx.

14  : base_class(type, name, parent)
15  {}

◆ ~ViewCreatorPreviousROITool()

virtual ViewCreatorPreviousROITool::~ViewCreatorPreviousROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

StatusCode ViewCreatorPreviousROITool::attachROILinks ( TrigCompositeUtils::DecisionContainer decisions,
const EventContext &  ctx 
) const
overridevirtual

Tool interface method.

Context not used in this tool implementation.

Definition at line 22 of file ViewCreatorPreviousROITool.cxx.

22  {
23  // Locate "roi" for each Decision object from previous step, re-attach the ElementLink as "roi" to the current Decision object.
24  // I.e. don't update the "roi", just re-use the one from the previous Step.
25 
26  for ( Decision* outputDecision : decisions ) {
27  const std::vector<LinkInfo<TrigRoiDescriptorCollection>> myROIs = findLinks<TrigRoiDescriptorCollection>(outputDecision, roiString(), TrigDefs::lastFeatureOfType);
28 
29  int location = -1;
30 
31  if (myROIs.size() == 0) {
32  ATH_MSG_ERROR("Found zero '" << roiString() << "' for Decision object index " << outputDecision->index());
33  } else if (myROIs.size() == 1) {
34  location = 0;
35  } else if (not m_roiSGKey.empty()) { // Note: Also requires that size be > 1
36  for (size_t i = 0; i < myROIs.size(); ++i) {
37  if (myROIs.at(i).link.dataID() == m_roiSGKey) {
38  ATH_MSG_DEBUG("Found " << myROIs.size() << " RoI links. However, successfully resolved the ambiguity using roiSGKey=" << m_roiSGKey << ", taking index " << location);
39  location = i;
40  break;
41  }
42  }
43  }
44 
45  if (location == -1) {
46  ATH_MSG_ERROR("Did not find exactly one '" << roiString() << "' for Decision object index " << outputDecision->index()
47  << ", found " << myROIs.size() << ". Unable to supply single ROI to spawn EventView on.");
48  for (const auto& li : myROIs) {
49  ATH_MSG_ERROR(" -- " << li.link.dataID() << ":" << li.link.index() << ". Dump:" << *(li.source));
50  }
51  return StatusCode::FAILURE;
52  }
53 
54  outputDecision->setObjectLink(roiString(), myROIs.at(location).link);
55  }
56 
57  // If this property is set, we actually want to copy the ROIs into a new container. For disambiguation purposes
58  if (!m_roisWriteHandleKey.empty()) {
59  std::map<ElementLink<TrigRoiDescriptorCollection>, ElementLink<TrigRoiDescriptorCollection>> oldToNew;
61 
62  for ( Decision* outputDecision : decisions ) {
63 
64  // Only copy each unique ROI once into the output collection.
67  if (oldToNew.count(oldRoI) == 1) {
68  newRoI = oldToNew[oldRoI];
69  } else {
70  roisWriteHandle->push_back( new TrigRoiDescriptor( **oldRoI ) );
71  newRoI = ElementLink<TrigRoiDescriptorCollection>(*roisWriteHandle, roisWriteHandle->size() - 1, ctx);
72  oldToNew[oldRoI] = newRoI;
73  }
74 
75  // Update the link. Note: overwries the link set of L54
76  outputDecision->setObjectLink(roiString(), newRoI);
77  }
78  }
79 
80 
81  return StatusCode::SUCCESS;
82 }

◆ initialize()

StatusCode ViewCreatorPreviousROITool::initialize ( )
overridevirtual

Definition at line 17 of file ViewCreatorPreviousROITool.cxx.

17  {
19  return StatusCode::SUCCESS;
20 }

Member Data Documentation

◆ m_roiSGKey

Gaudi::Property< std::string > ViewCreatorPreviousROITool::m_roiSGKey
Initial value:
{this, "RoISGKey", "",
"Optional StorgeGate key of ROI collection. Use this when an ambiguous situation needs resolving, e.g. after merging different reconstructon paths"}

Definition at line 32 of file ViewCreatorPreviousROITool.h.

◆ m_roisWriteHandleKey

SG::WriteHandleKey< TrigRoiDescriptorCollection > ViewCreatorPreviousROITool::m_roisWriteHandleKey
Initial value:
{this,"RoisWriteHandleKey", "",
"Optional StoreGate key, will cause this Tool to create a new output ROI collection, instead of re-using the existing links."}

Definition at line 35 of file ViewCreatorPreviousROITool.h.


The documentation for this class was generated from the following files:
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ViewCreatorPreviousROITool::m_roiSGKey
Gaudi::Property< std::string > m_roiSGKey
Definition: ViewCreatorPreviousROITool.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
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
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Creates and right away records the Container CONT with the key.
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ViewCreatorPreviousROITool::m_roisWriteHandleKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Definition: ViewCreatorPreviousROITool.h:35
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle< TrigRoiDescriptorCollection >
TrigRoiDescriptorCollection
Definition: TrigRoiDescriptorCollection.h:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:876
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.