22 from DecisionHandling.TrigCompositeUtils
import isLegId, getLegIndexInt
23 chain_name = chain_dict[
'chainName']
24 chain_mg = chain_dict[
'monGroups']
25 jet_signature_identifiers = [
'Jet',
'Bjet']
39 if not any(signature
in chain_dict[
'signatures']
for signature
in jet_signature_identifiers):
40 raise Exception(
"[trigJetHypoToolFromDict] No {} in {} for chain {}. Please update this list of jet signatures.".
format(tuple(jet_signature_identifiers),tuple(chain_dict[
'signatures']),chain_name))
45 for entry
in chain_dict[
'signatures']:
46 if status == 0
and entry
in jet_signature_identifiers:
48 elif status == 1
and entry
not in jet_signature_identifiers:
50 elif status == 2
and entry
in jet_signature_identifiers:
51 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_dict[
'signatures'])))
55 if not any(signature
in chain_dict[
'signatures'][leg_id]
for signature
in jet_signature_identifiers):
56 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_dict[
'signatures'])))
60 for signature
in jet_signature_identifiers:
61 if signature
in chain_dict[
'signatures']:
62 first_leg_index =
min(first_leg_index, chain_dict[
'signatures'].
index(signature))
64 if leg_id > first_leg_index:
65 logger.debug(
"Not returning a HypoTool for %s as this is not the first leg "
66 "with any of %s (leg signatures are %s)",
67 chain_name, tuple(jet_signature_identifiers), tuple(chain_dict[
'signatures']))
68 raise NoHypoToolCreated(
"No HypoTool created for %s" % chain_name)
70 logger.debug(
"Returning a HypoTool for %s as this is the first leg with any of %s (leg signatures are %s)",
71 chain_name, tuple(jet_signature_identifiers), tuple(chain_dict[
'signatures']))
76 if any(
'jetMon:online' in group
for group
in chain_mg):
77 cpl = chain_dict[
"chainParts"]
80 histFlags += [ cp[
'recoAlg'] ] + [ cp[
'hypoScenario']]