ATLAS Offline Software
TestHypoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "TestHypoTool.h"
6 
7 using namespace TrigCompositeUtils;
8 
9 
10 namespace HLTTest {
11 
12  TestHypoTool::TestHypoTool( const std::string& type,
13  const std::string& name,
14  const IInterface* parent ) :
17  {
19  }
20 
22 
24  ATH_MSG_INFO( "Initializing " << name() << "..." );
25 
26  ATH_MSG_DEBUG("Configured to require chain " << m_decisionId );
27  ATH_MSG_DEBUG("Link name is "<<m_linkName.value());
28  ATH_MSG_DEBUG("threshold="<<m_threshold);
29  ATH_MSG_DEBUG("property="<<m_property);
30  return StatusCode::SUCCESS;
31  }
32 
34  ATH_MSG_DEBUG( "Add decisionIDs to " << decisions->size() <<" output decisions" );
35  size_t counter = 0;
36  for ( const auto d: *decisions ) {
37  //get previous decisions
38  std::vector<ElementLink<DecisionContainer>> inputLinks = getLinkToPrevious(d);
39  ATH_MSG_DEBUG("Decision "<< counter <<": Got "<<inputLinks.size()<<" input decisions");
40  for (const auto& previousDecisions: inputLinks){
41 
43  TrigCompositeUtils::decisionIDs( *previousDecisions, objDecisions );
44 
45  ATH_MSG_DEBUG("Number of decision-IDs for input "<< counter <<" is: " << objDecisions.size() );
46 
47  if ( TrigCompositeUtils::passed( m_decisionId.numeric(), objDecisions ) ) {
48  const auto feature = d->objectLink<xAOD::TrigCompositeContainer>( "feature" );
49  if ( not feature.isValid() ) {
50  ATH_MSG_ERROR( " Can not find reference to the object from the decision" );
51  return StatusCode::FAILURE;
52  }
53  const float v = (*feature)->getDetail<float>( m_property );
54  if ( v > m_threshold ) { // actual cut will be more complex of course
55  ATH_MSG_DEBUG( m_threshold << " passed by value: " << v << ". Adding "<< m_decisionId <<" to output" );
57  } else {
58  ATH_MSG_DEBUG( m_threshold << " not passed by value " << v );
59  }
60 
61  } else {
62  ATH_MSG_DEBUG("No Input decisions matched");
63  }
64  counter++;
65  }
66  }
67  return StatusCode::SUCCESS;
68  }
69 
70 
72  ATH_MSG_INFO( "Finalizing " << name() << "..." );
73  return StatusCode::SUCCESS;
74  }
75 
76 } //> end namespace HLTTest
HLTSignatureHypoTools.TestHypoTool
def TestHypoTool(name, prop, threshold_value)
Definition: HLTSignatureHypoTools.py:6
HLTTest::TestHypoTool::m_property
StringProperty m_property
Definition: TestHypoTool.h:44
HLTTest::ITestHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: ITestHypoTool.h:45
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
HLTTest::TestHypoTool::finalize
StatusCode finalize() override
Definition: TestHypoTool.cxx:71
TestHypoTool.h
HLTTest::TestHypoTool::m_linkName
StringProperty m_linkName
Definition: TestHypoTool.h:49
HLT::Identifier::fromToolName
static HLT::Identifier fromToolName(const std::string &tname)
Definition: HLTIdentifier.cxx:31
HLTTest::TestHypoTool::~TestHypoTool
virtual ~TestHypoTool()
Definition: TestHypoTool.cxx:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HLTTest::ITestHypoTool
Definition: ITestHypoTool.h:23
TrigCompositeUtils::getLinkToPrevious
const std::vector< ElementLink< DecisionContainer > > getLinkToPrevious(const Decision *d)
returns links to previous decision object 'seed'
Definition: TrigCompositeUtilsRoot.cxx:156
HLTTest::TestHypoTool::initialize
StatusCode initialize() override
Definition: TestHypoTool.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
HLTTest::TestHypoTool::m_threshold
Gaudi::Property< float > m_threshold
Definition: TestHypoTool.h:43
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.PyAthena.v
v
Definition: PyAthena.py:154
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
HLTTest::TestHypoTool::decide
StatusCode decide(DecisionContainer *decisions) const override
method invoked to work out the decisions per object
Definition: TestHypoTool.cxx:33
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
HLTIdentifier.h
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
HLTTest
Definition: ITestHypoTool.cxx:9
AthAlgTool
Definition: AthAlgTool.h:26
test_pyathena.counter
counter
Definition: test_pyathena.py:15