ATLAS Offline Software
Loading...
Searching...
No Matches
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
6ViewCreatorExtraPrefetchROITool::ViewCreatorExtraPrefetchROITool(const std::string& type, const std::string& name, const IInterface* parent)
7: base_class(type, name, parent) {}
8
10 ATH_CHECK(m_extraRoiWHK.initialize());
11 ATH_CHECK(m_roiCreator.retrieve());
12 ATH_CHECK(m_roiUpdater.retrieve());
13 return StatusCode::SUCCESS;
14}
15
16StatusCode ViewCreatorExtraPrefetchROITool::attachROILinks(TrigCompositeUtils::DecisionContainer& decisions, const EventContext& eventContext) const {
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
const std::string & roiString()
Athena::TPCnvVers::Current TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_extraRoiWHK
ViewCreatorExtraPrefetchROITool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_extraRoiLinkName
virtual StatusCode attachROILinks(TrigCompositeUtils::DecisionContainer &decisions, const EventContext &eventContext) const override
ToolHandle< IViewCreatorROITool > m_roiCreator
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.