ATLAS Offline Software
Loading...
Searching...
No Matches
python.TrigJetHypoToolConfig Namespace Reference

Classes

class  TestStringMethods

Functions

 trigJetHypoToolFromDict (flags, chain_dict)
 trigJetTLAHypoToolFromDict (flags, chain_dict)
 trigJetEJsHypoToolFromDict (flags, chain_dict)
 trigJetCRVARHypoToolFromDict (flags, chain_dict)
 trigJetCRHypoToolFromDict (flags, chain_dict)

Variables

 logger = logging.getLogger(__name__)
str debug = 'JETHYPODEBUG' in os.environ

Function Documentation

◆ trigJetCRHypoToolFromDict()

python.TrigJetHypoToolConfig.trigJetCRHypoToolFromDict ( flags,
chain_dict )

Definition at line 174 of file TrigJetHypoToolConfig.py.

174def trigJetCRHypoToolFromDict(flags, chain_dict):
175 chain_name = chain_dict['chainName']
176
177 doBIBrm = int(0)
178 if len(chain_dict['chainParts'][0]['exotHypo']) > 0:
179 exot_hypo = chain_dict['chainParts'][0]['exotHypo'][0]
180 else:
181 raise Exception("Unable to extract exotHypo calratio jet configuration from chain dict")
182 if 'calratio' in exot_hypo and ('calratiovar' not in exot_hypo):
183 if 'calratiormbib' in exot_hypo:
184 doBIBrm = int(1)
185 else:
186 raise Exception("misconfiguration of new calratio jet chain")
187
188 hypo = CompFactory.TrigJetCRHypoTool(chain_name)
189 hypo.MinjetlogR = 1.2
190 hypo.MintrackPt = 2*GeV
191 hypo.MindeltaR = 0.2
192 hypo.countBIBcells = 4
193 hypo.doBIBremoval = doBIBrm
194
195 return hypo
196

◆ trigJetCRVARHypoToolFromDict()

python.TrigJetHypoToolConfig.trigJetCRVARHypoToolFromDict ( flags,
chain_dict )

Definition at line 118 of file TrigJetHypoToolConfig.py.

118def trigJetCRVARHypoToolFromDict(flags, chain_dict):
119 chain_name = chain_dict['chainName']
120 doBIBrm = int(0)
121 doExoCal = int(0)
122 ExoCalCut = 220
123 if len(chain_dict['chainParts'][0]['exotHypo']) > 0:
124 exot_hypo = chain_dict['chainParts'][0]['exotHypo'][0]
125 calratioX_matched = re.match(r'.*calratiovar(?P<cut>\d{1,3}[\d\D]*)', chain_dict['chainParts'][0]['exotHypo'][0])
126 if calratioX_matched:
127 doExoCal= int(1)
128 ExoCalCut = calratioX_matched.groupdict()['cut']
129 else:
130 if len(chain_dict['chainParts'][1]['exotHypo']) > 0:
131 exot_hypo = chain_dict['chainParts'][1]['exotHypo'][0]
132 logger.warning(chain_dict)
133 calratioX_matched = re.match(r'.*calratiovar(?P<cut>\d{1,3}[\d\D]*)', chain_dict['chainParts'][1]['exotHypo'][0])
134 if calratioX_matched:
135 doExoCal= int(1)
136 ExoCalCut = calratioX_matched.groupdict()['cut']
137 else:
138 raise Exception("Unable to extract exotHypo calratio jet configuration from chain dict")
139 if 'calratiovar' in exot_hypo:
140 if 'calratiovarrmbib' in exot_hypo:
141 doBIBrm = int(1)
142 else:
143 raise Exception("misconfiguration of new calratio jet chain")
144
145 presel_matched = re.match(r'.*emf(?P<cut>\d?\d?[\d\D]+)', chain_dict['chainParts'][0]['trkpresel'])
146 if presel_matched:
147 emf_cut = presel_matched.groupdict()['cut']
148 elif len(chain_dict['chainParts'])>1:
149 presel_matched = re.match(r'.*emf(?P<cut>\d?\d?[\d\D]+)', chain_dict['chainParts'][1]['trkpresel'])
150 if presel_matched:
151 emf_cut = presel_matched.groupdict()['cut']
152 elif len(chain_dict['chainParts'])>3:
153 presel_matched = re.match(r'.*emf(?P<cut>\d?\d?[\d\D]+)', chain_dict['chainParts'][3]['trkpresel'])
154 if presel_matched:
155 emf_cut = presel_matched.groupdict()['cut']
156 else:
157 raise Exception("misconfiguration of Exotic jet chain")
158 else:
159 raise Exception("misconfiguration of Exotic jet chain")
160
161 import math
162 hypo = CompFactory.TrigJetCRVARHypoTool(chain_name)
163 hypo.MpufixLogRatio = math.log10(1./(float(emf_cut)*0.01) - 1.)
164 hypo.MinjetlogR = 1.2
165 if doExoCal:
166 hypo.MinjetlogR = (float(ExoCalCut)*0.01) - 1.
167 hypo.MintrackPt = 2*GeV
168 hypo.MindeltaR = 0.2
169 hypo.countBIBcells = 4
170 hypo.doBIBremoval = doBIBrm
171
172 return hypo
173

