ATLAS Offline Software
Loading...
Searching...
No Matches
scenario_fbdjnoshared.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from TrigHLTJetHypo.RepeatedConditionParams import RepeatedConditionParams
4from TrigHLTJetHypo.HelperConfigToolParams import HelperConfigToolParams
5from TrigHLTJetHypo.ConditionDefaults import defaults
6from TrigHLTJetHypo.make_treevec import make_treevec
7
8import re
9
10
11pattern = r'^FBDJNOSHARED'\
12 r'(?P<j1etlo>\d*)et(?P<j1ethi>\d*)XX'\
13 r'(?P<j2etlo>\d*)et(?P<j2ethi>\d*)XX'\
14 r'(?P<masslo>\d*)mass(?P<masshi>\d*)XX'\
15 r'(?P<fbetlo>\d*)fbet(?P<fbethi>\d*)$'
16
17rgx = re.compile(pattern)
18
19def get_fb_jet_args(groupdict, back):
20 """get the elemental condition args (cuts) for the backward and forward
21 jets"""
22
23 condargs = []
24 vals = defaults('et', lo=groupdict['fbetlo'], hi=groupdict['fbethi'])
25 condargs.append(('et', vals))
26
27 if back:
28 vals = defaults('neta')
29 condargs.append(('neta', vals))
30 else:
31 vals = defaults('peta')
32 condargs.append(('peta', vals))
33
34 return condargs
35
36
37def get_dijet_args(groupdict):
38 """get the elemental condition args (cuts) for the backward and forward
39 jets"""
40
41 condargs = []
42 vals = defaults('djmass',
43 lo=groupdict['masslo'],
44 hi=groupdict['masshi'])
45
46 condargs.append(('djmass', vals))
47
48 vals = defaults('djdphi', lo='260')
49 condargs.append(('djdphi', vals))
50
51 return condargs
52
53
54
55def get_dijet_jet_args(groupdict, jstr):
56 """get arguments for each of the jets that make up the dijet"""
57
58 assert jstr in ('j1', 'j2')
59
60 condargs = []
61 vals = defaults('et', lo=groupdict[jstr+'etlo'], hi=groupdict[jstr+'ethi'])
62 condargs.append(('et', vals))
63
64 vals = defaults('eta', lo='0', hi='490')
65 condargs.append(('eta', vals))
66
67 return condargs
68
69
70def scenario_fbdjnoshared(scenario, chainPartInd):
71 """produce a list with one element containing a HelperToolConfigTool.
72 This list will inialise a Gaudi ToolArray
73
74 The tree vector is [0, 0, 0, 0, 3, 3]
75 pos 0: root; pos 1 backward jet; pos 2 forward jet; pos 3: dijet;
76 pos 4: dijet j1; pos 5: dijet jet 2
77
78 There is a Repeated Condition configurer for each position
79
80 No conditions are filtered"""
81
82 assert scenario.startswith('FBDJNOSHARED'),\
83 'routing error, module %s: bad scenario %s' % (__name__, scenario)
84
85 m = rgx.match(scenario)
86 groupdict = m.groupdict()
87
88 # list for the repeatedCondition parameters
89 repcondargs = []
90
91 # find the constructor arguments for each elemental condition
92
93 # backward jet
94 condargs = get_fb_jet_args(groupdict, back=True)
95 # treeVec is [0, 0, 0, 0, 3, 3] handle non-root nodes here
96
97 repcondargs.append(RepeatedConditionParams(tree_id = 1,
98 tree_pid=0,
99 chainPartInd=chainPartInd,
100 condargs=condargs))
101
102 # forward jet
103 condargs = get_fb_jet_args(groupdict, back=False)
104
105 repcondargs.append(RepeatedConditionParams(tree_id = 2,
106 tree_pid=0,
107 chainPartInd=chainPartInd,
108 condargs=condargs))
109
110 # Conditions for the dijet
111 condargs = get_dijet_args(groupdict)
112
113 repcondargs.append(RepeatedConditionParams(tree_id = 3,
114 tree_pid=0,
115 chainPartInd=-1,
116 condargs=condargs))
117
118 # Conditions for the dijet j1
119 condargs = get_dijet_jet_args(groupdict, 'j1')
120 repcondargs.append(RepeatedConditionParams(tree_id = 4,
121 tree_pid=3,
122 chainPartInd=chainPartInd,
123 condargs=condargs))
124
125
126 # Conditions for the dijet j2
127 condargs = get_dijet_jet_args(groupdict, 'j2')
128 repcondargs.append(RepeatedConditionParams(tree_id = 5,
129 tree_pid=3,
130 chainPartInd=chainPartInd,
131 condargs=condargs))
132
133 # make pass through filter params for each condition in the tree.
134
135 nconds = len(repcondargs)
136 filterparams = []
137 filterparam_inds = [-1 for i in range(nconds)]
138
139
140 # parameters to initalise the AlgTool that initialises the helper AlgTool
141
142 # treevec[i] gives the tree_id of the parent of the
143 # node with tree_id = i
144 treevec = make_treevec(repcondargs)
145 assert treevec == [0, 0, 0, 0, 3, 3]
146
147 helper_params = HelperConfigToolParams(treevec=treevec,
148 repcondargs=repcondargs,
149 filterparams=filterparams,
150 filterparam_inds=filterparam_inds)
151
152 assert len(repcondargs) == len(filterparam_inds)
153
154 return [helper_params] # a list is one entry per FastReduction tree
155