3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
8 kwargs.setdefault(
"SGKey_electrons", flags.Egamma.Keys.Output.Electrons)
9 kwargs.setdefault(
"SGKey_photons", flags.Egamma.Keys.Output.Photons)
10 acc.setPrivateTools(CompFactory.DerivationFramework.CaloCellDecorator(**kwargs))
11 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
19 electronKey = kwargs.setdefault(
"SGKey_electrons", flags.Egamma.Keys.Output.Electrons)
20 baseDecorations =[
"maxEcell_time",
"maxEcell_energy",
"maxEcell_gain",
21 "maxEcell_onlId",
"maxEcell_x",
"maxEcell_y",
"maxEcell_z"]
22 electronDecorations = [electronKey +
"." + decor
for decor
in baseDecorations]
23 kwargs.setdefault(
"SGKey_egammaClusters",
"")
24 if kwargs[
"SGKey_egammaClusters"] !=
'':
25 electronDecorations += [electronKey +
"." +
"dR"]
28 kwargs.setdefault(
"SGKey_electrons_decorations", electronDecorations)
29 kwargs.setdefault(
"SGKey_photons", flags.Egamma.Keys.Output.Photons)
30 acc.setPrivateTools(CompFactory.DerivationFramework.MaxCellDecorator(name, **kwargs))
31 from LArCabling.LArCablingConfig
import LArOnOffIdMappingCfg
39 decorationPattern = kwargs.pop(
"decoration_pattern",
"{}_Lr{}_{}G")
40 kwargs.setdefault(
"gain_names", { 0 :
"Hi", 1 :
"Med", 2 :
"Low" })
41 kwargs.setdefault(
"layers", [0, 1, 2, 3])
43 for x, gain
in kwargs[
"gain_names"].
items():
44 for layer
in kwargs[
"layers"]:
45 decorNames += [decorationPattern.format(
"E", layer, gain)]
46 decorNames += [decorationPattern.format(
"rnoW", layer, gain)]
47 decorNames += [decorationPattern.format(
"nCells", layer, gain)]
48 electronKey = kwargs.setdefault(
"SGKey_electrons", flags.Egamma.Keys.Output.Electrons)
49 kwargs.setdefault(
"SGKey_electrons_decorations", [electronKey +
"." + decor
for decor
in decorNames])
50 photonKey = kwargs.setdefault(
"SGKey_photons", flags.Egamma.Keys.Output.Photons)
51 kwargs.setdefault(
"SGKey_photons_decorations", [photonKey +
"." + decor
for decor
in decorNames])
53 kwargs.setdefault(
"name",
"GainDecor")
54 acc.setPrivateTools(CompFactory.DerivationFramework.GainDecorator(**kwargs))
61 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
63 from TileGeoModel.TileGMConfig
import TileGMCfg
67 CompFactory.DerivationFramework.EGammaClusterCoreCellRecovery(**kwargs)
74 kwargs.setdefault(
"cells_name", flags.Egamma.Keys.Input.CaloCells)
75 kwargs.setdefault(
"fill_cluster",
True)
76 acc.setPrivateTools(CompFactory.CaloFillRectangularCluster(**kwargs))
82 electronKey = kwargs.setdefault(
"SGKey_electrons", flags.Egamma.Keys.Output.Electrons)
83 photonKey = kwargs.setdefault(
"SGKey_photons", flags.Egamma.Keys.Output.Photons)
84 kwargs.setdefault(
"SGKey_caloCells", flags.Egamma.Keys.Input.CaloCells)
85 neta = kwargs.pop(
"neta", 5)
86 nphi = kwargs.pop(
"nphi", 5)
87 kwargs.setdefault(
"layers", [ 0, 1, 2, 3 ])
88 decorBase =
"E{}x{}_Lr".
format(neta, nphi)
89 kwargs.setdefault(
"SGKey_photons_decorations", [photonKey+
"."+decorBase+
str(layer)
for layer
in kwargs[
'layers']])
90 kwargs.setdefault(
"SGKey_electrons_decorations", [electronKey+
"."+decorBase+
str(layer)
for layer
in kwargs[
'layers']])
93 toolArgs.update({
"eta_size": neta})
94 toolArgs.update({
"phi_size": nphi})
96 "CaloFillRectangularClusterTool",
100 CompFactory.DerivationFramework.ClusterEnergyPerLayerDecorator(**kwargs)
108 augmentationTools = [
112 kwargs.setdefault(
"AugmentationTools", augmentationTools)
114 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name, **kwargs))
121 augmentationTools = [
125 kwargs.setdefault(
"AugmentationTools", augmentationTools)
127 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name, **kwargs))
134 augmentationTools = [
139 cluster_sizes = (3, 7), (5, 5), (7, 11)
140 for neta, nphi
in cluster_sizes:
141 cename =
"ClusterEnergyPerLayerDecorator_%sx%s" % (neta, nphi)
142 ClusterEnergyPerLayerDecorator = acc.popToolsAndMerge(
145 augmentationTools.append(acc.addPublicTool(ClusterEnergyPerLayerDecorator))
147 kwargs.setdefault(
"AugmentationTools", augmentationTools)
149 acc.addEventAlgo(CompFactory.DerivationFramework.DerivationKernel(name, **kwargs))
155 CaloClusterThinning = CompFactory.DerivationFramework.CaloClusterThinning
156 acc.addPublicTool(CaloClusterThinning(**kwargs), primary=
True)
161 JetCaloClusterThinning = CompFactory.DerivationFramework.JetCaloClusterThinning
162 acc.addPublicTool(JetCaloClusterThinning(**kwargs), primary=
True)
171 """getGainLayerNames( tool ) -> return a list of names of the decorations added to the
172 egamma tool, given the GainDecorator tool"""
174 tool.decoration_pattern.format(info=info, layer=layer, gain=gain)
175 for info
in [
"E",
"nCells"]
176 for layer
in tool.layers
177 for gain
in tool.gain_names.values()
186 info=["E", "nCells"],
188 """getGainDecorations( acc, kernel collections=["Electrons", "Photons"] ) ->
189 Return a list with the 'ExtraContent' to be added to the decorations to save the gain
190 information per layer"""
192 if collections
is None:
193 collections = [flags.Egamma.Keys.Output.Electrons, flags.Egamma.Keys.Output.Photons]
195 GainDecoratorTool =
None
196 for tool
in acc.getEventAlgo(kernel).AugmentationTools:
197 if tool.getType() ==
"DerivationFramework::GainDecorator":
198 GainDecoratorTool = tool
200 if GainDecoratorTool:
202 "{part}.{info}".
format(part=part, info=info)
203 for part
in collections
211 """getClusterEnergyPerLayerDecorationsLegacy( acc, kernel ) -> return a list of names of the
212 decorations added to the egamma object, given the ClusterEnergyPerLayerDecorations
213 object (e.g. Photons.E7x11_Lr0, ...)"""
214 properties =
"SGKey_photons",
"SGKey_electrons"
215 ClusterEnergyPerLayerDecorators = []
216 for tool
in acc.getEventAlgo(kernel).AugmentationTools:
217 if tool.getType() ==
"DerivationFramework::ClusterEnergyPerLayerDecorator":
218 ClusterEnergyPerLayerDecorators.append(tool)
221 for tool
in ClusterEnergyPerLayerDecorators:
222 collections =
filter(bool, (getattr(tool, x)
for x
in properties))
223 for part
in collections:
224 key =
"SGKey_{}_decorations".
format(
str(part).lower())
225 decorations.extend(getattr(tool, key))