ATLAS Offline Software
Loading...
Searching...
No Matches
JetMatchingConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6import warnings
7
8
9def JetMatchingCfg(flags, target, source=None,
10 sources=[],
11 source_name=None,
12 floats_to_copy=[],
13 ints_to_copy=[],
14 chars_to_copy=[],
15 iparticles_to_copy=[],
16 add_suffix_with_source=True,
17 source_minimum_pt=0,
18 pt_priority_with_delta_r=-1,
19 particle_link_name=None,
20 name_suffix=''):
21
22 # handle some backward compatability stuff
23 if source is not None:
24 warnings.warn(
25 "'source' option is deprecated, use 'sources'",
26 FutureWarning,
27 stacklevel=2
28 )
29 if sources:
30 raise ValueError(
31 "Can't use 'sources' and 'source' at the same time"
32 )
33 sources = [source]
34
35 if not sources:
36 sources = [target]
37
38 if source_name is None:
39 source_name = 'Or'.join(sources)
40
41 dr_str = f'deltaRTo{source_name}'
42 deta_str = f'deltaEtaTo{source_name}'
43 dphi_str = f'deltaPhiTo{source_name}'
44 dpt_str = f'deltaPtTo{source_name}'
45 match_str = f'matchedTo{source_name}'
46 n_match_str = f'numberOfMatchesTo{source_name}'
47
48 def to(f):
49 return f + f'From{source_name}' if add_suffix_with_source else f
50
51 ca = ComponentAccumulator()
52 ca.addEventAlgo(
53 CompFactory.ftag.JetMatcherAlg(
54 f'{source_name}To{target}CopyAlg{name_suffix}',
55 targetJet=target,
56 sourceJets=sources,
57 floatsToCopy={f: to(f) for f in floats_to_copy},
58 intsToCopy={i: to(i) for i in ints_to_copy},
59 charsToCopy={c: to(c) for c in chars_to_copy},
60 iparticlesToCopy={p: to(p) for p in iparticles_to_copy},
61 dR=dr_str,
62 dEta=deta_str,
63 dPhi=dphi_str,
64 dPt=dpt_str,
65 isMatched=match_str,
66 nMatch=n_match_str,
67 ptPriorityWithDeltaR=pt_priority_with_delta_r,
68 sourceMinimumPt=source_minimum_pt,
69 particleLink=(particle_link_name or ""),
70 )
71 )
72 return ca
JetMatchingCfg(flags, target, source=None, sources=[], source_name=None, floats_to_copy=[], ints_to_copy=[], chars_to_copy=[], iparticles_to_copy=[], add_suffix_with_source=True, source_minimum_pt=0, pt_priority_with_delta_r=-1, particle_link_name=None, name_suffix='')