diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h index dba550bcbd99bd3fd3a6e2152ffb98ba2fd04f9b..971ef2190c6c286791968beb48470d66b5483b61 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h +++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h @@ -190,14 +190,20 @@ namespace Trig { * Instance mapping done via matchIndex and optional matchKey (leave matchKey = 0 to not cut on this). * @param[in] inViewContainer The ReadHandle of the collection which was produced online inside an EventView. * @param[in] matchIndex The index of the desired EventView. - * @param[in] matchKey Optional SGKey of the index of the desired EventView (collection hosting the ROI used to span the Event View) + * @param[in] matchKey Optional. SGKey of the index of the desired EventView (collection hosting the ROI used to span the Event View) + * @param[in] isFullscan Optional. If true, and inViewContainer has no viewIndex decorations, then return iterators over the full + * span of the inViewContainer instead of throwing an exception. + * This allows the associateToEventView interface to be used also for non-EventView containers, + * with the FS ROI used to indicate that the lack of decorations is expected rather than being + * indicative of a configuration problem. * @return Pair of iterators spanning a range of indices over the collection accessed through the ReadHandleKey **/ template<class CONTAINER> std::pair< typename CONTAINER::const_iterator, typename CONTAINER::const_iterator > associateToEventView(SG::ReadHandle<CONTAINER>& inViewContainer, const uint32_t matchIndex, - const uint32_t matchKey = 0) const; + const uint32_t matchKey = 0, + const bool isFullscan = false) const; /// @} diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc index 7ff7f47255e897164aa4a13c14992aa4fab85481..56c02e8abc6f10032f6b83640aa6533f178e3292 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc +++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc @@ -92,14 +92,20 @@ template<class CONTAINER> std::pair< typename CONTAINER::const_iterator, typename CONTAINER::const_iterator > Trig::DecisionAccess::associateToEventView(SG::ReadHandle<CONTAINER>& inViewContainer, const ElementLink<TrigRoiDescriptorCollection>& matchROI) const { - return associateToEventView(inViewContainer, matchROI.index(), matchROI.key()); + // If we can resolve the link, then we can also check the fullscan flag. + bool isFullscan = false; + if (matchROI.isValid()) { + isFullscan = (*matchROI)->isFullscan(); + } + return associateToEventView(inViewContainer, matchROI.index(), matchROI.key(), isFullscan); } template<class CONTAINER> std::pair< typename CONTAINER::const_iterator, typename CONTAINER::const_iterator > Trig::DecisionAccess::associateToEventView(SG::ReadHandle<CONTAINER>& inViewContainer, const uint32_t matchIndex, - const uint32_t matchKey) const { + const uint32_t matchKey, + const bool isFullscan) const { if (!inViewContainer.isValid()) { std::stringstream ss; ss << "Supplied ReadHandle '" << inViewContainer.key() << "' of type '" << ClassID_traits<CONTAINER>::typeName() << "' is not valid."; @@ -112,9 +118,15 @@ Trig::DecisionAccess::associateToEventView(SG::ReadHandle<CONTAINER>& inViewCont static const SG::AuxElement::ConstAccessor< ElementLink<TrigRoiDescriptorCollection> > accessor("viewIndex"); for (typename CONTAINER::const_iterator it = container->begin(); it != end; ++it) { if (!accessor.isAvailable(**it)) { // iterator dereferences to an OBJECT*, OBJECT* dereferences to an OBJECT - ATH_MSG_ERROR("Unable to read the viewIndex decoration from the supplied container. Was it created inside an EventView?"); - throw std::runtime_error("Trig::DecisionAccess::associateToEventView Unable to read the viewIndex decoration from the " - "supplied container. Was it created inside an EventView?"); + if (isFullscan) { + ATH_MSG_DEBUG("Supplied container has no viewIndex decoration. But isFullscan flag is TRUE. " + << "Returning iterators over whole container."); + return std::make_pair(container->begin(), container->end()); + } else { + ATH_MSG_ERROR("Unable to read the viewIndex decoration from the supplied container. Was it created inside an EventView?"); + throw std::runtime_error("Trig::DecisionAccess::associateToEventView Unable to read the viewIndex decoration from the " + "supplied container. Was it created inside an EventView?"); + } } const ElementLink<TrigRoiDescriptorCollection> objectROI = accessor( **it ); bool match = true;