Skip to content
Snippets Groups Projects
Commit ce23de40 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'use-chain-dict-in-jet-hypo-config' into 'master'

add FromDict function to configure jet hypo tools

See merge request atlas/athena!20901
parents ad3d3ace cfddbcb2
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!20901add FromDict function to configure jet hypo tools
......@@ -33,6 +33,9 @@ atlas_add_component( TrigHLTJetHypo
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} xAODJet GaudiKernel TrigParticle TrigSteeringEvent TrigInterfacesLib TrigTimeAlgsLib TrigHLTJetHypoLib DecisionHandlingLib )
atlas_add_test( TrigHLTJetHypoTool SCRIPT python -m TrigHLTJetHypo.TrigJetHypoToolConfig
POST_EXEC_SCRIPT nopost.sh )
# Install files from the package:
atlas_install_python_modules( python/*.py )
......@@ -24,17 +24,18 @@ def decodeEtEta(match, chain):
return conf_tool
def trigJetHypoToolFromDict(chainDict):
return trigJetHypoToolFromName( chainDict['chainName'], chainDict['chainName'])
def trigJetHypoToolFromName(name, jetconfig):
"""Configure a jet hypo tool from chain name.
Delegate to functions according to the hypo scenartio."""
scenario_dict = {re_EtEta0: decodeEtEta}
chain = jetconfig
for k, v in scenario_dict.items():
match = k.match(chain)
match = k.match(chain)
if match:
hypo_tool = TrigJetHypoToolMT(chain)
hypo_tool.HypoConfigurer = v(match, chain)
......@@ -43,19 +44,24 @@ def trigJetHypoToolFromName(name, jetconfig):
msg = 'trigJetHypoToolFromName(%s) - decode error' % chain
raise NotImplementedError(msg)
import unittest
class TestStringMethods(unittest.TestCase):
def testValidConfigs(self):
# EtaEt hypos
# from MC_pp_v7 import TriggerFlags.JetSlice.signatures
# exception or any other issue will make the ctest for this package fail
chains = ('HLT_j85', 'HLT_j35_320eta490')
wid = max(len(c) for c in chains)
for c in chains:
tool = trigJetHypoToolFromName(c, c)
self.assertIsNotNone( tool )
print '%s' % c.rjust(wid), tool
if __name__ == '__main__':
def testInvalidConfig(self):
with self.assertRaises(NotImplementedError):
tool = trigJetHypoToolFromName('HLT_nonsense', 'HLT_nonsense')
# EtaEt hypos
# from MC_pp_v7 import TriggerFlags.JetSlice.signatures
chains = ('HLT_j85', 'HLT_j35_320eta490', 'HLT_nonsense')
wid = max(len(c) for c in chains)
for c in chains:
try:
print '%s' % c.rjust(wid), trigJetHypoToolFromName(c)
except Exception, e:
print e
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment