ATLAS Offline Software
Loading...
Searching...
No Matches
LArNonLinearity.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: LArNonLinearity.cxx
8PACKAGE: offline/LArCalorimeter/LArCellRec
9
10AUTHORS: G.Unal
11CREATED: August 2003
12
13PURPOSE: non linearity if only linear calibration fit is used
14 (for EM barrel)
15
16********************************************************************/
17
18// INCLUDE LAr header files:
19#include "LArNonLinearity.h"
21
22#include "CaloEvent/CaloCell.h"
23// Units
24#include "CLHEP/Units/SystemOfUnits.h"
25
26#include <cmath>
27#include <iostream>
28
29using CLHEP::GeV;
30
31// Constants needed for computation of the Energy Scale:
32
33 const double LArNonLinearity::m_etatrans = 0.8;
34
35// index: 0 = front A, 1 = front B, 2=middble A, 3=middle B
36// 4 = back A and 5 = back B (A=eta<0.8 and B=eta>0.8)
37
38// transitions energies
39
40 const double LArNonLinearity::m_etrans[6] =
41 {6.5*GeV, 6.0*GeV, 26.0*GeV, 50.0*GeV, 17.5*GeV, 25.0*GeV };
42
43// maximum energy validity
44
45 const double LArNonLinearity::m_emax[6] =
46 {60.*GeV, 60.*GeV, 260.*GeV, 500.*GeV, 170.*GeV, 250.*GeV};
47
48// parameters of polynomial fit. These values give residuals in GeV
49 const double LArNonLinearity::m_p0[6][2] =
50 {{0.44e-2, 0.158}, {0.691e-3, 0.121}, // front
51 {0.166e-1, 0.226}, {0.347e-1, 0.753}, // middle
52 {0.869e-2, 0.269}, {0.422e-1, 0.3598}}; // back
53 const double LArNonLinearity::m_p1[6][2] =
54 {{-0.16e-2/GeV, -0.159e-1/GeV}, {+0.379e-2/GeV, -0.100e-1/GeV}, // front
55 {-0.105e-2/GeV, -0.1559e-2/GeV}, {-0.605e-2/GeV, -0.452e-2/GeV}, // middle
56 {+0.248e-2/GeV, -0.252e-2/GeV}, {-0.690e-2/GeV, -0.881e-2/GeV}}; // back
57 const double LArNonLinearity::m_p2[6][2] =
58 {{-0.45e-3/(GeV*GeV),+0.406e-3/(GeV*GeV)},
59 {-0.252e-2/(GeV*GeV), +0.159e-3/(GeV*GeV)}, // front
60 {-0.208e-3/(GeV*GeV),-0.263e-4/(GeV*GeV)},
61 {-0.66e-3/(GeV*GeV), -0.146e-4/(GeV*GeV)}, // middle
62 {-0.920e-3/(GeV*GeV),-0.645e-4/(GeV*GeV)},
63 {+0.689e-4/(GeV*GeV), +0.4773e-4/(GeV*GeV)}}; // back
64 const double LArNonLinearity::m_p3[6][2] =
65 {{0.1037e-3/(GeV*GeV*GeV), -0.291e-5/(GeV*GeV*GeV)},
66 {+0.332e-3/(GeV*GeV*GeV), -0.309e-7/(GeV*GeV*GeV)}, // front
67 {+0.100e-4/(GeV*GeV*GeV), +0.1300e-6/(GeV*GeV*GeV)},
68 {+0.115e-4/(GeV*GeV*GeV), +0.545e-7/(GeV*GeV*GeV)}, // middle
69 {0.472e-4/(GeV*GeV*GeV), 0.459e-6/(GeV*GeV*GeV)},
70 {0.759e-5/(GeV*GeV*GeV), -0.543e-7/(GeV*GeV*GeV)}}; // back
71
72// Constructor:
73
74LArNonLinearity::LArNonLinearity(const std::string& type, const std::string& name,
75 const IInterface* parent)
76 : CaloCellCorrection(type, name, parent),m_emID(nullptr),m_hecID(nullptr),m_fcalID(nullptr)
77
78{
79
80}
81
82
84{
85 ATH_MSG_INFO( name() );
86 ATH_MSG_INFO( " Initialize LArNonLinearity " );
87
88 // pointer to identifier helpers:
89 ATH_CHECK(detStore()->retrieve(m_emID,"LArEM_ID"));
90 ATH_CHECK(detStore()->retrieve(m_hecID,"HEC_ID"));
91 ATH_CHECK(detStore()->retrieve(m_fcalID,"FCAL_ID"));
92
93 return StatusCode::SUCCESS;
94}
95
96// Desctructor
97
99= default;
100
101// MakeCorrection: This is called with a pointer to the Cell Object.
102
104 const EventContext& /*ctx*/) const
105{
106 float eta = theCell->eta();
107 Identifier id = theCell->ID();
108
109 double corr=0. ; // corr=residual to subtract to
110 // true energy
111 double energy = theCell->energy();
112
113 if(m_emID->is_lar_em(id) &&
114 m_emID->is_em_barrel(id) ) // only for barrel EM Calorimeter:
115 {
116
117 int sampling = m_emID->sampling(id);
118 if (sampling >0 && sampling < 4) // nothing for barrel PS
119 {
120
121// check A or B electrodes
122 int ielec;
123 if (fabs(eta)<m_etatrans) {ielec=0;}
124 else {ielec=1;}
125 int index =ielec + 2*(sampling-1); // from 0 to 5 (see above)
126
127 if (energy>2.*GeV)
128 ATH_MSG_DEBUG( " energy " << energy
129 << " sampling " << sampling
130 << " eta " << eta
131 << " index " << index );
132
133// check E less than E maximum validity
134
135 if (energy < m_emax[index] )
136 {
137// energy range (high gain or middle gain)
138 int irange;
139 if (energy < m_etrans[index] ) {irange=0;}
140 else {irange=1;}
141
142 if (irange==0)
143 { // ignore offset for high gain
144 corr = m_p1[index][irange] *energy
145 +m_p2[index][irange] *energy*energy
146 +m_p3[index][irange] *energy*energy*energy;
147 } else
148 {
149 corr = m_p0[index][irange]
150 +m_p1[index][irange] *energy
151 +m_p2[index][irange] *energy*energy
152 +m_p3[index][irange] *energy*energy*energy;
153 }
154// convert corr back to GEV
155 corr = corr*GeV;
156
157 if (energy>2.*GeV)
158 {
159 ATH_MSG_DEBUG( " pol coeff " << m_p0[index][irange] << " "
160 << m_p1[index][irange] << " " << m_p2[index][irange] << " "
161 << m_p3[index][irange] );
162 ATH_MSG_DEBUG( "energy,index,corr = " << energy << " " << index << " " << corr );
163 }
164
165 }
166 }
167 } // ENDIF for barrel EM
168
169
170// Correct cell energy
171
172 setenergy(theCell, energy-corr);
173
174}
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
static void setenergy(CaloCell *lar_cell, float energy)
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
double energy() const
get energy (data member)
Definition CaloCell.h:327
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition CaloCell.h:295
static const double m_emax[6]
const LArEM_ID * m_emID
static const double m_etrans[6]
static const double m_p3[6][2]
virtual StatusCode initialize() override
LArNonLinearity(const std::string &type, const std::string &name, const IInterface *parent)
virtual ~LArNonLinearity()
static const double m_etatrans
static const double m_p2[6][2]
static const double m_p0[6][2]
virtual void MakeCorrection(CaloCell *theCell, const EventContext &ctx) const override
static const double m_p1[6][2]
const LArFCAL_ID * m_fcalID
const LArHEC_ID * m_hecID
Definition index.py:1