ATLAS Offline Software
ViewCreatorExtraPrefetchROITool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 ViewCreatorExtraPrefetchROITool::ViewCreatorExtraPrefetchROITool(const std::string& type, const std::string& name, const IInterface* parent)
7 : base_class(type, name, parent) {}
8 
11  ATH_CHECK(m_roiCreator.retrieve());
12  ATH_CHECK(m_roiUpdater.retrieve());
13  return StatusCode::SUCCESS;
14 }
15 
17  using namespace TrigCompositeUtils;
18 
19  // Call the main RoI creator tool
20  ATH_CHECK(m_roiCreator->attachROILinks(decisions, eventContext));
21 
22  // Record the updated RoI container
24 
25  // Loop over all decisions and create updated RoI for each RoI linked by the main tool
26  for (Decision* decision : decisions) {
27  // Get the original RoI from the main tool
29  ATH_CHECK(roiEL.isValid());
30  const TrigRoiDescriptor* originalRoi = *roiEL;
31 
32  // Execute the updater tool
33  std::unique_ptr<TrigRoiDescriptor> updatedRoi = m_roiUpdater->execute(originalRoi, eventContext);
34 
35  // Add the updated (and merged if requested) RoI to the output container
36  if (m_mergeWithOriginal.value()) {
37  outputRois->push_back(std::make_unique<TrigRoiDescriptor>());
38  outputRois->back()->setComposite(true);
39  outputRois->back()->manageConstituents(true); // take ownership of the two objects added below
40  outputRois->back()->push_back(new TrigRoiDescriptor(*originalRoi));
41  outputRois->back()->push_back(updatedRoi.release());
42  } else {
43  outputRois->push_back(std::move(updatedRoi));
44  }
45 
46  // Link the last element of the output container to the current decision object
47  const ElementLink<TrigRoiDescriptorCollection> newRoiEL{*outputRois, outputRois->size()-1, eventContext};
48  decision->setObjectLink(m_extraRoiLinkName, newRoiEL);
49  }
50 
51  return StatusCode::SUCCESS;
52 }
ViewCreatorExtraPrefetchROITool.h
ViewCreatorExtraPrefetchROITool::m_roiCreator
ToolHandle< IViewCreatorROITool > m_roiCreator
Definition: ViewCreatorExtraPrefetchROITool.h:35
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
RoiDescriptor::push_back
void push_back(const IRoiDescriptor *roi)
add a RoiDescriptor
Definition: RoiDescriptor.h:157
ViewCreatorExtraPrefetchROITool::m_mergeWithOriginal
Gaudi::Property< bool > m_mergeWithOriginal
Definition: ViewCreatorExtraPrefetchROITool.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ViewCreatorExtraPrefetchROITool::ViewCreatorExtraPrefetchROITool
ViewCreatorExtraPrefetchROITool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ViewCreatorExtraPrefetchROITool.cxx:6
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
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
ViewCreatorExtraPrefetchROITool::m_roiUpdater
ToolHandle< IRoiUpdaterTool > m_roiUpdater
Definition: ViewCreatorExtraPrefetchROITool.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ViewCreatorExtraPrefetchROITool::m_extraRoiLinkName
Gaudi::Property< std::string > m_extraRoiLinkName
Definition: ViewCreatorExtraPrefetchROITool.h:30
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle< TrigRoiDescriptorCollection >
ViewCreatorExtraPrefetchROITool::attachROILinks
virtual StatusCode attachROILinks(TrigCompositeUtils::DecisionContainer &decisions, const EventContext &eventContext) const override
Definition: ViewCreatorExtraPrefetchROITool.cxx:16
TrigRoiDescriptorCollection
Definition: TrigRoiDescriptorCollection.h:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
RoiDescriptor::setComposite
void setComposite(bool b=true)
Definition: RoiDescriptor.h:138
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:876
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
ViewCreatorExtraPrefetchROITool::initialize
virtual StatusCode initialize() override
Definition: ViewCreatorExtraPrefetchROITool.cxx:9
RoiDescriptor::manageConstituents
bool manageConstituents() const
always manage constituents ???
Definition: RoiDescriptor.h:141
ViewCreatorExtraPrefetchROITool::m_extraRoiWHK
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_extraRoiWHK
Definition: ViewCreatorExtraPrefetchROITool.h:28
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.