ATLAS Offline Software
scenario_htdipz.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from TrigHLTJetHypo.RepeatedConditionParams import RepeatedConditionParams
4 from TrigHLTJetHypo.HelperConfigToolParams import HelperConfigToolParams
5 from TrigHLTJetHypo.ConditionDefaults import defaults
6 from TrigHLTJetHypo.make_treevec import make_treevec
7 
8 import re
9 
10 pattern_full = r'^HTZ(?P<htlo>\d+)XX(?P<N>\d+)c(?P<ptlo>\d*)' #
11 rgx_pattern = re.compile(pattern_full)
12 
14  """ Get kinematic cuts on jets for HT+DIPZ MLPL hypo """
15 
16  if not groupdict['ptlo']: # then default filtering for pt
17  groupdict['ptlo'] = '20'
18  groupdict['pthi'] = ''
19 
20  condargs = []
21  vals = defaults('pt',
22  groupdict['ptlo'],
23  '') # will be assigned default value
24  condargs.append(('pt', vals))
25 
26  vals = defaults('eta',
27  '', # will be assigned default value
28  '240')
29  condargs.append(('eta', vals))
30 
31  return condargs
32 
34  """Get jet multiplicity for HT+DIPZ MLPL hypo """
35 
36  if not groupdict['N']:
37  raise ValueError('DIPZ scenario requires a pre-defined jet multiplicity.')
38 
39  condargs = []
40 
41  vals = defaults('dipz_njet', lo = groupdict['N'], hi = groupdict['N'])
42  condargs.append(('dipz_njet', vals))
43 
44  return condargs
45 
46 def get_htdipz_from_matchdict(groupdict, njets):
47  """Get DIPz WP, capacity (njets) and decorator names"""
48 
49  condargs = []
50  vals = defaults('ht',
51  groupdict['htlo'])
52 
53  vals['decName_z']='dipz20231122_z'
54  vals['decName_sigma']='dipz20231122_negLogSigma2'
55  vals['capacity']=str(njets)
56 
57  condargs.append(('htdipz', vals))
58 
59  return condargs
60 
61 
62 def scenario_htdipz(scenario, chainPartInd):
63  """calculate the parameters needed to generate a hypo helper config AlgTool
64  starting from a the hypoScenario which appears in the chainname for
65  a DIPZ MLPL + HT condition. """
66 
67  assert scenario.startswith('HTZ'),\
68  'routing error, module %s: bad scenario %s' % (__name__, scenario)
69 
70  m = rgx_pattern.match(scenario)
71 
72  assert m is not None, \
73  'scenario_htdipz.py - regex part %s does not match scenario %s' % (
74  pattern_full, scenario)
75 
76  groupdict = m.groupdict()
77 
78  # list for the repeatedCondition parameters, FilterParams and their indices
79  # needed for the HelperConfigToolParams
80  repcondargs = []
81  filterparams = []
82  filterparam_inds = []
83 
84  # treeVec is [0, 0, 1] handle non-root nodes here
85 
86 
87  condargs_kin = get_kin_args_from_matchdict(groupdict)
88  chooseN = float(get_mult_args_from_matchdict(groupdict)[0][1]['min'])
89  condargsHTZ = get_htdipz_from_matchdict(groupdict, chooseN)
90 
91 
92  repcondargs.append(RepeatedConditionParams(tree_id=2,
93  tree_pid=1,
94  multiplicity=1,
95  chainPartInd=chainPartInd,
96  condargs=condargsHTZ))
97  filterparam_inds.append(-1) # no filter
98 
99  # N jet: single jet condition with multiplicity N
100  repcondargs.append(RepeatedConditionParams(tree_id=1,
101  tree_pid=0,
102  multiplicity=int(chooseN),
103  chainPartInd=chainPartInd,
104  condargs=condargs_kin))
105  filterparam_inds.append(-1)
106 
107  # treevec[i] gives the tree_id of the parent of the
108  # node with tree_id = i
109  treevec = make_treevec(repcondargs)
110  assert treevec == [0, 0, 1]
111 
112  assert len(repcondargs) == len(filterparam_inds)
113 
114 
115  helper_params = HelperConfigToolParams(treevec=treevec,
116  repcondargs=repcondargs,
117  filterparams=filterparams,
118  filterparam_inds=filterparam_inds)
119  return [helper_params] # a list with one entry per FastReduction tree
120 
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.scenario_htdipz.scenario_htdipz
def scenario_htdipz(scenario, chainPartInd)
Definition: scenario_htdipz.py:62
python.scenario_htdipz.get_kin_args_from_matchdict
def get_kin_args_from_matchdict(groupdict)
Definition: scenario_htdipz.py:13
Base_Fragment.defaults
dictionary defaults
This includes now the top quark, the leptons and the bosons.
Definition: GeneratorFilters/share/common/Base_Fragment.py:79
python.make_treevec.make_treevec
def make_treevec(repcondargs)
Definition: make_treevec.py:3
str
Definition: BTagTrackIpAccessor.cxx:11
python.scenario_htdipz.get_htdipz_from_matchdict
def get_htdipz_from_matchdict(groupdict, njets)
Definition: scenario_htdipz.py:46
readCCLHist.float
float
Definition: readCCLHist.py:83
python.scenario_htdipz.get_mult_args_from_matchdict
def get_mult_args_from_matchdict(groupdict)
Definition: scenario_htdipz.py:33