ATLAS Offline Software
CaloSwGap.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/CaloSwGap.py
5 # Created: Nov 2006, sss
6 # Purpose: Steering module for gap correction.
7 #
8 # This module is used to set up the gap correction.
9 #
10 # In the gap, the energy is corrected using a weighted sum of the calorimeter
11 # and scintillator energies. In later versions, an energy offset is added
12 # as well. These constants are all eta-dependent.
13 #
14 # The entry point for this module is make_CaloSwGap, which
15 # returns a new correction tool. The available versions are given
16 # in the table below.
17 #
18 
19 
20 from AthenaConfiguration.ComponentFactory import CompFactory
21 from CaloClusterCorrection.constants import \
22  CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
23 from CaloClusterCorrection.common import makecorr
24 
25 #
26 # This table lists all available versions of this correction.
27 # See common.py for a description of the contents.
28 #
29 from CaloClusterCorrection.constants import sw_valid_keys as keys
30 cls_g3 = CompFactory.CaloSwGap_g3 # CaloClusterCorrection
31 cls_v2 = CompFactory.CaloSwGap_v2 # CaloClusterCorrection
32 cls_v3 = CompFactory.CaloSwGap_v3 # CaloClusterCorrection
33 CaloSwGap_versions = [
34  # The original G3-based gap correction, translated from the
35  # original fortran version.
36  ['g3', cls_g3, ['CaloSwGap_g3.CaloSwGap_g3_parms',
37  'caloswcorr_pool', CALOCORR_COOL], keys],
38 
39  # From sss. DC2 simulation, 8.6.0 reconstruction.
40  # Done only for 5x5 electrons, using 50, 100, 200 GeV electrons.
41  # In LArClusterRec-02-05-27, 9.4.0.
42  ['v2', cls_v2, ['CaloSwGap_v2.CaloSwGap_v2_parms',
43  'caloswcorr_pool', CALOCORR_COOL], keys],
44 
45  # From SP. 11.0.41 simulation, 12.0.0 reconstruction.
46  # No separate photon correction.
47  # In CaloClusterCorrection-00-02-38, 12.0.0.
48  # This was used for the `DC3-02' corrections.
49  ['v3', cls_v2, ['CaloSwGap_v3.CaloSwGap_v3_parms',
50  'caloswcorr_pool', CALOCORR_COOL], keys],
51 
52  # From SP. 11.0.42 simulation, 12.0.2 reconstruction.
53  # Separate electron and photon corrections.
54  # In CaloClusterCorrection-00-02-59, 12.0.3.
55  ['v3_1', cls_v2, ['CaloSwGap_v3.CaloSwGap_v3_1_parms',
56  'caloswcorr_pool', CALOCORR_COOL], keys],
57 
58  # In CaloClusterCorrection-00-02-61, 12.0.4.
59  ['v4', cls_v2, ['CaloSwGap_v4.CaloSwGap_v4_parms',
60  'caloswcorr_pool', CALOCORR_COOL], keys],
61 
62  # From SP. 12.0.3 simulation and reconstruction,
63  # with ideal (calib0) geometry.
64  # From SL. corrections from rel17 - no phi binning
65  ['v5', cls_v3, ['CaloSwGap_v5.CaloSwGap_v5_parms',
66  'caloswcorr_pool', CALOCORR_COOL], keys],
67 
68  # From SL. corrections from rel17 - with phi binning
69  ['v6', cls_v3, ['CaloSwGap_v6.CaloSwGap_v6_parms',
70  'caloswcorr_pool', CALOCORR_COOL], keys],
71  ]
72 
73 
74 
75 
76 #
77 # Create a new tool instance.
78 # FLAGS is the configuration flags instance.
79 # NAME is the base name for this tool. If defaulted, a name will
80 # be constructed from the name of the correction, the version, and the key.
81 # If SUFFIX is not None, it will be added onto the end of the tool name.
82 # VERSION is a string specifying which of several versions of the correction
83 # to choose. If defaulted, the latest version of the correction is chosen.
84 # KEY is a string to specify the type of cluster to which the correction
85 # applies. The convention is to use `ele55' for 5x5 electron clusters,
86 # `gam35' for 3x5 photon clusters, and so on.
87 # SOURCE tells from where we should read the calibration constants.
88 # See common.py for a description of the possibilities.
89 # None means to use the default.
90 # CONFCLASS gives the Configurable class to use to create the tool.
91 # It may (and usually should) be defaulted.
92 #
93 # The following arguments set tool parameters:
94 # CELLS_NAME specifies the SG key to use to find the scintillator cells.
95 #
96 # Additional keyword arguments may be passed to override any tool
97 # parameters/constants.
98 #
99 def make_CaloSwGap (flags,
100  name = None,
101  suffix = None,
102  version = None,
103  key = CALOCORR_DEFAULT_KEY,
104  source = None,
105  confclass = None,
106  cells_name = None,
107  **kw):
108 
109  if cells_name is not None:
110  kw['cells_name'] = cells_name
111 
112  # Make the tool.
113  return makecorr (flags,
114  versions = CaloSwGap_versions,
115  name = name,
116  basename = 'gap',
117  suffix = suffix,
118  version = version,
119  key = key,
120  sampling = None,
121  source = source,
122  confclass = confclass,
123  corrclass = CALOCORR_SW,
124  **kw)