diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetMTCondition.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetMTCondition.h new file mode 100644 index 0000000000000000000000000000000000000000..84aef0dc56ad479a79d0e455133b172384c83c4f --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetMTCondition.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGHLTJETHYPO_DIJETMTCONDITION_H +#define TRIGHLTJETHYPO_DIJETMTCONDITION_H + +/******************************************************************** + * + * NAME: DijetMTCondition.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * Cuts on paris of jets makling up a dijet + * + * AUTHOR: P. Sherwood + * CREATED: February 21, 2019 + * + *********************************************************************/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICondition.h" + + +class DijetMTCondition: public ICondition{ + public: + DijetMTCondition( + double massMin, + double massMax, + double detaMin, + double detaMax, + double dphiMin, + double dphiMax + ); + + ~DijetMTCondition() override {} + + bool isSatisfied(const HypoJetVector&) const override; + + double orderingParameter() const noexcept override; + + std::string toString() const noexcept override; + + private: + + bool passJetCuts(pHypoJet, pHypoJet) const; + bool passDijetCuts(pHypoJet, pHypoJet) const; + + // cuts on sum of jets + double m_massMin; + double m_massMax; + + // cuts on the two jets + double m_detaMin; + double m_detaMax; + + double m_dphiMin; + double m_dphiMax; + +}; + +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h index 92078f82269f0328f5fc45aa584dc8f0a15a4d51..034926817227974f8615036f6f2b726d1156088e 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h @@ -44,6 +44,14 @@ Conditions conditionsFactoryDijet(const std::vector<double>& etThresholds1, const std::vector<double>& dphiMins, const std::vector<double>& dphiMaxs); +Conditions conditionsFactoryDijetMT(const std::vector<double>& massMins, + const std::vector<double>& massMaxs, + const std::vector<double>& detaMins, + const std::vector<double>& detaMaxs, + const std::vector<double>& dphiMins, + const std::vector<double>& dphiMaxs); + + // for conditionsFactory2 Conditions conditionsFactoryDijetEtaMass(const std::vector<double>& etasMin, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.py new file mode 100644 index 0000000000000000000000000000000000000000..46230e0139dc6eace5b8853f6d8c3c56a7119bc2 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ChainLabelParser.py @@ -0,0 +1,390 @@ +from node import Node +from constants import (lchars, + digits, + delims) + + + +def get_char(s): + """character generator""" + + while s: + c = s[0] + s = s[1:] + yield c + +def _check_parens(s, pars): + pl = pars[0] + pr = pars[1] + np = 0 + for c in s: + if c == pl: np += 1 + if c == pr: np -= 1 + if np < 0: + raise RuntimeError('Paren mismatch for parens %s, %s' % (pars, s)) + +def check_parens(s): + _check_parens(s, '()') + _check_parens(s, '[]') + + + +def preprocess(s): + llines = s.split('\n') + + lines = [l.split('#')[0].strip() for l in llines] + s = ''.join(lines) + ss = '' + reject = ' \n' + for c in s: + # keep white space whn within square brackets, reject otherwise + if c not in reject: + ss += c + s = ss + + check_parens(s) + print s + from constants import alphabet + for c in s: + if not c in alphabet: + raise RuntimeError('bad character %s in string %s' % (c, s)) + print 'end of preprocess: ', s + return s + + +class ChainLabelParser(object): + def __init__(self, label, debug=False): + self.label = label + self.state = 'start' + pp = preprocess(label) + print 'preprocessd string', pp, 'length', len(pp) + self.gc = get_char(pp) + self.state_history = [] + self.states = { + 'start': self.start, + 'scenario': self.scen, + 'start_params_0': self.start_params_0, + 'start_params_1': self.start_params_1, + 'params': self.params, + 'end_params_0': self.end_params_0, + 'end_params': self.end_params, + 'end_scenario': self.end_scenario, + 'error': self.error, + } + self.debug = debug + + def paramAppend(self, c): + self.parameters += c + if self.debug: + print 'parameters', self.parameters + + def scenAppend(self, c): + self.scenario += c + if self.debug: + print 'scenario', self.scenario + + def start(self): + "initialise" + + self.state = 'scenario' + self.scenario = '' + self.parameters = '' + self.tree = [Node('dummy')] + self.msg = '' + + + def scen(self): + """accumulate scenario name string into self.scenario""" + + c = self.gc.next() + + if c in lchars: + self.scenAppend(c) + return + + if c == '(': + self.state = 'start_params_0' + + return + + self.msg = 'state %s, bad character %s in string %s' % (self.state, + c, + self.label) + self.state = 'error' + + def start_params_0(self): + """accumulate parameter string into self.parameter""" + + self.tree.append(Node(self.scenario)) + self.scenario = '' + + c = self.gc.next() + + if c == '[': + self.state = 'start_params_1' + return + + self.msg = 'state %s, bad character %s in string %s' % (self.state, + c, + self.label) + self.state = 'error' + + def start_params_1(self): + """accumulate parameter string into self.parameter""" + + c = self.gc.next() + + if c == '(': + self.paramAppend(c) + self.state = 'params' + return + + if c == ']': + self.state = 'end_params' + return + + + self.msg = 'state %s, bad character %s in string %s' % (self.state, + c, + self.label) + self.state = 'error' + + def params(self): + """accumulate parameter string into self.parameter""" + + c = self.gc.next() + + if c in lchars or c in digits or c ==',': + self.paramAppend(c) + return + + if c == ')': + self.paramAppend(c) + self.state = 'end_params_0' + return + + + self.msg = 'state %s, bad character %s in string %s' % (self.state, + c, + self.label) + self.state = 'error' + + + def end_params_0(self): + """Check whether there are more prameters to accumulate""" + + c = self.gc.next() + + # more parameters + if c == '(': + self.paramAppend(c) + self.state = 'params' + return + + # end of paramter lists + if c == ']': + self.tree[-1].parameters = self.parameters.strip() + self.parameters = '' + self.state = 'end_params' + return + + self.msg = 'state %s, bad character %s in string %s' % (self.state, + c, + self.label) + self.state = 'error' + + + def end_params(self): + """after accumulating params, drop white space, then add node to tree + or process next scenario""" + + c = self.gc.next() + + if c == ')': + self.state = 'end_scenario' + return + + if c in lchars: + self.scenAppend(c) + self.state = 'scenario' + return + + self.msg = 'state %s, bad character %s in string %s' % (self.state, + c, + self.label) + self.state = 'error' + + def end_scenario(self): + """Add current node to its parent""" + + n = self.tree.pop() + self.tree[-1].add_child(n) + + while True: + c = self.gc.next() + if c == ')': + n = self.tree.pop() + self.tree[-1].add_child(n) + else: + + # more input means a new scenario is starting + self.scenario = c + self.parameters = '' + self.msg = '' + self.state = 'scenario' + + return + + + def error(self): + """From error state, dump error report and raise exception""" + + print '---error state report ---' + print ' state', self.state + print ' scenario', self.scenario + print ' parameters', self.parameters + print ' msg', self.msg + print 'state history', self.state_history + print ' tree dump:' + print self.tree[0].dump() + print '--end error state report---' + raise RuntimeError('error state') + + def get_state(self): + self.state_history.append(self.state) + return self.states[self.state] + + + + def parse(self): + "parse a chain label" + + error = False + terminated = False + + self.start() # re-initialise + + try: # parsing ends with an exception + while True: # continue until exception + + # print 'current state', self.state + # print 'current scenario', self.scenario + # print 'current parameters', self.parameters + + # self.states[self.state]() # process the current state + self.get_state()() + + except StopIteration: # generator has reached the end of the string + print 'parse terminated' + terminated = True + except AssertionError, e: + print 'assertion err' + print e + error = True + except RuntimeError, e: + print e + error = True + + + if not terminated: + s = '' + try: + while True: + s += self.gc.next() + except StopIteration: + if s: + print 'error: remaining characters:', s + + if len(self.tree) != 1: + error = True + print 'error, stack size', len(self.tree), 'expected 2' + print self.state_history + + if len(self.tree[0].children) != 1: + error = True + print 'error, top node has %d cdildren, expected 1' % ( + len(self.tree[0].children)) + + final_state = 'end_scenario' + if self.state != final_state: + error = True + print 'error: final state is %s, expected %s' % (self.state, + final_state) + # print 'tree dump:' + # print self.tree[0].dump() + print 'parse', + if not error: + print 'succeeded' + else: + print 'state: %s scenario: %s parameters: %s stack len %d' % ( + self.state, self.scenario, self.parameters, len(self.tree)) + print 'failed' + + # Kludge: mark the tops of the trees. The visitor which + # creates Tool instances with give the Tool for this node + # the name of the chain + + for c in self.tree[0].children: + c.tree_top = True + + # for now (02/01/2019), no reco. First tree is only tree is hypo + return self.tree[0].children[0] + +def _test(s): + from ChainLabelParser import ChainLabelParser + parser = ChainLabelParser(s, debug=True) + tree = parser.parse() + print tree.dump() + + +def test(index): + from test_cases import test_strings + c = sys.argv[1] + index = -1 + try: + index = int(c) + except: + print 'expected int in [1,%d] ]on comand line, got %s' % ( + len(test_strins), c) + sys.exit() + + print 'index', index + print '========== Test %d ==============' % index + s = test_strings[index] + print s + _test(s) + + +def usage(options): + print 'usage: ChainLabelPaers -[%s]' % options + + +if __name__ == '__main__': + + import getopt, sys + from test_cases import test_strings + ncases = len(test_strings) + try: + options = "1234567" + opts, args = getopt.getopt(sys.argv[1:], options, []) + except getopt.GetoptError as err: + # print help information and exit: + print str(err) # will print something like "option -a not recognized" + usage(options) + sys.exit(2) + + assert len(args) == 1 + o = args[0] + try: + index = int(o) + except: + print 'Supply an test case integer index on the command line ' + sys.exit(0) + + if index < 0 or index >= ncases: + print 'no such test case ind %d, expect val in [0, %d]' %(index, + ncases-1) + sys.exit(0) + + test(int(o)) + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ToolSetter.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ToolSetter.py new file mode 100644 index 0000000000000000000000000000000000000000..87c1114df9cf360e48572f1de21ea6eedd661206 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/ToolSetter.py @@ -0,0 +1,134 @@ +from TrigHLTJetHypo.TrigHLTJetHypoConf import (TrigJetHypoToolConfig_simple, + TrigJetHypoToolConfig_dijet, + TrigJetNotToolMT, + TrigJetAndToolMT, + TrigJetOrToolMT, + TrigJetHypoToolMT) + + +class ToolSetter(object): + """Visitor to set instantiated AlgTools to a jet hypo tree""" + + def __init__(self, name, dump_jets=True): + + self.chain_name = name + self.dump_jets = dump_jets + + self.tool_factories = { + 'simple': [TrigJetHypoToolConfig_simple, 0], + 'not': [TrigJetNotToolMT, 0], + 'and': [TrigJetAndToolMT, 0], + 'or': [TrigJetOrToolMT, 0], + 'dijet': [TrigJetHypoToolConfig_dijet, 0], + } + + self.mod_router = { + 'not': self.mod_logical_unary, + 'and': self.mod_logical_binary, + 'or': self.mod_logical_binary, + # 'not': self.mod_logical_unary, + } + + def mod_logical_binary(self, node): + """Set the HypoConfigTool instance the 'and' and 'or' scenarios + these take two predicates""" + + scen = node.scenario + klass = self.tool_factories[scen][0] + sn = self.tool_factories[scen][1] + name = '%s_%d' % (scen, sn) + self.tool_factories[scen][1] += 1 + + # kludgy. The name of the tool seen by the trigger must be + # the trigger name, so have to figure out if this is the top + # level node (actually first daughter, as the start node is the top) + # note that the name can only be set once so have to know + # if we are the top of the tree while traversing it. kludgy... + # also - will break when using a forest... + + print 'Toolsetter, node.tree_top', node.tree_top + if node.tree_top: + tool = klass(name=self.chain_name) + else: + tool = klass(name=name) + + print 'ToolSetter, setting lhs ', node.children[0].tool + tool.lhs = node.children[0].tool + tool.rhs = node.children[1].tool + node.tool = tool + + + def mod_logical_unary(self, node): + """Set the HypoConfigTool instance for the 'not' scenario + this takes a single predicate""" + + scen = node.scenario + klass = self.tool_factories[scen][0] + sn = self.tool_factories[scen][1] + name = '%s_%d' % (scen, sn) + self.tool_factories[scen][1] += 1 + + # kludgy. The name of the tool seen by the trigger must be + # the trigger name, so have to figure out if this is the top + # level node (actually first daughter, as the start node is the top) + # note that the name can only be set once so have to know + # if we are the top of the tree while traversing it. kludgy... + # also - will break when using a forest... + + print 'Toolsetter, node.tree_top', node.tree_top + if node.tree_top: + tool = klass(name=self.chain_name) + else: + tool = klass(name=name) + + print 'ToolSetter, setting lhs ', node.children[0].tool + tool.hypoTool = node.children[0].tool + node.tool = tool + + + + def mod_simple(self, node): + """Set the HypoConfigTool instance in a hypo tree node""" + + scen = node.scenario + klass = self.tool_factories[scen][0] + sn = self.tool_factories[scen][1] + name = '%s_%d' % (scen, sn) + + self.tool_factories[scen][1] += 1 + + config_tool = klass(name=name+'_config') + [setattr(config_tool, k, v) for k, v in node.conf_attrs.items()] + + # kludgy. The name of the tool seen by the trigger must be + # the trigger name, so have to figure out if this is the top + # level node (actually first daughter, as the start node is the top) + # note that the name can only be set once so have to know + # if we are the top of the tree while traversing it. kludgy... + # also - will break when using a forest... + print 'Toolsetter, node.tree_top', node.tree_top + if node.tree_top: + tool = TrigJetHypoToolMT(name=self.chain_name) + else: + tool = TrigJetHypoToolMT(name=name) + + tool.HypoConfigurer = config_tool + tool.dumpJets = self.dump_jets + node.tool = tool + + def mod(self, node): + """Set the HypoConfigTool instance according to the scenario. + Note: node.accept must perform depth first navigation to ensure + child tools are set.""" + + self.mod_router.get(node.scenario, self.mod_simple)(node) + + def report(self): + wid = max(len(k) for k in self.tool_factories.keys()) + rep = '\n%s: ' % self.__class__.__name__ + + rep += '\n'.join( + ['%s: %d' % (k.ljust(wid), v[1]) + for k, v in self.tool_factories.items()]) + + return rep diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py index 538ed52e796f81595f6603c76ec0bd958d7eb434..908fcb0454adf9013f6327e751b10f7a5f8c213e 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigJetHypoToolConfig.py @@ -1,67 +1,73 @@ -from TrigHLTJetHypo.TrigHLTJetHypoConf import TrigJetHypoToolMT, TrigJetHypoToolConfig_EtaEt -import re +from TrigHLTJetHypo.TrigHLTJetHypoConf import (TrigJetHypoToolMT, + TrigJetHypoToolConfig_EtaEt) -re_EtEta0 = re.compile( - r'^HLT_j(?P<thresh>\d+)(_(?P<etalo>\d{3})eta(?P<etahi>\d{3}))?$') -# re_EtEta1 = re.compile(r'^HLT_j\d+(_\d{1-3}eta\d{3})?_L1') -# re_EtEta2 = re.compile(r'^HLT_j\d+(_\d{3}eta\d{3})?_(jes|nojcalib|lcw)*$') +from TrigHLTJetHypo.ToolSetter import ToolSetter +from TrigHLTJetHypo.treeVisitors import TreeParameterExpander +from TrigHLTJetHypo.chainDict2jetLabel import (make_simple_label, + make_vbenf_label) +from TrigHLTJetHypo.ChainLabelParser import ChainLabelParser +from GaudiKernel.Constants import (VERBOSE, + DEBUG, + INFO, + WARNING, + ERROR, + FATAL,) -def decodeEtEta(match, chain): - """Create a hypo tool for the Et - Eta scenario""" - default = {'etalo': '0', 'etahi': '320'} - conf_dict = match.groupdict() - for k, v in default.items(): - if k not in conf_dict: conf_dict[k] = v - if conf_dict[k] is None: conf_dict[k] = v - conf_tool = TrigJetHypoToolConfig_EtaEt(name=chain+"config") - conf_tool.EtThresholds = [float(conf_dict['thresh'])] - conf_tool.eta_mins = [float(conf_dict['etalo'])] - conf_tool.eta_maxs = [float(conf_dict['etahi'])] - conf_tool.asymmetricEtas = [0] - conf_tool.OutputLevel = 0 - return conf_tool +def trigJetHypoToolFromDict(chain_dict): + """Produce a jet trigger hypo tool from a chainDict""" + print 'trigJetHypoToolFromDict starts' + chain_label = '' + if 'vbenf' in chain_dict['chainParts'][0]['hypoScenario']: + assert len(chain_dict['chainParts']) == 1 + chain_label = make_vbenf_label(chain_dict) + else: + chain_label = make_simple_label(chain_dict) + parser = ChainLabelParser(chain_label) + tree = parser.parse() -def trigJetHypoToolFromDict(chainDict): - return trigJetHypoToolFromName( chainDict['chainName'], chainDict['chainName']) + #expand strings of cuts to a cut dictionary + visitor = TreeParameterExpander() + tree.accept(visitor) + visitor.report() -def trigJetHypoToolFromName(name, jetconfig): - """Configure a jet hypo tool from chain name. + # create - possibly nested - tools - Delegate to functions according to the hypo scenartio.""" - scenario_dict = {re_EtEta0: decodeEtEta} + # chain name in run 2 dicts were missing the 'HLT_' prefix + # but it seems it is necessary to run the hypos in AthenaMT ?...? + + chain_name = chain_dict['chainName'] + if not chain_name.startswith('HLT_'): + chain_name = 'HLT_' + chain_name - chain = jetconfig - for k, v in scenario_dict.items(): - match = k.match(chain) - if match: - hypo_tool = TrigJetHypoToolMT(chain) - hypo_tool.HypoConfigurer = v(match, chain) - return hypo_tool + print 'trigJetHypoToolFromDict chain_name', chain_name + visitor = ToolSetter(chain_name) + tree.accept(visitor) + visitor.report() - msg = 'trigJetHypoToolFromName(%s) - decode error' % chain - raise NotImplementedError(msg) + print 'Dumping jet config for', chain_name + print tree.dump() + tool = tree.tool + tool.OutputLevel = DEBUG + return tool 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 - - def testInvalidConfig(self): - with self.assertRaises(NotImplementedError): - tool = trigJetHypoToolFromName('HLT_nonsense', 'HLT_nonsense') + from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName + chainNameDecoder = DictFromChainName.DictFromChainName() + # chain_names = ('HLT_j85', 'HLT_j35_0eta320') + chain_names = ('HLT_j0hs_vbenf',) + wid = max(len(c) for c in chain_names) + for chain_name in chain_names: + chain_dict = chainNameDecoder.getChainDict(chain_name) + tool = trigJetHypoToolFromDict(chain_dict) + self.assertIsNotNone(tool) + print '%s' % chain_name.rjust(wid), tool if __name__ == '__main__': unittest.main() diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py new file mode 100644 index 0000000000000000000000000000000000000000..89047bbe9e7fc95bce3b9745a91f7bf1efd267aa --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDict2jetLabel.py @@ -0,0 +1,106 @@ +import re + +# substrings that cannot occur in any chainPartName for simple chains. +reject_substr = ( + 'gsc', + 'ion', + 'dphi', + 'deta', + 'invm', + '0i1', + '1i2', + 'dphi', + 'ht\d',) + +reject_substr_res = re.compile(r'%s' % '|'.join(reject_substr)) + + +def select_simple_chains(cd): + """Select chains for which to make an simple chain label. + + Chains selected by reuiring that the signature os 'Jet'. Chains are + vetoed if specific substrings occur in any of the chainPartNames""" + + + # print cd + # assert False + chain_parts = [c for c in cd['chainParts'] if c['signature'] == 'Jet'] + chain_name = cd['chainName'] + + for cp in chain_parts: + if reject_substr_res.search(cp['chainPartName']): + return [] + + return chain_parts + + +def make_simple_label(chain_dict): + """Marshal information deom the selected chainParts to create a + 'simple' label. + """ + + cps = select_simple_chains(chain_dict) + if not cps: + raise NotImplementedError( + 'chain fails substring selection: not "simple": %s' % ( + chain_dict['chainName'])) + + label = 'simple([' + for cp in cps: + smcstr = str(cp['smc']) + if smcstr == 'nosmc': + smcstr = '' + for i in range(int(cp['multiplicity'])): + # condition_str = '(%set,%s,%s)' % (str(cp['threshold']), + # str(cp['etaRange']), + # smcstr,) + condition_str = '(%set,%s' % (str(cp['threshold']), + str(cp['etaRange']),) + if smcstr: + condition_str += ',%s)' + else: + condition_str += ')' + label += condition_str + label += '])' + return label + + +def select_vbenf_chains(cd): + """Select chains for which to make a vbenf chain label. + Chains selected by reuiring that the signature os 'Jet'. Chains are + vetoed if specific substrings occur in any of the chainPartNames""" + + + # print cd + # assert False + chain_parts = [c for c in cd['chainParts'] if c['signature'] == 'Jet'] + return any(['vbenf' in cp['chainPartName'] for cp in chain_parts]) + +def make_vbenf_label(chain_dict): + """Marshal information from the selected chainParts to create a + vbenf label. + """ + + # toy label for developement: run simple and dijet independently. + # simple makes Et cuts on two jets. Independently (sharing possible) + # of jets choosean by simple, the dijet + # scenario requires a dijet of mass > 900, and opening angle in phi > 2.6 + + return 'and([] simple([(50et)(70et)])dijet([(900mass, 26dphi)]))' + +if __name__ == '__main__': + """Read chainDicts from files, cread simple label if possible""" + from chainDictSource import chainDictSource + + for cd in chainDictSource(): + f = cd['chainName'] + print '\n---------' + print f + try: + label = make_simple_label(cd) + except Exception, e: + print e + continue + + print 'chain label', label + print '-----------\n' diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDictDumper.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDictDumper.py new file mode 100644 index 0000000000000000000000000000000000000000..608d8b49228b21ec9c60aa9710d9c677d5a17b21 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/chainDictDumper.py @@ -0,0 +1,22 @@ +from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName +from TriggerMenuMT.HLTMenuConfig.Menu.SignatureDicts import JetChainParts +import sys + +from pprint import PrettyPrinter + +pp = PrettyPrinter(indent=4) +pp.pprint(JetChainParts) + +decodeChainName = DictFromChainName.DictFromChainName() + +def do_it(): + print '\n------------------\n' + chain_dict = decodeChainName.getChainDict(chain_name) + pp.pprint(chain_dict) + +if __name__ == '__main__': + chain_name = sys.argv[1] + do_it() + # chain_names = ('HLT_j85', 'j85', 'HLT_j55_0eta320_2j20_0eta320',) + # for chain_name in chain_names: + # do_it() diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/constants.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/constants.py new file mode 100644 index 0000000000000000000000000000000000000000..33afe422d318491c0f8fcf81de6226f230851354 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/constants.py @@ -0,0 +1,6 @@ +lchars = 'abcdefghijklmnopqrstuvwxyz' +digits = '0123456789' +delims = '()[],' +logicals = ('and', 'or', 'not') +alphabet = lchars + digits + delims + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce56d947df5ca7ba660f7361d27005803abc6d6 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/node.py @@ -0,0 +1,69 @@ +from constants import logicals + +class Node(object): + + def __init__(self, scenario): + self.scenario = scenario + self.parameters = '' + self.children = [] + self.conf_attrs = {} + self.tool = None + + # self.tree_top kludge carensure top level tools get chain name + # as Tool name + self.tree_top = False + + def add_child(self, c): + self.children.append(c) + + def accept(self, modifier): + "call self before children" + + modifier.mod(self) + for c in self.children: + c.accept(modifier) + + def accept_cf(self, modifier): + "call children before self" + + for c in self.children: + c.accept_cf(modifier) + modifier.mod(self) + + def makeTool(self): + if self.scenario not in logicals: + self.tool = DummyTool(self.toolName) + + def buildTree(self, treeVisitor): + if self.children: + if self.scenario in logicals: + treeVisitor.add(self.scenario + '(') + else: + treeVisitor.add(self.tool.name() + '(') + + for c in self.children: + c.buildTree(treeVisitor) + treeVisitor.add(') ') + + else: + treeVisitor.add(self.tool.name() + ' ') + + + + return s + + def dump(self, n_in=0): + indent = ' '*n_in + s = '\n' + s = indent + 'Node. scenario: %s \n' % self.scenario + s += indent + 'is tree top? %s \n' % self.tree_top + s += indent + 'parameters: %s\n' % str(self.parameters) + s += indent + 'conf_attrs: %s\n' % str(self.conf_attrs) + s += indent + 'AlgTool: %s\n' % str(self.tool) + # s += indent + 'AlgTool dict: %s\n' % str(self.tool.__dict__) + s += indent + 'No of children: %d\n\n' % len(self.children) + for c in self.children: + s += c.dump(n_in+5) + + return s + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py new file mode 100644 index 0000000000000000000000000000000000000000..549dc54109a052d614b6da61e0edf281c6ff9366 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/test_cases.py @@ -0,0 +1,70 @@ +test_strings = [ + 'ijet([(10et, 0eta320)])', + 'ijet([(10et, 0eta320)(20et, 0eta320)])', + # 'or([] ijet([10et]) and([] ijet([20et]) ijet([30et])))', + 'or([] ijet([(10et)]) ijet([(20et)(40et)]))', + 'and([] ijet([(10et)]) ijet([(20et)]))', + 'not([] ijet([(10et)]) )', + 'not([] and([] ijet([(40et, 0eta320)]) ijet([(100et, 0eta320)])))', + 'or([] not([] ijet([(40et, 0eta320)])) not([] ijet([(100et, 0eta320)])))', + 'or([] and([] ijet([(40et, 0eta320)]) ijet([(40et, 0eta320)])) not([] ijet([(100et, 0eta320)])))', + + + +""" +partition +( + [(4,2)] # partition 6 input jets to 4, 2 + splitter # send the 4s to first 2 children, 2 to third. + assert len(o) == 1 + ( + [(1,1)(2)] + sum # mass cut on sum of input jets (ord.=4) + ( + [(800m900)] + ) + partition # partition 4 jets into non-overlapping + # sets ord 2, 2 + ( + [(2,2)] + pair # sum inputs, apply deta cut to the 2 sums + ( + [(40deta)] + sum # child gets two lists, applys mass cuts + ( + [(75m85)(80m90)] + partition # passes on 2 sum to regroup to single jets + ( + [() (1)] + ijet # apply aoverlapping mod, et cuts + ( + [(30width50, 30et) (35width45, 40et)] + ) + ) + ) + ) + ) + ) + + ijet([(p320etap500, 100et) (n500etan320)]), +)""", + + +# """cascade( +# [800m900] # conditions for cascade (only one here) +# dijet( # first daughter scenario +# [ 80m90] # condition(s) for first daughter scenario +# ijet([10et]) # grandaughter scenario 1 for first daugh scen. +# ijet([20et]) # grandaughter scenario 2 for first daugh scen. +# ) # end of first dijet scenario +# dijet( # second daughter scenario +# [85m95] +# ijet([30et]) +# ijet([40et]) +# ) # end of second dijet scenario +# ) # end of cascade scenario +# """ + + 'and([] ijet([(50et)(70et)]) dijet([(900mass, 26dphi)]))', + 'and([]simple([(50et)(70et)])dijet([(900m,26dphi)]))', +] diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py new file mode 100644 index 0000000000000000000000000000000000000000..5dcc580ce236bc9fd0d576428249b8f9a38e0445 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/treeVisitors.py @@ -0,0 +1,392 @@ +from constants import lchars + +import re +import math + +from ToolSetter import ToolSetter +class Checker(object): + def __init__(self): + self.known = { + 'simple': ('Et'), + 'cascade': ('m') + } + + self.msgs = [] + self.nchecked = 0 + + def mod(self, node): + self.nchecked += 1 + if node.scenario not in self.known: + self.msgs.append('unknown scenario %s' % node.scenario) + + def report(self): + s = ['Checker: %d nodes checked' % self.nchecked] + s.extend(self.msgs) + return '\n'.join(s) + + +class TreeBuilder(object): + def __init__(self): + self.tree = '(' + + def add(self, s): + self.tree += s + + def report(self): + return self.tree + + +class TreeToBooleanExpression(object): + """visit a hypo tree. If boolean scenarios are present, build a + boolean expression string.""" + + def __init__(self): + self.stack = [] + + def mod(self, node): + if node.scenario == 'not': + self.stack.append(' ! ') + return + + if node.scenario == 'and': + self.stack.append(' x ') + return + + if node.scenario == 'or': + self.stack.append(' + ') + return + + self.stack.append(' %s ' %node.tool.name()) + + def report(self): + s = '%s: ' % self.__class__.__name__ + while self.stack: s += self.stack.pop() + return s.strip() + + +class TreeParameterExpander_simple(object): + """Convert parameter string into duction holding low, high window + cut vals. Specialistaion for the 'simple' scenario + + parameter strings look like '40et, 0eta320, nosmc' + """ + + window_re = re.compile( + r'^(?P<lo>\d*)(?P<attr>[%s]+)(?P<hi>\d*)' % lchars) + + defaults = {'etalo': 0.0, + 'etahi': 3.2, + } + + scale_factors = {'eta': 0.01, + 'et': 1000., + 'smc': 1000., + } + + def __init__(self): + self.msgs = [] + + def mod(self, node): + + def get_conditions(params): + """Split conditions string into list of condition strings + Condition string looks like + '(10et,0eta320)(20et,0eta320)(40et,0eta320)' + returned is ['10et,0eta320', '20et,0eta320', '40et,0eta320'] + """ + + alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789,' + pat = re.compile(r'(^\([%s]+\))'% alphabet ) + s = params + m = True + conditions = [] + while m: + m = pat.match(s) + if m is not None: + conditions.append(m.group(0)) + s = s[len(conditions[-1]):] + assert params == ''.join(conditions) + conditions = [c[1:-1] for c in conditions] # strip parens + return conditions + + + conditions = get_conditions(node.parameters) + + + node.conf_attrs['EtThresholds'] = [] + node.conf_attrs['eta_mins'] = [] + node.conf_attrs['eta_maxs'] = [] + node.conf_attrs['asymmetricEtas'] = [] + + for c in conditions: + toks = c.split(',') + toks = [t.strip() for t in toks] + + + for t in toks: + m = self.window_re.match(t) + if m is None: + self.msgs.append('match failed for parameter %s' % t) + return + group_dict = m.groupdict() + attr = group_dict['attr'] + lo = group_dict['lo'] + hi = group_dict['hi'] + if lo == '': + lo = self.defaults.get(attr+'lo', '') + if hi == '': + hi = self.defaults.get(attr+'hi', '') + + sf = self.scale_factors[attr] + if lo: + if attr == 'eta': + node.conf_attrs['eta_mins'].append(sf * float(lo)) + elif attr == 'et': + node.conf_attrs['EtThresholds'].append(sf * float(lo)) + if hi: + if attr == 'eta': + node.conf_attrs['eta_maxs'].append(sf * float(hi)) + + #01/01/2019 PS KLUDGE !! FIX ME!!! asymmetric eta hardwired to 0. + + [node.conf_attrs['asymmetricEtas'].append(0) for i in range( + len(conditions))] + self.msgs = ['All OK'] + + + def report(self): + return '%s: ' % self.__class__.__name__ + '\n'.join(self.msgs) + + + + +class TreeParameterExpander_dijet(object): + """Convert parameter string into duction holding low, high window + cut vals. Specialistaion for the dijet scenario + + parameter strings look like '40m,100deta200, 50dphi300' + """ + + window_re = re.compile( + r'^(?P<lo>\d*)(?P<attr>[%s]+)(?P<hi>\d*)' % lchars) + + defaults = {'mass_mins': 0.0, + 'mass_maxs': 100000., + 'deta_mins': 0., + 'deta_maxs': 20., + 'dphi_mins': 0., + 'dphi_maxs': math.pi, + } + + scale_factors = {'deta': 0.01, + 'mass': 1000., + 'dphi': 0.01, + } + + def __init__(self): + self.msgs = [] + + def mod(self, node): + + def get_conditions(params): + """Split conditions string into list of condition strings + Condition string looks like + '(75m85,100dEta200, 50dphi200)(80m90, 110dEta210)' + returned is ['10et,0eta320', '20et,0eta320', '40et,0eta320'] + """ + + alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789,' + pat = re.compile(r'(^\([%s]+\))'% alphabet ) + s = params + m = True + conditions = [] + while m: + m = pat.match(s) + if m is not None: + conditions.append(m.group(0)) + s = s[len(conditions[-1]):] + assert params == ''.join(conditions) + conditions = [c[1:-1] for c in conditions] # strip parens + return conditions + + ok = True # status flag + conditions = get_conditions(node.parameters) + + bare_attrs = ['mass', 'deta', 'dphi'] + all_attrs = [] + for attr in bare_attrs: + all_attrs.extend([attr+'_mins', attr+'_maxs']) + + for attr in all_attrs: + node.conf_attrs[attr] = [] + + for c in conditions: + toks = c.split(',') + toks = [t.strip() for t in toks] + + + processed_attrs = [] + for t in toks: + m = self.window_re.match(t) + if m is None: + self.msgs.append('match failed for parameter %s' % t) + return + group_dict = m.groupdict() + attr = group_dict['attr'] + lo = group_dict['lo'] + hi = group_dict['hi'] + if lo == '': + lo = self.defaults.get(attr+'_min', '') + if hi == '': + hi = self.defaults.get(attr+'_max', '') + + sf = self.scale_factors[attr] + if lo: + if attr == 'mass': + node.conf_attrs['mass_mins'].append(sf * float(lo)) + elif attr == 'deta': + node.conf_attrs['deta_mins'].append(sf * float(lo)) + elif attr == 'dphi': + node.conf_attrs['dphi_mins'].append(sf * float(lo)) + + processed_attrs.append(attr+'_mins') + if hi: + if attr == 'mass': + node.conf_attrs['mass_maxs'].append(sf * float(lo)) + elif attr == 'deta': + node.conf_attrs['deta_maxs'].append(sf * float(lo)) + elif attr == 'dphi': + node.conf_attrs['dphi_maxs'].append(sf * float(lo)) + + processed_attrs.append(attr+'_maxs') + + + + for a in all_attrs: + if a not in processed_attrs: + node.conf_attrs[a].append(self.defaults[a]) + + for a in processed_attrs: + if a not in all_attrs: + self.msgs.append('Unknown attribute: %s' % a) + ok = False + + if ok: + self.msgs = ['All OK'] + else: + self.msgs.append('Error') + + + def report(self): + return '%s: ' % self.__class__.__name__ + '\n'.join(self.msgs) + + +class TreeParameterExpander_null(object): + """Does nothing except check the parameter string is empty""" + + def __init__(self): + self.msgs = ['Do nothing paramter expander'] + + def mod(self, node): + assert node.parameters == '' + + def report(self): + return '%s: ' % self.__class__.__name__ + '\n'.join(self.msgs) + + + +class TreeParameterExpander(object): + """Class to exapnder node.paramters string. Delegates to + specialised exanders.""" + + router = { + 'simple': TreeParameterExpander_simple, + 'dijet': TreeParameterExpander_dijet, + 'not': TreeParameterExpander_null, + 'and': TreeParameterExpander_null, + 'or': TreeParameterExpander_null, + } + + def __init__(self): + self.expander = None + + def mod(self, node): + self.expander = self.router[node.scenario]() + self.expander.mod(node) + print self.expander.report() + def report(self): + return self.expander.report() + + + +class TreeToCascade(object): + def __init__(self): + self.stack = [] + + def mod(self, node): + + self.stack.append( + '(%s < (%s))' %(node.tool.name(), + ' '.join([c.tool.name for c in node.children]))) + + def report(self): + s = '' + while self.stack: + s += self.stack.pop() + return s.strip() + + +def _test(s): + + from ChainLabelParser import ChainLabelParser + parser = ChainLabelParser(s) + tree = parser.parse() + print tree.dump() + # exapnd the window cuts (strings) obtained from the chain label + # to attributes and floating point numbers, set defaults + # for unspecified vallues + visitor = TreeParameterExpander() + tree.accept(visitor) + print visitor.report() + print tree.dump() + + + # set the node attribute node.tool to be the hypo Al\gTool. + print 'sending in the ToolSetter visitor' + ts_visitor = ToolSetter(s) + tree.accept_cf(ts_visitor) + print ts_visitor.report() + + + print tree.dump() + + +def test(index): + from test_cases import test_strings + import sys + c = sys.argv[1] + index = -1 + try: + index = int(c) + except: + print 'expected int in [1,%d] ]on comand line, got %s' % ( + len(test_strings), c) + sys.exit() + + print 'index', index + print '========== Test %d ==============' % index + s = test_strings[index] + print s + _test(s) + + +if __name__ == '__main__': + import sys + c = sys.argv[1] + ic = -1 + try: + ic = int(c) + except: + print 'expected int on command line, got ',c + sys.exit() + test(ic) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetMTCondition.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetMTCondition.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8e1c5d29314cf94e471cdab54c94f233c0b1ff89 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetMTCondition.cxx @@ -0,0 +1,101 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetMTCondition.h" +#include <sstream> +#include <stdexcept> +#include <TLorentzVector.h> +#include <limits> +// #include <iostream> +DijetMTCondition::DijetMTCondition(double massMin, + double massMax, + double detaMin, + double detaMax, + double dphiMin, + double dphiMax + ){ + m_massMin = massMin; + m_massMax = massMax; + m_detaMin = detaMin; + m_detaMax = detaMax; + m_dphiMin = dphiMin; + m_dphiMax = dphiMax; +} + + +bool DijetMTCondition::isSatisfied(const HypoJetVector& ips) const{ + if(ips.size() != 2){ + std::stringstream ss; + ss << "DijetMT::isSatisfied must see exactly 2 particles, but received " + << ips.size() + << '\n'; + + throw std::runtime_error(ss.str()); + } + + auto j0 = ips[0]; + auto j1 = ips[1]; + + auto rj0 = 0.001 * (j0 -> p4()); + auto rj1 = 0.001 * (j1 -> p4()); + + auto mass = (rj0 + rj1).M(); + if (m_massMin > mass or mass >= m_massMax){return false;} + + + auto eta0 = j0->eta(); + auto eta1 = j1->eta(); + auto adeta = std::abs(eta0 -eta1); + if (m_detaMin > adeta or adeta >= m_detaMax){return false;} + + + auto dphi = std::abs(rj0.DeltaPhi(rj1)); + if (m_dphiMin > dphi or dphi >= m_dphiMax){return false;} + + return true; + + /* + auto result = test(et0, et1, absEta0, absEta1, dEta, mass); + std::cout << "DijetMTCondition : " << std::boolalpha << result << '\n' + << std::setprecision(3) << std::scientific + << "jet 0 et " << m_etThreshold0 << " " << et0 << '\n' + << "jet 1 et " << m_etThreshold1 << " " << et1 << '\n' + << "jet 0 eta " << m_etaMin0 << " " << eta0 << " " << m_etaMax0 << '\n' + << "jet 1 eta " << m_etaMin1 << " " << eta1 << " " << m_etaMax1 << '\n' + << "dEta " << m_dEtaMin << " " << dEta << " " << m_dEtaMax << '\n' + << "mass " << m_massMin << " " << mass << " " <<m_massMax << '\n'; + + return result; + */ + +} + +std::string DijetMTCondition::toString() const noexcept { + std::stringstream ss; + ss << "DijetMTCondition: " + + << " mass min: " + << m_massMin + << " mass max: " + << m_massMax + + << " dEta min: " + << m_detaMin + << " dEta max: " + << m_detaMax + + << " dPhi min: " + << m_dphiMin + << " dPhi max: " + << m_dphiMax + + <<'\n'; + + return ss.str(); +} + + +double DijetMTCondition::orderingParameter() const noexcept { + return m_massMin; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx index 20299f147eed95deb91560997067108c5b3dea34..ce9babaa9a7aac66132be59a7658593bb7f1cb1d 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx @@ -19,6 +19,7 @@ #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDEtaMassCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDPhiCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetCondition.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetMTCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HTCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/TLACondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h" @@ -104,6 +105,30 @@ Conditions conditionsFactoryDijet(const std::vector<double>& etThresholds1, return conditions; } + +Conditions conditionsFactoryDijetMT(const std::vector<double>& massMins, + const std::vector<double>& massMaxs, + const std::vector<double>& detaMins, + const std::vector<double>& detaMaxs, + const std::vector<double>& dphiMins, + const std::vector<double>& dphiMaxs){ + Conditions conditions; + + for(std::size_t i = 0; i < massMins.size(); ++i){ + std::shared_ptr<ICondition> + pCondition(new DijetMTCondition(massMins[i], + massMaxs[i], + detaMins[i], + detaMaxs[i], + dphiMins[i], + dphiMaxs[i])); + + conditions.push_back(ConditionBridge(pCondition)); + } + return conditions; +} + + Conditions conditionsFactoryDijetEtaMass(const std::vector<double>& etaMins, const std::vector<double>& etaMaxs, const std::vector<double>& etMins, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetAndToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetAndToolMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4b169a56a5f0b1af348342a11cf281f2b42a1bf1 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetAndToolMT.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigJetAndToolMT.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo +// +// +// ******************************************************************** + +#include "TrigJetAndToolMT.h" + +#include "GaudiKernel/StatusCode.h" + +#include "DecisionHandling/HLTIdentifier.h" +#include "DecisionHandling/TrigCompositeUtils.h" + +using TrigCompositeUtils::DecisionID; +using TrigCompositeUtils::Decision; +using TrigCompositeUtils::DecisionContainer; + +TrigJetAndToolMT::TrigJetAndToolMT(const std::string& type, + const std::string& name, + const IInterface* parent) : + base_class(type, name, parent), + m_decisionId(HLT::Identifier::fromToolName(name)) { +} + + +TrigJetAndToolMT::~TrigJetAndToolMT(){ +} + +StatusCode TrigJetAndToolMT::initialize(){ + return StatusCode::SUCCESS; +} + +StatusCode TrigJetAndToolMT::finalize(){ + return StatusCode::SUCCESS; +} + +StatusCode TrigJetAndToolMT::decide(const xAOD::JetContainer* jets, + bool& pass) const { + + m_lhs->decide(jets, pass); + if (pass){ + ATH_MSG_DEBUG("LHS passed"); + m_rhs->decide(jets, pass); + ATH_MSG_DEBUG("RHS " <<std::boolalpha << pass); + } else { + ATH_MSG_DEBUG("LHS failed"); + } + + + return StatusCode::SUCCESS; +} + + +const HLT::Identifier& TrigJetAndToolMT::getId() const{ + return m_decisionId; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetAndToolMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetAndToolMT.h new file mode 100644 index 0000000000000000000000000000000000000000..f2140fc2a75718c86926b324bc1ef578217bfab7 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetAndToolMT.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGJETANDTOOLMT_H +#define TRIGJETANDTOOLMT_H +/******************************************************************** + * + * NAME: TrigJetAndToolMT.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * + *********************************************************************/ + + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "DecisionHandling/TrigCompositeUtils.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +#include "ITrigJetHypoToolMT.h" +#include "ITrigJetHypoToolConfig.h" + +class TrigJetAndToolMT: public extends<AthAlgTool, ITrigJetHypoToolMT> { + + public: + + TrigJetAndToolMT(const std::string& type, + const std::string& name, + const IInterface* parent); + virtual ~TrigJetAndToolMT(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + // ITrigJetHypoToolMT interface + virtual StatusCode + decide(const xAOD::JetContainer*, bool& pass) const override; + virtual const HLT::Identifier& getId() const override; + private: + + // Identifier is used to keep track of which tool made which decision. + // The information is stored in the event store. + HLT::Identifier m_decisionId; + + ToolHandle<ITrigJetHypoToolMT> m_lhs { + this, "lhs", {}, "LHS boolean binary expression"}; + ToolHandle<ITrigJetHypoToolMT> m_rhs { + this, "rhs", {}, "RHS boolean binary expression"}; + + + // Monitored variables... + /* + declareMonitoredVariable("NJet", m_njet); + declareMonitoredVariable("Et", m_et); + declareMonitoredVariable("Eta", m_eta); + declareMonitoredVariable("Phi", m_phi); +*/ + + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_dijet.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_dijet.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c079a5328ca941f25dcc2fc72525498a4d6f8bf9 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_dijet.cxx @@ -0,0 +1,94 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* + Instatniation of JetHypo components for the DiMass scenario + */ +#include "TrigJetHypoToolConfig_dijet.h" + +#include "GaudiKernel/StatusCode.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsSorter.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/xAODJetAsIJetFactory.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/groupsMatcherFactory.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerFactory.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/TrigHLTJetHypoHelper2.h" + +#include "DecisionHandling/TrigCompositeUtils.h" + +using TrigCompositeUtils::DecisionID; +using TrigCompositeUtils::Decision; +using TrigCompositeUtils::DecisionContainer; + +TrigJetHypoToolConfig_dijet::TrigJetHypoToolConfig_dijet(const std::string& type, + const std::string& name, + const IInterface* parent) : + base_class(type, name, parent){ + +} + + +TrigJetHypoToolConfig_dijet::~TrigJetHypoToolConfig_dijet(){ +} + +StatusCode TrigJetHypoToolConfig_dijet::initialize() { + CHECK(checkVals()); + return StatusCode::SUCCESS; +} + + + + +Conditions TrigJetHypoToolConfig_dijet::getConditions() const { + auto conditions = conditionsFactoryDijetMT(m_massMins, + m_massMaxs, + m_dEtaMins, + m_dEtaMaxs, + m_dPhiMins, + m_dPhiMaxs); + + std::sort(conditions.begin(), conditions.end(), ConditionsSorter()); + + return conditions; +} + + +std::unique_ptr<IJetGrouper> TrigJetHypoToolConfig_dijet::getJetGrouper() const { + return std::make_unique<CombinationsGrouper>(2); +} + +StatusCode TrigJetHypoToolConfig_dijet::checkVals() const { + // check cionsistent sizes + + auto sz = m_massMins.size(); + if (sz != m_massMaxs.size() or + sz != m_dEtaMins.size() or + sz != m_dEtaMaxs.size() or + sz != m_dPhiMins.size() or + sz != m_dPhiMaxs.size()){ + ATH_MSG_ERROR(name() + << ": mismatch between number of thresholds " + << "and min, max fro mass, dEta, dPhi " + << m_massMins.size() << " " + << m_massMaxs.size() << " " + << m_dEtaMins.size() << " " + << m_dEtaMaxs.size() << " " + << m_dPhiMins.size() << " " + << m_dPhiMaxs.size() << " "); + + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +std::vector<std::shared_ptr<ICleaner>> +TrigJetHypoToolConfig_dijet::getCleaners() const { + std::vector<std::shared_ptr<ICleaner>> v; + return v; +} + + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_dijet.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_dijet.h new file mode 100644 index 0000000000000000000000000000000000000000..0f47ee6b7ca523715dfa7b286b84c033eeda9dea --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_dijet.h @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGJETHYPOTOOLConfig_DIJET_H +#define TRIGJETHYPOTOOLConfig_DIJET_H +/******************************************************************** + * + * NAME: TrigJetHypoToolConfig_dijetTool.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * + *********************************************************************/ + + +#include "ITrigJetHypoToolConfig.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "DecisionHandling/TrigCompositeUtils.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +class TrigJetHypoToolConfig_dijet: +public extends<AthAlgTool, ITrigJetHypoToolConfig> { + + public: + + TrigJetHypoToolConfig_dijet(const std::string& type, + const std::string& name, + const IInterface* parent); + virtual ~TrigJetHypoToolConfig_dijet(); + + virtual StatusCode initialize() override; + virtual std::vector<std::shared_ptr<ICleaner>> getCleaners() const override; + virtual std::unique_ptr<IJetGrouper> getJetGrouper() const override; + virtual Conditions getConditions() const override; + + private: + + Gaudi::Property<std::vector<double>> + m_massMins{this, "mass_mins", {}, "min mass for each dijet"}; + + Gaudi::Property<std::vector<double>> + m_massMaxs{this, "mass_maxs", {}, "max mass for each dijet"}; + + Gaudi::Property<std::vector<double>> + m_dEtaMins{this, "deta_mins", {}, "min dEta for jets in each dijet"}; + + Gaudi::Property<std::vector<double>> + m_dEtaMaxs{this, "deta_maxs", {}, "max dEta for jets in each dijet"}; + + Gaudi::Property<std::vector<double>> + m_dPhiMins{this, "dphi_mins", {}, "min dPhi for jets in each dijet"}; + + Gaudi::Property<std::vector<double>> + m_dPhiMaxs{this, "dphi_maxs", {}, "max dPhi for jets in each dijet"}; + + virtual StatusCode checkVals() const override; + + // Monitored variables... + /* + declareMonitoredVariable("NJet", m_njet); + declareMonitoredVariable("Et", m_et); + declareMonitoredVariable("Eta", m_eta); + declareMonitoredVariable("Phi", m_phi); +*/ + + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_simple.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_simple.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9eaa545f00f71bfa79b1c4ec366017ecdae190c5 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_simple.cxx @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigJetHypoToolMT_simple.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo +// +// +// ******************************************************************** + +#include "TrigJetHypoToolConfig_simple.h" + +#include "GaudiKernel/StatusCode.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsSorter.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/xAODJetAsIJetFactory.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/groupsMatcherFactory.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerFactory.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/TrigHLTJetHypoHelper2.h" + +#include "DecisionHandling/TrigCompositeUtils.h" + +using TrigCompositeUtils::DecisionID; +using TrigCompositeUtils::Decision; +using TrigCompositeUtils::DecisionContainer; + +TrigJetHypoToolConfig_simple::TrigJetHypoToolConfig_simple(const std::string& type, + const std::string& name, + const IInterface* parent) : + base_class(type, name, parent){ + +} + + +TrigJetHypoToolConfig_simple::~TrigJetHypoToolConfig_simple(){ +} + +StatusCode TrigJetHypoToolConfig_simple::initialize() { + CHECK(checkVals()); + return StatusCode::SUCCESS; +} + + + + +Conditions TrigJetHypoToolConfig_simple::getConditions() const { + auto conditions = conditionsFactoryEtaEt(m_etaMins, + m_etaMaxs, + m_EtThresholds, + m_asymmetricEtas); + std::sort(conditions.begin(), conditions.end(), ConditionsSorter()); + + return conditions; +} + + +std::unique_ptr<IJetGrouper> +TrigJetHypoToolConfig_simple::getJetGrouper() const { + return std::make_unique<SingleJetGrouper>(); +} + +StatusCode TrigJetHypoToolConfig_simple::checkVals() const { + if (m_EtThresholds.size() != m_etaMins.size() or + m_EtThresholds.size() != m_etaMaxs.size() or + m_asymmetricEtas.size() != m_etaMaxs.size()){ + + ATH_MSG_ERROR(name() + << ": mismatch between number of thresholds " + << "and eta min, max boundaries or asymmetric eta flags: " + << m_EtThresholds.size() << " " + << m_etaMins.size() << " " + << m_etaMaxs.size() << " " + << m_asymmetricEtas.size() << " " + ); + + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +std::vector<std::shared_ptr<ICleaner>> +TrigJetHypoToolConfig_simple::getCleaners() const { + std::vector<std::shared_ptr<ICleaner>> v; + return v; +} + + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_simple.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_simple.h new file mode 100644 index 0000000000000000000000000000000000000000..6f8b04e489d0e8f4cddef75caaa60446338bf5c4 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolConfig_simple.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGJETHYPOTOOLConfig_SIMPLE_H +#define TRIGJETHYPOTOOLConfig_SIMPLE_H +/******************************************************************** + * + * NAME: TrigJetHypoToolConfig_simple.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * + *********************************************************************/ + + +#include "ITrigJetHypoToolConfig.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "DecisionHandling/TrigCompositeUtils.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +class TrigJetHypoToolConfig_simple: +public extends<AthAlgTool, ITrigJetHypoToolConfig> { + + public: + + TrigJetHypoToolConfig_simple(const std::string& type, + const std::string& name, + const IInterface* parent); + virtual ~TrigJetHypoToolConfig_simple(); + + virtual StatusCode initialize() override; + virtual std::vector<std::shared_ptr<ICleaner>> getCleaners() const override; + virtual std::unique_ptr<IJetGrouper> getJetGrouper() const override; + virtual Conditions getConditions() const override; + + private: + + Gaudi::Property<std::vector<double>> + m_EtThresholds{this, "EtThresholds", {}, "Etthresholds by eta region"}; + + Gaudi::Property<std::vector<double>> + m_etaMins{this, "eta_mins", {}, "Eta min for eta regions"}; + + Gaudi::Property<std::vector<double>> + m_etaMaxs{this, "eta_maxs", {}, "Eta max for eta regions"}; + + Gaudi::Property<std::vector<int>> + m_asymmetricEtas{this, "asymmetricEtas", {}, "Apply asym. eta cuts"}; + + + virtual StatusCode checkVals() const override; + + // Monitored variables... + /* + declareMonitoredVariable("NJet", m_njet); + declareMonitoredVariable("Et", m_et); + declareMonitoredVariable("Eta", m_eta); + declareMonitoredVariable("Phi", m_phi); +*/ + + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx index 4faa51b87fba9376947fb64aa326574c1596e864..90fcef3969414d96473bd53cf433d3feb58706e2 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx @@ -71,7 +71,7 @@ StatusCode TrigJetHypoToolMT::decide(const xAOD::JetContainer* jets, std::move(matcher)); /* apply cleaning and hypothesis alg */ - ATH_MSG_DEBUG("hypo helper start... " << m_chainName + ATH_MSG_DEBUG("hypo helper start... " << " no of jets ... " << jets->size() << "..."); @@ -88,7 +88,7 @@ StatusCode TrigJetHypoToolMT::decide(const xAOD::JetContainer* jets, // accumulateTime(steady_clock::now() - t); - ATH_MSG_DEBUG("hypo testing done chain " << m_chainName + ATH_MSG_DEBUG("hypo testing done chain " << " no of input jets " << jets->size() << " pass " << pass ); @@ -144,12 +144,12 @@ void TrigJetHypoToolMT::writeDebug(bool pass, const HypoJetVector& passedJets, const HypoJetVector& failedJets ) const{ - ATH_MSG_INFO("Writing debug start" << m_chainName << "..."); + ATH_MSG_INFO("Writing debug start..."); if(pass){ - ATH_MSG_DEBUG(m_chainName<< " event passed"); + ATH_MSG_DEBUG(" event passed"); } else { - ATH_MSG_DEBUG(m_chainName<< " event failed"); + ATH_MSG_DEBUG(" event failed"); } for (auto j : passedJets) { diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.h index 0b9fac33e1ee61fd516b4b234fd359c9692744b3..0e3744f582bdca4ae80d8297f944a7c8f2199797 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.h @@ -53,7 +53,7 @@ class TrigJetHypoToolMT: public extends<AthAlgTool, ITrigJetHypoToolMT> { // Paraphanalia needed for the Jet Hypo Helper class: Conditions m_conditions; - bool m_dumpJets{false}; + Gaudi::Property<bool> m_dumpJets{this, "dumpJets", {}, "verbose jet dump flag"}; void setCleaners(); @@ -152,9 +152,6 @@ class TrigJetHypoToolMT: public extends<AthAlgTool, ITrigJetHypoToolMT> { Gaudi::Property<float> m_avLarQFLlpThreshold{this, "AverageLArQFLlpThreshold", 0.8*65535, ""}; - Gaudi::Property<std::string> - m_chainName{this, "chain_name", {}, "chain name (dbg)"}; - Gaudi::Property<bool> m_acceptAll{this, "AcceptAll", false, "flag to turn of hypo"}; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetNotToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetNotToolMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2ec75ba2f8c83a8fd7a4af063b19fc2839940593 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetNotToolMT.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigJetNotToolMT.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo +// +// +// ******************************************************************** + +#include "TrigJetNotToolMT.h" + +#include "GaudiKernel/StatusCode.h" + +#include "DecisionHandling/HLTIdentifier.h" +#include "DecisionHandling/TrigCompositeUtils.h" + +using TrigCompositeUtils::DecisionID; +using TrigCompositeUtils::Decision; +using TrigCompositeUtils::DecisionContainer; + +TrigJetNotToolMT::TrigJetNotToolMT(const std::string& type, + const std::string& name, + const IInterface* parent) : + base_class(type, name, parent), + m_decisionId(HLT::Identifier::fromToolName(name)) { +} + + +TrigJetNotToolMT::~TrigJetNotToolMT(){ +} + +StatusCode TrigJetNotToolMT::initialize(){ + return StatusCode::SUCCESS; +} + +StatusCode TrigJetNotToolMT::finalize(){ + return StatusCode::SUCCESS; +} + +StatusCode TrigJetNotToolMT::decide(const xAOD::JetContainer* jets, + bool& pass) const { + + m_hypoTool->decide(jets, pass); + + if(pass){ + ATH_MSG_DEBUG("hypoTool passed"); + } else { + ATH_MSG_DEBUG("hypoTool failed"); + } + + pass = !pass; + + return StatusCode::SUCCESS; +} + + +const HLT::Identifier& TrigJetNotToolMT::getId() const{ + return m_decisionId; +} + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetNotToolMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetNotToolMT.h new file mode 100644 index 0000000000000000000000000000000000000000..05504bb518422c4e9650bc2c47d6c830e9cbabe6 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetNotToolMT.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collabnotation +*/ + +#ifndef TRIGJETNOTTOOLMT_H +#define TRIGJETNOTTOOLMT_H +/******************************************************************** + * + * NAME: TrigJetNotToolMT.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * + *********************************************************************/ + + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "DecisionHandling/TrigCompositeUtils.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +#include "ITrigJetHypoToolMT.h" +#include "ITrigJetHypoToolConfig.h" + +class TrigJetNotToolMT: public extends<AthAlgTool, ITrigJetHypoToolMT> { + + public: + + TrigJetNotToolMT(const std::string& type, + const std::string& name, + const IInterface* parent); + virtual ~TrigJetNotToolMT(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + // ITrigJetHypoToolMT interface + virtual StatusCode + decide(const xAOD::JetContainer*, bool& pass) const override; + virtual const HLT::Identifier& getId() const override; + private: + + // Identifier is used to keep track of which tool made which decision. + // The information is stored in the event store. + HLT::Identifier m_decisionId; + + ToolHandle<ITrigJetHypoToolMT> m_hypoTool { + this, "hypoTool", {}, "predicate to be inverted"}; + + + // Monitored variables... + /* + declareMonitoredVariable("NJet", m_njet); + declareMonitoredVariable("Et", m_et); + declareMonitoredVariable("Eta", m_eta); + declareMonitoredVariable("Phi", m_phi); +*/ + + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetOrToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetOrToolMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..80846e55aeabf7fd464632eb925790392511d383 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetOrToolMT.cxx @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigJetOrToolMT.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo +// +// +// ******************************************************************** + +#include "TrigJetOrToolMT.h" + +#include "GaudiKernel/StatusCode.h" + +#include "DecisionHandling/HLTIdentifier.h" +#include "DecisionHandling/TrigCompositeUtils.h" + +using TrigCompositeUtils::DecisionID; +using TrigCompositeUtils::Decision; +using TrigCompositeUtils::DecisionContainer; + +TrigJetOrToolMT::TrigJetOrToolMT(const std::string& type, + const std::string& name, + const IInterface* parent) : + base_class(type, name, parent), + m_decisionId(HLT::Identifier::fromToolName(name)) { +} + + +TrigJetOrToolMT::~TrigJetOrToolMT(){ +} + +StatusCode TrigJetOrToolMT::initialize(){ + return StatusCode::SUCCESS; +} + +StatusCode TrigJetOrToolMT::finalize(){ + return StatusCode::SUCCESS; +} + +StatusCode TrigJetOrToolMT::decide(const xAOD::JetContainer* jets, + bool& pass) const { + + m_lhs->decide(jets, pass); + if (not pass){ + m_rhs->decide(jets, pass); + ATH_MSG_DEBUG("LHS failed " << " RHS " <<std::boolalpha << pass); + } else { + ATH_MSG_DEBUG("LHS passed"); + } + + return StatusCode::SUCCESS; +} + + +const HLT::Identifier& TrigJetOrToolMT::getId() const{ + return m_decisionId; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetOrToolMT.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetOrToolMT.h new file mode 100644 index 0000000000000000000000000000000000000000..3af3941dc6967ebd92adc306a7c71d63e01a2c43 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetOrToolMT.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGJETORTOOLMT_H +#define TRIGJETORTOOLMT_H +/******************************************************************** + * + * NAME: TrigJetOrToolMT.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * + *********************************************************************/ + + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "DecisionHandling/HLTIdentifier.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "DecisionHandling/TrigCompositeUtils.h" +#include "AthenaMonitoring/GenericMonitoringTool.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJetGrouper.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +#include "ITrigJetHypoToolMT.h" +#include "ITrigJetHypoToolConfig.h" + +class TrigJetOrToolMT: public extends<AthAlgTool, ITrigJetHypoToolMT> { + + public: + + TrigJetOrToolMT(const std::string& type, + const std::string& name, + const IInterface* parent); + virtual ~TrigJetOrToolMT(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + // ITrigJetOrToolMT interface + virtual StatusCode + decide(const xAOD::JetContainer*, bool& pass) const override; + virtual const HLT::Identifier& getId() const override; + private: + + // Identifier is used to keep track of which tool made which decision. + // The information is stored in the event store. + HLT::Identifier m_decisionId; + + ToolHandle<ITrigJetHypoToolMT> m_lhs { + this, "lhs", {}, "LHS boolean binary expression"}; + ToolHandle<ITrigJetHypoToolMT> m_rhs { + this, "rhs", {}, "RHS boolean binary expression"}; + + + // Monitored variables... + /* + declareMonitoredVariable("NJet", m_njet); + declareMonitoredVariable("Et", m_et); + declareMonitoredVariable("Eta", m_eta); + declareMonitoredVariable("Phi", m_phi); +*/ + + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx index 6b4ad114a9a9651af3433fb79ae05503e7ef20eb..014d7bb1b888fc8c080e7be24c55ef4a9e76c2c0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx @@ -10,6 +10,11 @@ #include "TrigHLTJetHypo/TrigHLTJetHypo_SMC.h" #include "../TrigJetHypoAlgMT.h" #include "../TrigJetHypoToolConfig_EtaEt.h" +#include "../TrigJetHypoToolConfig_simple.h" +#include "../TrigJetHypoToolConfig_dijet.h" +#include "../TrigJetNotToolMT.h" +#include "../TrigJetAndToolMT.h" +#include "../TrigJetOrToolMT.h" #include "../TrigJetHypoToolMT.h" DECLARE_COMPONENT( TrigHLTJetHypo2 ) @@ -19,7 +24,12 @@ DECLARE_COMPONENT( TrigEFDPhiMetJetAllTE ) DECLARE_COMPONENT( TrigHLTJetHypo_Dijet ) DECLARE_COMPONENT( TrigHLTJetHypo_DijetMassDEta ) DECLARE_COMPONENT( TrigHLTJetHypo_DijetMassDEtaDPhi ) -DECLARE_COMPONENT( TrigHLTJetHypo_EtaEt ) +DECLARE_COMPONENT( TrigJetHypoToolConfig_EtaEt ) +DECLARE_COMPONENT( TrigJetHypoToolConfig_simple ) +DECLARE_COMPONENT( TrigJetHypoToolConfig_dijet ) +DECLARE_COMPONENT( TrigJetNotToolMT) +DECLARE_COMPONENT( TrigJetAndToolMT) +DECLARE_COMPONENT( TrigJetOrToolMT) DECLARE_COMPONENT( TrigHLTJetHypo_SMC ) DECLARE_COMPONENT( TrigHLTJetHypo_HT ) DECLARE_COMPONENT( TrigHLTJetHypo_TLA ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/jetDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/jetDefs.py index 9393ed844a811eeda32a9d7e9dbc11f3b16f6aed..934c2ca704f11574b3c2be88514b348a19c894bb 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/jetDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/jetDefs.py @@ -7,8 +7,6 @@ from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon.Constants import VERBOSE,DEBUG,INFO from AthenaCommon.CFElements import parOR, seqAND, seqOR, stepSeq - - ## def jetFSInputMaker( ): ## """ Creates the jet inputMaker for FS""" ## RoIs = jetCollections.L1RoIs diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.py b/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.py index 9e36ab4f49b3850ddf28017ac473874dd5cd6b23..00344d62048da474a7d4c214609c3136d62334b3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.py @@ -119,7 +119,7 @@ if (doJet): jetChains = [ Chain(name='HLT_j85', Seed="L1_J20", ChainSteps=[jetstep1] ), - Chain(name='HLT_j100', Seed="L1_J20", ChainSteps=[jetstep1] ) + Chain(name='HLT_j45', Seed="L1_J20", ChainSteps=[jetstep1] ) ] testChains += jetChains diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.ref index f235b86abb82468c5f2906284ba1024f2872bddc..c3ef3fd3315ea425a09fa9be48ca5a5106b64d43 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/fullMenu.ref @@ -1,23 +1,20 @@ TriggerSummaryStep1 0 0 DEBUG +++ HLT_xe30_L1XE10 ID#347649004 TriggerSummaryStep1 0 0 DEBUG +++ HLT_e5_etcut ID#607406625 -TriggerSummaryStep1 0 0 DEBUG +++ HLT_j100 ID#625306965 TriggerSummaryStep1 0 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 0 0 DEBUG +++ HLT_e3_etcut1step ID#1509456583 TriggerSummaryStep1 0 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep1 0 0 DEBUG +++ HLT_e3_etcut ID#2711808158 -TriggerSummaryStep1 0 0 DEBUG +++ HLT_j85 ID#3478728990 TriggerSummaryStep2 0 0 DEBUG +++ HLT_e5_etcut ID#607406625 TriggerSummaryStep2 0 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep2 0 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep2 0 0 DEBUG +++ HLT_e3_etcut ID#2711808158 TriggerSummaryStep1 1 0 DEBUG +++ HLT_xe30_L1XE10 ID#347649004 TriggerSummaryStep1 1 0 DEBUG +++ HLT_e5_etcut ID#607406625 -TriggerSummaryStep1 1 0 DEBUG +++ HLT_j100 ID#625306965 TriggerSummaryStep1 1 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 1 0 DEBUG +++ HLT_e3_etcut1step ID#1509456583 TriggerSummaryStep1 1 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep1 1 0 DEBUG +++ HLT_e3_etcut ID#2711808158 -TriggerSummaryStep1 1 0 DEBUG +++ HLT_j85 ID#3478728990 +TriggerSummaryStep1 1 0 DEBUG +++ HLT_j45 ID#3664574289 TriggerSummaryStep2 1 0 DEBUG +++ HLT_e5_etcut ID#607406625 TriggerSummaryStep2 1 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep2 1 0 DEBUG +++ HLT_e7_etcut ID#2430733989 @@ -33,12 +30,10 @@ TriggerSummaryStep2 2 0 DEBUG +++ HLT_e7_etcut ID#243 TriggerSummaryStep2 2 0 DEBUG +++ HLT_e3_etcut ID#2711808158 TriggerSummaryStep1 3 0 DEBUG +++ HLT_xe30_L1XE10 ID#347649004 TriggerSummaryStep1 3 0 DEBUG +++ HLT_e5_etcut ID#607406625 -TriggerSummaryStep1 3 0 DEBUG +++ HLT_j100 ID#625306965 TriggerSummaryStep1 3 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 3 0 DEBUG +++ HLT_e3_etcut1step ID#1509456583 TriggerSummaryStep1 3 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep1 3 0 DEBUG +++ HLT_e3_etcut ID#2711808158 -TriggerSummaryStep1 3 0 DEBUG +++ HLT_j85 ID#3478728990 TriggerSummaryStep2 3 0 DEBUG +++ HLT_e5_etcut ID#607406625 TriggerSummaryStep2 3 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep2 3 0 DEBUG +++ HLT_e7_etcut ID#2430733989 @@ -100,12 +95,11 @@ TriggerSummaryStep2 8 0 DEBUG +++ HLT_e7_etcut ID#243 TriggerSummaryStep2 8 0 DEBUG +++ HLT_e3_etcut ID#2711808158 TriggerSummaryStep1 9 0 DEBUG +++ HLT_xe30_L1XE10 ID#347649004 TriggerSummaryStep1 10 0 DEBUG +++ HLT_e5_etcut ID#607406625 -TriggerSummaryStep1 10 0 DEBUG +++ HLT_j100 ID#625306965 TriggerSummaryStep1 10 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 10 0 DEBUG +++ HLT_e3_etcut1step ID#1509456583 TriggerSummaryStep1 10 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep1 10 0 DEBUG +++ HLT_e3_etcut ID#2711808158 -TriggerSummaryStep1 10 0 DEBUG +++ HLT_j85 ID#3478728990 +TriggerSummaryStep1 10 0 DEBUG +++ HLT_j45 ID#3664574289 TriggerSummaryStep2 10 0 DEBUG +++ HLT_e5_etcut ID#607406625 TriggerSummaryStep2 10 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep2 10 0 DEBUG +++ HLT_e7_etcut ID#2430733989 @@ -129,12 +123,10 @@ TriggerSummaryStep2 12 0 DEBUG +++ HLT_g5_etcut ID#140 TriggerSummaryStep2 12 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep2 12 0 DEBUG +++ HLT_e3_etcut ID#2711808158 TriggerSummaryStep1 13 0 DEBUG +++ HLT_e5_etcut ID#607406625 -TriggerSummaryStep1 13 0 DEBUG +++ HLT_j100 ID#625306965 TriggerSummaryStep1 13 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 13 0 DEBUG +++ HLT_e3_etcut1step ID#1509456583 TriggerSummaryStep1 13 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep1 13 0 DEBUG +++ HLT_e3_etcut ID#2711808158 -TriggerSummaryStep1 13 0 DEBUG +++ HLT_j85 ID#3478728990 TriggerSummaryStep2 13 0 DEBUG +++ HLT_e5_etcut ID#607406625 TriggerSummaryStep2 13 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep2 13 0 DEBUG +++ HLT_e7_etcut ID#2430733989 @@ -173,12 +165,11 @@ TriggerSummaryStep1 18 0 DEBUG +++ HLT_e3_etcut ID#271 TriggerSummaryStep2 18 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 19 0 DEBUG +++ HLT_xe30_L1XE10 ID#347649004 TriggerSummaryStep1 19 0 DEBUG +++ HLT_e5_etcut ID#607406625 -TriggerSummaryStep1 19 0 DEBUG +++ HLT_j100 ID#625306965 TriggerSummaryStep1 19 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep1 19 0 DEBUG +++ HLT_e3_etcut1step ID#1509456583 TriggerSummaryStep1 19 0 DEBUG +++ HLT_e7_etcut ID#2430733989 TriggerSummaryStep1 19 0 DEBUG +++ HLT_e3_etcut ID#2711808158 -TriggerSummaryStep1 19 0 DEBUG +++ HLT_j85 ID#3478728990 +TriggerSummaryStep1 19 0 DEBUG +++ HLT_j45 ID#3664574289 TriggerSummaryStep2 19 0 DEBUG +++ HLT_e5_etcut ID#607406625 TriggerSummaryStep2 19 0 DEBUG +++ HLT_g5_etcut ID#1407390618 TriggerSummaryStep2 19 0 DEBUG +++ HLT_e7_etcut ID#2430733989 @@ -199,10 +190,10 @@ TrigSignatureMoniMT INFO HLT_e7_etcut TrigSignatureMoniMT INFO HLT_e7_etcut decisions 36 205 TrigSignatureMoniMT INFO HLT_g5_etcut 20 20 17 17 17 TrigSignatureMoniMT INFO HLT_g5_etcut decisions 50 50 -TrigSignatureMoniMT INFO HLT_j100 20 20 6 0 6 -TrigSignatureMoniMT INFO HLT_j100 decisions 6 0 -TrigSignatureMoniMT INFO HLT_j85 20 20 6 0 6 -TrigSignatureMoniMT INFO HLT_j85 decisions 6 0 +TrigSignatureMoniMT INFO HLT_j45 20 20 3 0 3 +TrigSignatureMoniMT INFO HLT_j45 decisions 3 0 +TrigSignatureMoniMT INFO HLT_j85 20 20 0 0 0 +TrigSignatureMoniMT INFO HLT_j85 decisions 0 0 TrigSignatureMoniMT INFO HLT_mu6 20 20 3 0 3 TrigSignatureMoniMT INFO HLT_mu6 decisions 3 0 TrigSignatureMoniMT INFO HLT_mu6Comb 20 20 3 2 2 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/jet.menu.py b/Trigger/TrigValidation/TrigUpgradeTest/share/jet.menu.py index 936f01378a6de8f723a34842d336ae93847cd74f..668f87183b709b486e5ca0635b830c854539e5e9 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/jet.menu.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/jet.menu.py @@ -16,7 +16,7 @@ step1=ChainStep("Step1_jet", [jetSeq1]) testChains = [ Chain(name='HLT_j85', Seed="L1_J20", ChainSteps=[step1] ), - Chain(name='HLT_j100', Seed="L1_J20", ChainSteps=[step1] ) + Chain(name='HLT_j45', Seed="L1_J20", ChainSteps=[step1] ) ] diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/jetMenu.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/jetMenu.ref index ce932a38433d86b87083b601253f6cf2815216be..f9072a28f1163d202d53008ab7138a56f9dfbbc3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/jetMenu.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/jetMenu.ref @@ -1,16 +1,7 @@ -TriggerSummaryStep1 0 0 DEBUG +++ HLT_j100 ID#625306965 -TriggerSummaryStep1 0 0 DEBUG +++ HLT_j85 ID#3478728990 -TriggerSummaryStep1 1 0 DEBUG +++ HLT_j100 ID#625306965 -TriggerSummaryStep1 1 0 DEBUG +++ HLT_j85 ID#3478728990 -TriggerSummaryStep1 3 0 DEBUG +++ HLT_j100 ID#625306965 -TriggerSummaryStep1 3 0 DEBUG +++ HLT_j85 ID#3478728990 -TriggerSummaryStep1 10 0 DEBUG +++ HLT_j100 ID#625306965 -TriggerSummaryStep1 10 0 DEBUG +++ HLT_j85 ID#3478728990 -TriggerSummaryStep1 13 0 DEBUG +++ HLT_j100 ID#625306965 -TriggerSummaryStep1 13 0 DEBUG +++ HLT_j85 ID#3478728990 -TriggerSummaryStep1 19 0 DEBUG +++ HLT_j100 ID#625306965 -TriggerSummaryStep1 19 0 DEBUG +++ HLT_j85 ID#3478728990 -TrigSignatureMoniMT INFO HLT_j100 20 20 6 6 -TrigSignatureMoniMT INFO HLT_j100 decisions 6 -TrigSignatureMoniMT INFO HLT_j85 20 20 6 6 -TrigSignatureMoniMT INFO HLT_j85 decisions 6 +TriggerSummaryStep1 1 0 DEBUG +++ HLT_j45 ID#3664574289 +TriggerSummaryStep1 10 0 DEBUG +++ HLT_j45 ID#3664574289 +TriggerSummaryStep1 19 0 DEBUG +++ HLT_j45 ID#3664574289 +TrigSignatureMoniMT INFO HLT_j45 20 20 3 3 +TrigSignatureMoniMT INFO HLT_j45 decisions 3 +TrigSignatureMoniMT INFO HLT_j85 20 20 0 0 +TrigSignatureMoniMT INFO HLT_j85 decisions 0 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py b/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py index e5fb55effd1252ee26ad63eba5d0ab4c092e8288..b4702163378974077116cbe585cc52e09956250b 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py @@ -27,7 +27,10 @@ if TriggerFlags.doCalo: # menu items - CTPToChainMapping = {"HLT_j85": "L1_J20" , "HLT_j100" : "L1_J20" } + CTPToChainMapping = { + "HLT_j85": "L1_J20" , + "HLT_j45" : "L1_J20" + } testChains =[x for x, y in CTPToChainMapping.items()] topSequence.L1DecoderTest.ChainToCTPMapping = CTPToChainMapping print testChains @@ -67,13 +70,20 @@ if TriggerFlags.doCalo: (recoSequence, sequenceOut) = jetRecoSequence(inputRoIs) from TrigHLTJetHypo.TrigHLTJetHypoConf import TrigJetHypoAlgMT - from TrigHLTJetHypo.TrigJetHypoToolConfig import trigJetHypoToolFromName + from TrigHLTJetHypo.TrigJetHypoToolConfig import trigJetHypoToolFromDict hypo = TrigJetHypoAlgMT("jethypo") hypo.OutputLevel = DEBUG hypo.Jets = sequenceOut hypo.HypoInputDecisions = hypoDecisions hypo.HypoOutputDecisions = "jetDecisions" - hypo.HypoTools = [ trigJetHypoToolFromName( c, c ) for c in testChains ] + + def make_dict(chain_name): + from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName + chainNameDecoder = DictFromChainName.DictFromChainName() + return chainNameDecoder.getChainDict(chain_name) + + hypo.HypoTools = [trigJetHypoToolFromDict(make_dict(c)) + for c in testChains] print hypo for tool in hypo.HypoTools: print tool diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index 1637d01b074e227ec7f257757f585c39b9223b8e..249691380e5212f5a12df3251ae3dd5a7c06ddd2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -126,7 +126,9 @@ JetChainParts = { 'bTracking' : [], 'bConfig' : ['split',], 'bMatching' : ['antimatchdr05mu'], - 'trkopt' : [] + 'trkopt' : [], + 'hypoScenario' : ['simple', 'vbenf'], + 'smc' : ['30smcINF', '35smcINF', '40smcINF', '50smcINF', '60smcINF', 'nosmc'], } # ---- Jet Dictinary of default Values ---- @@ -153,6 +155,8 @@ JetChainParts_Default = { 'bMatching' : [], 'dataScouting' : '', 'trkopt' : 'notrk', + 'hypoScenario' : 'simple', + 'smc' : 'nosmc', } #==========================================================