ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
EventShapes
EventShapeTools
python
EventDensityConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaConfiguration.ComponentFactory
import
CompFactory
4
5
def
getEventShapeName
( defOrLabel, nameprefix="", suffix=None, radius=0.4):
6
""" Get the name of the event shape container for a given jet def or jet constit def.
7
8
It's typically like "Kt4EMPFlowEventShape"
9
But there can be many variations :
10
- nameprefix can be "HLT_"
11
- suffix can be EMPFlowPUSB for pu side-band
12
13
We normalize all variations here.
14
"""
15
16
from
JetRecConfig.JetDefinition
import
JetDefinition,JetInputConstit
17
tail=
''
18
if
isinstance(defOrLabel, JetDefinition):
19
label = defOrLabel.inputdef.label
20
# Ignore jet definition infix
21
elif
isinstance(defOrLabel, JetInputConstit):
22
label = defOrLabel.label
23
else
:
24
label = defOrLabel.replace(
'_'
,
''
)
25
26
R = str(int(10*radius))
27
suffix = suffix
or
""
28
nameprefix = nameprefix
or
""
# just in case we are passed None
29
30
return
f
"{nameprefix}Kt{R}{label}{suffix}{tail}EventShape"
31
32
33
def
configEventDensityTool
( name, jetOrConstitdef, radius=0.4, **options ):
34
"""Returns an EventDensityTool configured with input and output names build according to the given jet (or jet constituent) definition.
35
36
jetOrConstitdef can be a JetDefinition, JetInputConstit. The input PseudoJetContainer name and output EventShape name are build
37
using helper functions shared in other parts of the config (jet, trigger, egamma,...)
38
39
It is still possible to override any properties of the tool in the optionnal additionnal arguments.
40
"""
41
from
JetRecConfig.JetRecConfig
import
getPJContName
42
43
# Set default and passed properties for the EventDensityTool
44
toolProperties = dict(
45
JetAlgorithm =
"Kt"
,
46
JetRadius = radius,
47
InputContainer = getPJContName( jetOrConstitdef),
48
AbsRapidityMin = 0.0,
49
AbsRapidityMax = 2.0,
50
AreaDefinition =
"Voronoi"
,
51
VoronoiRfact = 0.9,
52
OutputContainer =
getEventShapeName
( jetOrConstitdef) ,
53
UseFourMomArea =
True
,
54
)
55
# Override properties with user-supplied options.
56
toolProperties.update( options)
57
# Build the tool :
58
return
CompFactory.EventDensityTool(name, **toolProperties)
59
60
61
def
configEventShapeCopierAlg
( input ):
62
""" Returns an Athena alg copying EventShape objects with old key/names to objects with new key/names
63
"""
64
def
buildTool( alg):
65
from
AthenaCommon.AppMgr
import
ToolSvc
66
t= CompFactory.EventShapeCopier( input+alg+
"EvtShapeCopier"
,
67
InputEventShape=input+
"EventShape"
,
68
OutputEventShape=alg+input+
"EventShape"
,
69
EventDensityName =
"DensityForJetsR"
+ alg[-1])
70
ToolSvc +=t
71
return
t
72
return
CompFactory.EventDensityAlg(input+
"EventShapeCopierAlg"
, EventDensityTool = [ buildTool(
"Kt4"
), buildTool(
"Kt6"
) ] )
73
EventDensityConfig.getEventShapeName
getEventShapeName(defOrLabel, nameprefix="", suffix=None, radius=0.4)
Definition
EventDensityConfig.py:5
EventDensityConfig.configEventDensityTool
configEventDensityTool(name, jetOrConstitdef, radius=0.4, **options)
Definition
EventDensityConfig.py:33
EventDensityConfig.configEventShapeCopierAlg
configEventShapeCopierAlg(input)
Definition
EventDensityConfig.py:61
Generated on
for ATLAS Offline Software by
1.17.0