ATLAS Offline Software
CaloSwPhimod.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/CaloSwPhimod.py
5 # Created: Nov 2006, sss
6 # Purpose: Steering module for phi modulation corrections.
7 #
8 # The response of the calorimeter varies slightly depending on the
9 # position of the particle impact in phi relative to the accordion
10 # absorber structure. This correction attempts to remove this variation.
11 #
12 # Note, however, that the inherent uncertainties in energy and phi
13 # measurement --- including the phi smearing due to bremsstrahlung
14 # and the 1/\sqrt{E} behavior of the energy resolution --- will tend
15 # to smear this effect out, especially for lower energies. We can only
16 # correct for the portion that's visible after the smearing.
17 #
18 # The correction is derived in the following way.
19 # First the calorimeter is binned in eta, to separate regions of the
20 # calorimeter that have different energy response behaviors.
21 # In each of these bins, for each particle, we take the measured phi
22 # position and convert it to an offset within the absorber structure,
23 # phi_cell. (This is done by taking the modulus with respect to the phi size
24 # of the absorbers, which is 2pi/1024 in the barrel and 2pi/768
25 # in the endcap, corresponding to four and three absorbers per cell,
26 # respectively.) If eta is negative, the sign of phi is flipped.
27 # We then plot R = E_meas/E_true versus phi_cell.
28 # This plot is binned in phi_cell. In each of these bins, we project
29 # the R values to a 1-d histogram and fit a Gaussian. The range for
30 # this fit is either 0.8 or 0.9 to 1.0, depending on the |eta| position.
31 # Finally, the mean from this fit and its uncertainty are plotted versus
32 # phi)cell to produce the phi-modulation plot.
33 #
34 # These plots are then fit with this functional form:
35 #
36 # 1 + A[alpha cos(N phi+C) + (1-alpha)cos(2N phi+D)],
37 #
38 # where alpha = atan B/pi + 1/2, and N is the total number of
39 # absorbers in 2pi (either 1024 or 768, depending on |eta|).
40 #
41 
42 
43 from AthenaConfiguration.ComponentFactory import CompFactory
44 from CaloClusterCorrection.constants import \
45  CALOCORR_COOL, CALOCORR_DEFAULT_KEY, CALOCORR_SW
46 from CaloClusterCorrection.common import makecorr
47 
48 #
49 # This table lists all available versions of this correction.
50 # See common.py for a description of the contents.
51 #
52 from CaloClusterCorrection.constants import sw_valid_keys as keys
53 cls_g3 = CompFactory.CaloSwPhimod_g3 # CaloClusterCorrection
54 cls_v2 = CompFactory.CaloSwPhimod_v2 # CaloClusterCorrection
55 CaloSwPhimod_versions = [
56 
57  # The original G3-based correction, translated from the
58  # original fortran version.
59  ['g3', cls_g3, ['CaloSwPhimod_g3.CaloSwPhimod_g3_parms',
60  'caloswcorr_pool', CALOCORR_COOL], keys],
61 
62  # DC2 simulation and 8.x.0 reconstruction.
63  # Electrons at 50, 100, and 200 GeV were used.
64  # Derived for 5x5 clusters only.
65  # This was added in LArClusterRec-02-05-25, in 9.0.3.
66  # This version runs before the gross energy corrections.
67  ['v2', cls_v2, ['CaloSwPhimod_v2.CaloSwPhimod_v2_parms',
68  'caloswcorr_pool', CALOCORR_COOL], keys],
69 
70  # This is the same as v2, except that it runs after the
71  # gross energy corrections.
72  # It was added in CaloClusterCorrection-00-02-58, in 12.0.3.
73  ['v3', cls_v2, ['CaloSwPhimod_v2.CaloSwPhimod_v3_parms',
74  'caloswcorr_pool', CALOCORR_COOL], keys],
75 
76  # This was derived using 12.0.3 simulation and reconstruction,
77  # for 5x5, 3x5, and 3x7 clusters, for both electrons and photons.
78  # It was added in CaloClusterCorrection-00-02-65, in 12.0.4.
79  ['v4', cls_v2, ['CaloSwPhimod_v4.CaloSwPhimod_v4_parms',
80  'caloswcorr_pool', CALOCORR_COOL], keys],
81 
82  # Same as v4, but with the signs of the phase terms flipped in the barrel.
83  # This because the orientation of the accordions is backwards in the MC.
84  ['v4data', cls_v2, ['CaloSwPhimod_v4data.CaloSwPhimod_v4data_parms',
85  'caloswcorr_pool', CALOCORR_COOL], keys],
86  ]
87 
88 
89 #
90 # Create a new tool instance.
91 # FLAGS is the configuration flags instance.
92 # NAME is the base name for this tool. If defaulted, a name will
93 # be constructed from the name of the correction, the version, and the key.
94 # If SUFFIX is not None, it will be added onto the end of the tool name.
95 # VERSION is a string specifying which of several versions of the correction
96 # to choose. If defaulted, the latest version of the correction is chosen.
97 # KEY is a string to specify the type of cluster to which the correction
98 # applies. The convention is to use `ele55' for 5x5 electron clusters,
99 # `gam35' for 3x5 photon clusters, and so on.
100 # SOURCE tells from where we should read the calibration constants.
101 # See common.py for a description of the possibilities.
102 # None means to use the default.
103 # CONFCLASS gives the Configurable class to use to create the tool.
104 # It may (and usually should) be defaulted.
105 #
106 # Additional keyword arguments may be passed to override any tool
107 # parameters/constants.
108 #
109 def make_CaloSwPhimod (flags,
110  name = None,
111  suffix = None,
112  version = None,
113  key = CALOCORR_DEFAULT_KEY,
114  source = None,
115  confclass = None,
116  **kw):
117  # Make the tool.
118  return makecorr (flags,
119  versions = CaloSwPhimod_versions,
120  name = name,
121  basename = 'phimod',
122  suffix = suffix,
123  version = version,
124  key = key,
125  sampling = None,
126  source = source,
127  confclass = confclass,
128  corrclass = CALOCORR_SW,
129  **kw)
130 
CaloSwPhimod.make_CaloSwPhimod
def make_CaloSwPhimod(flags, name=None, suffix=None, version=None, key=CALOCORR_DEFAULT_KEY, source=None, confclass=None, **kw)
Definition: CaloSwPhimod.py:109