ATLAS Offline Software
CaloSwClusterUpdate.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 #
4 # File: CaloClusterCorrection/python/CaloSwClusterUpdate.py
5 # Created: Nov 2006, sss
6 # Purpose: Recalculate global cluster variable from layer variables.
7 #
8 # This `correction' recalculates the global cluster variables from the
9 # individual layer variables. This is mainly the eta and phi positions.
10 # The energy may also be reset to the sum of all layer energies.
11 # There are two variants: the default version, with an empty version
12 # string, recalculates the energy. The version named `dont_update_e'
13 # leaves the total cluster energy unchanged.
14 #
15 
16 from AthenaConfiguration.ComponentFactory import CompFactory
17 from CaloClusterCorrection.constants import \
18  CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
19 from CaloClusterCorrection.common import makecorr
20 
21 
22 #
23 # This table lists all available versions of this correction.
24 # See common.py for a description of the contents.
25 #
26 cls = CompFactory.CaloClusterUpdate # CaloClusterCorrection
27 from CaloClusterCorrection.constants import sw_valid_keys as keys
28 CaloSwClusterUpdate_versions = [
29  # This version doesn't recalculate the total cluster energy.
30  ['dont_update_e', cls,
31  ['CaloSwClusterUpdate.CaloSwClusterUpdate_dont_update_e_parms',
32  'caloswcorr_pool', CALOCORR_COOL], keys],
33 
34  # This version does recalculate the total cluster energy.
35  ['', cls,
36  ['CaloSwClusterUpdate.CaloSwClusterUpdate_parms',
37  'caloswcorr_pool', CALOCORR_COOL], keys],
38  ]
39 
40 
41 #
42 # Create a new tool instance.
43 # FLAGS is the configuration flags instance.
44 # NAME is the base name for this tool. If defaulted, a name will
45 # be constructed from the name of the correction, the version, and the key.
46 # If SUFFIX is not None, it will be added onto the end of the tool name.
47 # VERSION is a string specifying which of several versions of the correction
48 # to choose. If defaulted, the latest version of the correction is chosen.
49 # KEY is a string to specify the type of cluster to which the correction
50 # applies. The convention is to use `ele55' for 5x5 electron clusters,
51 # `gam35' for 3x5 photon clusters, and so on.
52 # SOURCE tells from where we should read the calibration constants.
53 # See common.py for a description of the possibilities.
54 # None means to use the default.
55 # CONFCLASS gives the Configurable class to use to create the tool.
56 # It may (and usually should) be defaulted.
57 #
58 # Additional keyword arguments may be passed to override any tool
59 # parameters/constants.
60 #
61 def make_CaloSwClusterUpdate (flags,
62  name = None,
63  suffix = None,
64  version = None,
65  key = CALOCORR_DEFAULT_KEY,
66  source = None,
67  confclass = None,
68  **kw):
69  return makecorr (flags,
70  versions = CaloSwClusterUpdate_versions,
71  name = name,
72  basename = 'larupdate',
73  suffix = suffix,
74  version = version,
75  key = key,
76  sampling = None,
77  source = source,
78  confclass = confclass,
79  corrclass = CALOCORR_SW,
80  **kw)
81 
82 
83 class CaloSwClusterUpdate_parms:
84  update_energy = True
85 
86 
87 class CaloSwClusterUpdate_dont_update_e_parms:
88  update_energy = False
89 
90