ATLAS Offline Software
Functions | Variables
python.DRAssociation Namespace Reference

Functions

def DRAssociation (parent, type_name, default_sgkey, default_drcut, prefix='', matched='matched', level=0, blockname=None, *args, **kw)
 

Variables

 D3PD = CompFactory.D3PD
 

Function Documentation

◆ DRAssociation()

def python.DRAssociation.DRAssociation (   parent,
  type_name,
  default_sgkey,
  default_drcut,
  prefix = '',
  matched = 'matched',
  level = 0,
  blockname = None,
args,
**  kw 
)
Helper for setting up a nearest-DR association to a contained object.

We get an source object and a collection of target objects.
We pick the target object that's closest in DR to the source object.
By default, the target collection is a DataVector from StoreGate.

parent: The parent D3PDobject or block.
type_name: The C++ type of the target object collection.
default_sgkey: Default StoreGate key for the target collection.
default_drcut: Default DR cut.  If no target objects are within
               this DR, the association will fail.
prefix: Prefix to add to the contained variables, if any.
matched: If not null, a flag variable with this name will
         be created, set to true when the association succeeds.
level: Level of detail for the block.
blockname: Name for the block.

Extra arguments are passed to the association tool.

Here's an example.  Suppose we have an electron object, and we
want to record the 4-vector of a matching jet.

Usage is something like this:

   ElectronObject = ...

   EleJetAssoc = DRAssociation (ElectronObject,
                               'JetCollection',
                               'Cone4H1TowerJets',
                               0.2,
                               'jet_',
                               level = 2,
                               blockname = 'JetMatch')
   EleJetAssoc.defineBlock (2, 'JetKinematics',
                            D3PD.FourMomFillerTool)

The DRAssociation call makes the association.  We'll look in SG
for a JetCollection called `Cone4H1TowerJets' and find the jet from
there that's closest in DR to the electron (but not farther away
than 0.2).  If the electron prefix is `el_', then we'll automatically
create the variables `el_jet_matched' and `el_jet_dr'.  The second
call then adds the jet kinematic variables: `el_jet_pt', etc.
Additional blocks can be added if desired.

Definition at line 17 of file DRAssociation.py.

17 def DRAssociation (parent,
18  type_name,
19  default_sgkey,
20  default_drcut,
21  prefix = '',
22  matched = 'matched',
23  level = 0,
24  blockname = None,
25  *args, **kw):
26  """Helper for setting up a nearest-DR association to a contained object.
27 
28  We get an source object and a collection of target objects.
29  We pick the target object that's closest in DR to the source object.
30  By default, the target collection is a DataVector from StoreGate.
31 
32  parent: The parent D3PDobject or block.
33  type_name: The C++ type of the target object collection.
34  default_sgkey: Default StoreGate key for the target collection.
35  default_drcut: Default DR cut. If no target objects are within
36  this DR, the association will fail.
37  prefix: Prefix to add to the contained variables, if any.
38  matched: If not null, a flag variable with this name will
39  be created, set to true when the association succeeds.
40  level: Level of detail for the block.
41  blockname: Name for the block.
42 
43  Extra arguments are passed to the association tool.
44 
45  Here's an example. Suppose we have an electron object, and we
46  want to record the 4-vector of a matching jet.
47 
48  Usage is something like this:
49 
50  ElectronObject = ...
51 
52  EleJetAssoc = DRAssociation (ElectronObject,
53  'JetCollection',
54  'Cone4H1TowerJets',
55  0.2,
56  'jet_',
57  level = 2,
58  blockname = 'JetMatch')
59  EleJetAssoc.defineBlock (2, 'JetKinematics',
60  D3PD.FourMomFillerTool)
61 
62  The DRAssociation call makes the association. We'll look in SG
63  for a JetCollection called `Cone4H1TowerJets' and find the jet from
64  there that's closest in DR to the electron (but not farther away
65  than 0.2). If the electron prefix is `el_', then we'll automatically
66  create the variables `el_jet_matched' and `el_jet_dr'. The second
67  call then adds the jet kinematic variables: `el_jet_pt', etc.
68  Additional blocks can be added if desired.
69 """
70  if blockname is None:
71  blockname = prefix + 'DRAssoc'
72 
73  def maker (name, prefix, object_name,
74  sgkey = default_sgkey,
75  getter = None,
76  assoc = None,
77  drcut = default_drcut):
78 
79  if not getter:
81  (name + '_Getter',
82  TypeName = type_name,
83  SGKey = sgkey)
84  if not assoc:
85  assoc = D3PD.DRAssociationTool (name + 'Assoc',
86  Getter = getter,
87  DRCut = drcut)
88 
90  Prefix = prefix,
91  Associator = assoc,
92  Matched = matched)
93 
94  obj = D3PDObject (maker, prefix)
95  parent.defineBlock (level, blockname, obj)
96  return obj

Variable Documentation

◆ D3PD

python.DRAssociation.D3PD = CompFactory.D3PD

Definition at line 14 of file DRAssociation.py.

D3PD::SGDataVectorGetterTool
Getter tool to retrieve DataVector/List collections from StoreGate.
Definition: SGDataVectorGetterTool.h:55
D3PD::ContainedAssociationFillerTool
Represent a single association by containment.
Definition: ContainedAssociationFillerTool.h:54
python.DRAssociation.DRAssociation
def DRAssociation(parent, type_name, default_sgkey, default_drcut, prefix='', matched='matched', level=0, blockname=None, *args, **kw)
Definition: DRAssociation.py:17
D3PD::DRAssociationTool
Associate to particle closest in DR.
Definition: DRAssociationTool.h:48