◆ trigJetEJsHypoToolFromDict()

python.TrigJetHypoToolConfig.trigJetEJsHypoToolFromDict ( flags,
chain_dict )

Definition at line 89 of file TrigJetHypoToolConfig.py.

89def trigJetEJsHypoToolFromDict(flags, chain_dict):
90 if len(chain_dict['chainParts']) > 1:
91 raise Exception("misconfiguration of emerging jet chain")
92
93 if len(chain_dict['chainParts'][0]['exotHypo']) > 0:
94 exot_hypo = chain_dict['chainParts'][0]['exotHypo'][0]
95 else:
96 raise Exception("Unable to extract exotHypo emerging jet configuration from chain dict")
97
98 if 'emerging' in exot_hypo:
99 trackless = int(0)
100 ptf = float(exot_hypo.split('PTF')[1].split('dR')[0].replace('p', '.'))
101 dr = float(exot_hypo.split('dR')[1].split('_')[0].replace('p', '.'))
102 elif 'trackless' in exot_hypo:
103 trackless = int(1)
104 ptf = 0.0
105 dr = float(exot_hypo.split('dR')[1].split('_')[0].replace('p', '.'))
106 else:
107 raise Exception("misconfiguration of emerging jet chain")
108
109 chain_name = chain_dict['chainName']
110
111 hypo = CompFactory.TrigJetEJsHypoTool(chain_name)
112 hypo.PTF = ptf
113 hypo.dR = dr
114 hypo.Trackless = trackless
115
116 return hypo
117
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

◆ trigJetHypoToolFromDict()

python.TrigJetHypoToolConfig.trigJetHypoToolFromDict ( flags,
chain_dict )

Definition at line 20 of file TrigJetHypoToolConfig.py.

