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']
38 chain_sig_w_sub_sig = [f
'{sig}:{subsig}' for sig, subsigs
in chain_dict[
'sigDicts'].
items()
for subsig
in subsigs]
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))
46 for entry
in chain_sig_w_sub_sig:
47 if status == 0
and entry
in jet_signature_identifiers:
49 elif status == 1
and entry
not in jet_signature_identifiers:
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)))
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)))
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))
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)
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']))
77 if any(
'jetMon:online' in group
for group
in chain_mg):
78 cpl = chain_dict[
"chainParts"]
81 histFlags += [ cp[
'recoAlg'] ] + [ cp[
'hypoScenario']]