ATLAS Offline Software
Loading...
Searching...
No Matches
make_repeatedCondConfigurer.py
Go to the documentation of this file.
1# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3from TrigHLTJetHypo.FastReductionAlgToolFactory import toolfactory
4
5from AthenaCommon.Logging import logging
6from AthenaCommon.Constants import DEBUG
7
8logger = logging.getLogger( __name__)
9logger.setLevel(DEBUG)
10
11def make_repeatedCond(tree_id, tree_pid, clique,
12 multiplicity=1,
13 chainPartInd=-1,
14 conditionMakers=[],
15 invert=False):
16
17 """makes a RepeatedConditionConfigurer from explicit arguments)"""
18
19 toolclass, name = toolfactory('RepeatedConditionConfigTool')
20 repeated_args = {'name': name}
21 repeated_args['conditionMakers'] = sorted(conditionMakers, key=lambda cm: cm.name() if callable(cm.name) else cm.name)
22 repeated_args['id'] = tree_id
23 repeated_args['pid'] = tree_pid
24 repeated_args['clique'] = clique
25 repeated_args['multiplicity'] = multiplicity
26 repeated_args['chainPartInd'] = chainPartInd
27 repeated_args['invert'] = invert
28
29 return toolclass(**repeated_args)
30
31def make_repeatedObj(repArgs, conditionMakers=[]):
32 """makes a RepeatedConditionConfigurer from an objects holding
33 the necessary parameters, usually built by a scenanario_XX module."""
34
35 return make_repeatedCond(tree_id=repArgs.tree_id,
36 tree_pid=repArgs.tree_pid,
37 clique=repArgs.clique,
38 multiplicity=repArgs.multiplicity,
39 chainPartInd=repArgs.chainPartInd,
40 invert = repArgs.invert,
41 conditionMakers=conditionMakers,)
42
43
45 """paramsrepcondarg container the parameters for building the internal
46 condition configurers, and the containing RepeatedCondition configurer"""
47
48 condobjs = []
49 for key, vals in repcondarg.condargs:
50 toolclass, name = toolfactory(key)
51 vals['name'] = name
52 condobjs.append(toolclass(**vals))
53
54 return make_repeatedObj(repcondarg, condobjs)
55
56
make_repeatedCond(tree_id, tree_pid, clique, multiplicity=1, chainPartInd=-1, conditionMakers=[], invert=False)
make_repeatedObj(repArgs, conditionMakers=[])