20def trigJetHypoToolFromDict(flags, chain_dict):
21
22 from DecisionHandling.TrigCompositeUtils import isLegId, getLegIndexInt
23 chain_name = chain_dict['chainName']
24 chain_mg = chain_dict['monGroups']
25 jet_signature_identifiers = ['Jet:Jet', 'Bjet:Bjet', 'Tau:Ditau']
26
27 if isLegId(chain_name):
28 # For multi-leg chains which include jet legs we have a -- SPECIAL BEHAVIOUR --
29 # We instantiate a HypoTool only for the *first* jet leg, whichever leg that happens to be in the chain
30 # This single HypoTool gets configured to perform the selection for _all_ of the jet legs, and to report
31 # the per-jet passing status for all of these legs.
32 #
33 # Here we determine if this is the 2nd+ jet leg of a multi-leg chain which has jet legs, and return no tool if it is
34
35 # Can we fetch this from elsewhere?
36
37 leg_id = getLegIndexInt(chain_name)
38 chain_sig_w_sub_sig = [f'{sig}:{subsig}' for sig, subsigs in chain_dict['sigDicts'].items() for subsig in subsigs]
39 # CHECK: If we have called trigJetHypoToolFromDict, then the chain_sig_w_sub_sig list must contain at minimum one entry from the jet_signature_identifiers list.
40 if not any(signature in chain_sig_w_sub_sig for signature in jet_signature_identifiers):
41 raise Exception("[trigJetHypoToolFromDict] No {} in {} for chain {}. Please update this list of jet signatures.".format(tuple(jet_signature_identifiers),tuple(chain_sig_w_sub_sig),chain_name))
42
43 # CHECK: All Jet and Bjet legs (i.e. signatures from jet_signature_identifiers) must be contiguous
44 # (this check is probable best put somewhere else?)
45 status = 0
46 for entry in chain_sig_w_sub_sig:
47 if status == 0 and entry in jet_signature_identifiers:
48 status = 1
49 elif status == 1 and entry not in jet_signature_identifiers:
50 status = 2
51 elif status == 2 and entry in jet_signature_identifiers:
52 raise Exception("[trigJetHypoToolFromDict] All {} legs should be contiguous in the signatures list, modify the ordering of the chain {}. Signatures:{}.".format(tuple(jet_signature_identifiers),chain_name, tuple(chain_sig_w_sub_sig)))
53
54 # CHECK: The leg_id must correspond to a Signature from jet_signature_identifiers. At the time of implementation, this is not guaranteed and can be affected by alignment.
55 # If this check fails for any chain, then we need to look again at how the legXXX ordering maps to the chain_sig_w_sub_sig ordering.
56 if not any(signature in chain_sig_w_sub_sig[leg_id] for signature in jet_signature_identifiers):
57 raise Exception("[trigJetHypoToolFromDict] For this code to work for chain {}, the signature at index {} must be one of {}. But the signature list is: {}".format(chain_name,leg_id,tuple(jet_signature_identifiers),tuple(chain_sig_w_sub_sig)))
58
59 # Locate the first index within chain_sig_w_sub_sig which contains an signature listed in jet_signature_identifiers
60 first_leg_index = 999
61 for signature in jet_signature_identifiers:
62 if signature in chain_sig_w_sub_sig:
63 first_leg_index = min(first_leg_index, chain_sig_w_sub_sig.index(signature))
64
65 if leg_id > first_leg_index:
66 logger.debug("Not returning a HypoTool for %s as this is not the first leg "
67 "with any of %s (leg signatures are %s)",
68 chain_name, tuple(jet_signature_identifiers), tuple(chain_sig_w_sub_sig))
69 raise NoHypoToolCreated("No HypoTool created for %s" % chain_name)
70
71 logger.debug("Returning a HypoTool for %s as this is the first leg with any of %s (leg signatures are %s)",
72 chain_name, tuple(jet_signature_identifiers), tuple(chain_dict['signatures']))
73
74 hypo_tool = hypotool_from_chaindict(chain_dict, debug)
75
76 #if menu has chain in an online monitoring group, unpack the recoalg(s) and hyposcenario(s) to configure monitoring
77 if any('jetMon:online' in group for group in chain_mg):
78 cpl = chain_dict["chainParts"]
79 histFlags = []
80 for cp in cpl:
81 histFlags += [ cp['recoAlg'] ] + [ cp['hypoScenario']]
82 hypo_tool.MonTool = TrigJetHypoToolMonitoring(flags, "HLTJetHypo/"+chain_name, histFlags)
83 return hypo_tool
84
85
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.
#define min(a, b)
Definition cfImp.cxx:40

◆ trigJetTLAHypoToolFromDict()

python.TrigJetHypoToolConfig.trigJetTLAHypoToolFromDict ( flags,
chain_dict )

Definition at line 86 of file TrigJetHypoToolConfig.py.

86def trigJetTLAHypoToolFromDict(flags, chain_dict):
87 return CompFactory.TrigJetTLAHypoTool(chain_dict['chainName'])
88

Variable Documentation

◆ debug

str python.TrigJetHypoToolConfig.debug = 'JETHYPODEBUG' in os.environ

Definition at line 14 of file TrigJetHypoToolConfig.py.

◆ logger

python.TrigJetHypoToolConfig.logger = logging.getLogger(__name__)

Definition at line 10 of file TrigJetHypoToolConfig.py.