ATLAS Offline Software
FastReductionAlgToolFactory.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 """Instantiator for AlgTools needed by the FastReduction."""
4 
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 
7 jetMoments = {
8  'emfrac' : 'EMFrac',
9  'hecfrac' : 'HECFrac',
10 }
11 
13 
14  def __init__(self):
15 
16  self.tool_factories = {
17  'hypo_tool': [CompFactory.TrigJetHypoTool, 0],
18  'helper_tool': [CompFactory.TrigJetHypoToolHelperNoGrouper, 0],
19 
20  'HelperToolConfigTool':
21  [CompFactory.TrigJetHypoToolConfig_fastreduction, 0],
22 
23  'ConditionFilterConfigTool':
24  [CompFactory.TrigJetHypoToolConfig_conditionfilter, 0],
25 
26  'PassThroughFilterConfigTool':
27  [CompFactory.TrigJetHypoToolConfig_passthroughfilter, 0],
28 
29  'RangeFilterConfigTool':
30  [CompFactory.TrigJetHypoToolConfig_rangefilter, 0],
31 
32  'MaxMultFilterConfigTool':
33  [CompFactory.TrigJetHypoToolConfig_maxmultfilter, 0],
34 
35  'RepeatedConditionConfigTool':
36  [CompFactory.TrigJetConditionConfig_repeated, 0],
37 
38  'eta': [CompFactory.TrigJetConditionConfig_abs_eta, 0],
39  'neta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
40  'ceta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
41  'peta': [CompFactory.TrigJetConditionConfig_signed_eta, 0],
42  'pphi': [CompFactory.TrigJetConditionConfig_phi, 0],
43  'cphi': [CompFactory.TrigJetConditionConfig_phi, 0],
44  'nphi': [CompFactory.TrigJetConditionConfig_phi, 0],
45  'et': [CompFactory.TrigJetConditionConfig_et, 0],
46  'pt': [CompFactory.TrigJetConditionConfig_pt, 0],
47  'djmass': [CompFactory.TrigJetConditionConfig_dijet_mass, 0],
48  'djdphi': [CompFactory.TrigJetConditionConfig_dijet_dphi, 0],
49  'djdeta': [CompFactory.TrigJetConditionConfig_dijet_deta, 0],
50  'qjmass': [CompFactory.TrigJetConditionConfig_qjet_mass, 0],
51  'smc': [CompFactory.TrigJetConditionConfig_smc, 0],
52  'jvt': [CompFactory.TrigJetConditionConfig_jvt, 0],
53  'ht': [CompFactory.TrigJetConditionConfig_htfr, 0],
54  'htdipz': [CompFactory.TrigJetConditionConfig_htdipz, 0],
55  'dipz_mlpl': [CompFactory.TrigJetConditionConfig_dipzmlpl, 0],
56  'mult': [CompFactory.TrigJetConditionConfig_mult, 0],
57  'bsel': [CompFactory.TrigJetConditionConfig_bdips, 0],
58  'tausel': [CompFactory.TrigJetConditionConfig_gntau, 0],
59  'clrsel': [CompFactory.TrigJetConditionConfig_emf, 0],
60  'pileuprm': [CompFactory.TrigJetConditionConfig_pileuprm, 0],
61  'clean': [CompFactory.TrigJetConditionConfig_clean, 0],
62  'all': [CompFactory.TrigJetConditionConfig_acceptAll, 0],
63  'timing': [CompFactory.TrigJetConditionConfig_timing, 0],
64  'timeSig': [CompFactory.TrigJetConditionConfig_timesig, 0],
65  }
66 
67  for var in jetMoments:
68  self.tool_factories['mom'+var] = [
69  CompFactory.TrigJetConditionConfig_moment, 0]
70 
71 
72  def __call__(self, key, name=''):
73  """using a keyword, select and return Algtool Class, and
74  a name for the instance to be created. The name can be overridden
75  by the user. For example, the hypo tool takes the chain name as
76  its name."""
77 
78  klass = self.tool_factories[key][0]
79  if name:
80  return klass, name
81 
82  sn = self.tool_factories[key][1]
83 
84  name = '%s_%d' % (key, sn)
85  self.tool_factories[key][1] += 1
86  return klass, name
87 
88  def reset(self):
89  """Reset all creation counts to 0"""
90 
91  for v in self.tool_factories.values():
92  v[1] = 0
93 
94 
95  def __str__(self):
96  wid = max(len(k) for k in self.tool_factories.keys())
97  rep = '\n%s: ' % self.__class__.__name__
98 
99  rep += '\n'.join(
100  ['%s: %d' % (k.ljust(wid), v[1])
101  for k, v in self.tool_factories.items()])
102 
103  return rep
104 
105 
106 # make a common importable tool factory instance
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
python.FastReductionAlgToolFactory.FastReductionAlgToolFactory.tool_factories
tool_factories
Definition: FastReductionAlgToolFactory.py:16
python.FastReductionAlgToolFactory.FastReductionAlgToolFactory.__call__
def __call__(self, key, name='')
Definition: FastReductionAlgToolFactory.py:72
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
python.FastReductionAlgToolFactory.FastReductionAlgToolFactory.__init__
def __init__(self)
Definition: FastReductionAlgToolFactory.py:14
python.FastReductionAlgToolFactory.FastReductionAlgToolFactory.__str__
def __str__(self)
Definition: FastReductionAlgToolFactory.py:95
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.FastReductionAlgToolFactory.FastReductionAlgToolFactory
Definition: FastReductionAlgToolFactory.py:12
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
python.FastReductionAlgToolFactory.FastReductionAlgToolFactory.reset
def reset(self)
Definition: FastReductionAlgToolFactory.py:88