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