Commit 4d457f84 authored by scott snyder's avatar scott snyder
Browse files

egammaTools: ToolWithConstants work.

An issue with the cluster correction metatool is that data dependencies
don't get propagated through it.

With the transition to ToolWithConstants, the metatool is disabled.
That means that data dependencies _are_ propagated from the correction
tools to the parent.

However, egammaSwTool is creating correction tools for all possible
cluster sizes, both for regular and supercell clusters.

This means that all jobs see dependencies in the calo cells,
even trigger jobs which use only supercell clusters and don't
make the normal calo cells.

It's actaully wasteful for this tool to build correction tools for
both normal and supercell clusters, since both can't be used at the
same time.

For now, add options to configure an egammaSwTool for one or the other
cases.
parent dbc3523d
......@@ -25,20 +25,23 @@ from egammaRec.egammaRecFlags import jobproperties
import six
def configureClusterCorrections(swTool):
"Add attributes ClusterCorrectionToolsXX to egammaSwTool object"
_clusterTypes = dict(
Ele35='ele35', Ele55='ele55', Ele37='ele37',
Gam35='gam35_unconv', Gam55='gam55_unconv', Gam37='gam37_unconv',
Econv35='gam35_conv', Econv55='gam55_conv', Econv37='gam37_conv'
)
# Configure non-supercell corrections
def configureCellClusterCorrections(swTool):
"Add attributes ClusterCorrectionToolsXX to egammaSwTool object for non-supercell corrections."
from CaloClusterCorrection.CaloSwCorrections import (
make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1,
etaoff_b2, etaoff_e2, phioff_b2, phioff_e2, update,
time, listBadChannel)
from CaloRec.CaloRecMakers import _process_tools
clusterTypes = dict(
Ele35='ele35', Ele55='ele55', Ele37='ele37',
Gam35='gam35_unconv', Gam55='gam55_unconv', Gam37='gam37_unconv',
Econv35='gam35_conv', Econv55='gam55_conv', Econv37='gam37_conv'
)
for attrName, clName in six.iteritems(clusterTypes):
for attrName, clName in _clusterTypes.items():
x = 'ClusterCorrectionTools' + attrName
if not hasattr(swTool, x) or getattr(swTool, x):
continue
......@@ -49,37 +52,57 @@ def configureClusterCorrections(swTool):
cells_name=egammaKeys.caloCellKey())
setattr(swTool, x, _process_tools(swTool, y))
# Super cluster position only corrections
# Configure supercell corrections
def configureSuperCellClusterCorrections(swTool):
"Add attributes ClusterCorrectionToolsXX to egammaSwTool object for supercell corrections."
from CaloClusterCorrection.CaloSwCorrections import (
make_CaloSwCorrections, rfac, etaoff_b1, etaoff_e1,
etaoff_b2, etaoff_e2, phioff_b2, phioff_e2, update,
time, listBadChannel)
from CaloRec.CaloRecMakers import _process_tools
for attrName, clName in _clusterTypes.items():
n = 'ClusterCorrectionToolsSuperCluster' + attrName
if not hasattr(swTool, n) or getattr(swTool, n):
continue
setattr(swTool, n, _process_tools(
swTool,
make_CaloSwCorrections(
clName,
suffix='EGSuperCluster',
version=jobproperties.egammaRecFlags.clusterCorrectionVersion(),
corrlist=[
[rfac, 'v5'],
[etaoff_b1, 'v5'],
[etaoff_e1, 'v5'],
[etaoff_b2, 'v5'],
[etaoff_e2, 'v5'],
[phioff_b2, 'v5data'],
[phioff_e2, 'v5data'],
[update],
[time],
[listBadChannel]],
cells_name=egammaKeys.caloCellKey())))
def configureClusterCorrections(swTool):
"Add attributes ClusterCorrectionToolsXX to egammaSwTool object"
configureCellClusterCorrections(swTool)
if jobproperties.egammaRecFlags.doSuperclusters():
for attrName, clName in six.iteritems(clusterTypes):
n = 'ClusterCorrectionToolsSuperCluster' + attrName
if not hasattr(swTool, n) or getattr(swTool, n):
continue
setattr(swTool, n, _process_tools(
swTool,
make_CaloSwCorrections(
clName,
suffix='EGSuperCluster',
corrlist=[
[rfac, 'v5'],
[etaoff_b1, 'v5'],
[etaoff_e1, 'v5'],
[etaoff_b2, 'v5'],
[etaoff_e2, 'v5'],
[phioff_b2, 'v5data'],
[phioff_e2, 'v5data'],
[update],
[time],
[listBadChannel]],
cells_name=egammaKeys.caloCellKey())))
# End of super cluster position only corrections
configureSuperCellClusterCorrections(swTool)
egammaSwTool = ToolFactory(egammaToolsConf.egammaSwTool,
postInit=[configureClusterCorrections])
egammaSwSuperCellTool = ToolFactory(egammaToolsConf.egammaSwTool,
postInit=[configureSuperCellClusterCorrections])
EMClusterTool = ToolFactory(
egammaToolsConf.EMClusterTool,
OutputClusterContainerName=egammaKeys.outputClusterKey(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment