20 return StatusCode::SUCCESS;
25 return StatusCode::SUCCESS;
32 auto decisions = outputHandle.
ptr();
36 ATH_MSG_DEBUG(
"No input configured, output decisions will be empty" );
37 return StatusCode::SUCCESS;
41 if( not previousDecisionsHandle.isValid() ) {
43 return StatusCode::SUCCESS;
46 ATH_MSG_DEBUG(
"Running with "<< previousDecisionsHandle->size() <<
" decisions from the input implicit ReadHandle");
49 ATH_MSG_DEBUG(
" and with "<< recoInput->size() <<
" reco inputs");
53 std::vector<const FeatureOBJ*> featureFromDecision;
54 for (
const auto previousDecision: *previousDecisionsHandle ) {
56 const auto featureLink = linkInfo.link;
57 CHECK( featureLink.isValid() );
59 featureFromDecision.push_back( feature);
61 ATH_MSG_DEBUG(
"Found "<<featureFromDecision.size()<<
" features "<<
m_linkName.value() <<
" mapped from input decisions");
64 size_t reco_counter = 0;
65 for (
const auto recoobj: *recoInput){
67 const auto roiEL = roiInfo.link;
68 CHECK( roiEL.isValid() );
71 const auto featurelink = featureInfo.link;
72 CHECK( featurelink.isValid() );
73 if ( not featurelink.isValid() ) {
75 return StatusCode::FAILURE;
81 bool foundFeatureInDecision=
false;
82 size_t pos=distance(featureFromDecision.begin(),
find(featureFromDecision.begin(), featureFromDecision.end(), feature));
83 if (pos < featureFromDecision.size()){
84 foundFeatureInDecision=
true;
87 if (foundFeatureInDecision){
88 ATH_MSG_DEBUG(
" Found link from the reco object to the previous decision at position "<<pos);
91 d->setObjectLink(
m_linkName.value(), featurelink );
95 ATH_MSG_DEBUG(
" Can not find reference to this feature " +
m_linkName.value() +
" from reco object " << reco_counter <<
" in any previous decision" );
100 if (decisions->size()>0){
102 CHECK( tool->decide( decisions ) );
106 ATH_MSG_DEBUG(
"Exiting with "<< outputHandle->size() <<
" decisions");
109 for (
auto outh: *outputHandle){
113 ATH_MSG_DEBUG(
"Number of positive decisions for this output: " << objDecisions.size() );
120 return StatusCode::SUCCESS;
#define CHECK(...)
Evaluate an expression and check for errors.
ElementLink implementation for ROOT usage.
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_recoInput
TrigRoiDescriptor FeatureOBJ
ToolHandleArray< ITestHypoTool > m_tools
virtual StatusCode finalize() override
virtual StatusCode execute(const EventContext &context) const override
StringProperty m_linkName
virtual StatusCode initialize() override
const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & decisionInput() const
methods for derived classes to access handles of the base class input other read/write handles may be...
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutput() const
methods for derived classes to access handles of the base class output other read/write handles may b...
HypoBase(const std::string &name, ISvcLocator *pSvcLocator)
constructor, to be called by sub-class constructors
pointer_type ptr()
Dereference the pointer.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
const Decision * find(const Decision *start, const std::function< bool(const Decision *)> &filter)
traverses Decision object links for another Decision object fulfilling the prerequisite specified by ...
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
std::set< DecisionID > DecisionIDContainer
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
LinkInfo< T > findLink(const Decision *start, const std::string &linkName, const bool suppressMultipleLinksWarning=false)
Perform a recursive search for ElementLinks of type T and name 'linkName', starting from Decision obj...
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.