ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSwGap_g3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloSwGap_g3.cxx
8PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10AUTHORS: L. Carminati
11CREATED: Feb 2003
12
13PURPOSE: Correction for the barrel-endcap cracks
14 Tuned using 100 GeV photons
15
16UPDATED: 10/04/03 MW
17 bug fix to take only the cells in near cluster for gap
18 correction
19
20Updated: May 5, 2004 (Sven Menke)
21 base class changed from algo to tool
22
23Updated: June, 2004 (sss)
24 Use ToolWithConstants to get correction constants.
25********************************************************************/
26
27#include "CaloSwGap_g3.h"
28
29#include "CaloEvent/CaloCell.h"
31
32#include "GaudiKernel/StatusCode.h"
33
34
35#include "CLHEP/Units/PhysicalConstants.h"
36#include "GaudiKernel/MsgStream.h"
37#include <cmath>
38#include <iostream>
39#include <numbers>
40
42using std::numbers::pi;
43
44namespace {
45
46inline constexpr double twopi = 2*pi;
47inline constexpr double deta = 0.2;
48inline constexpr double dphi = twopi / 64. ;
49
50}
51
56{
58 ATH_CHECK( m_cells_name.initialize() );
59 return StatusCode::SUCCESS;
60}
61
62
63void CaloSwGap_g3::makeCorrection (const Context& myctx,
64 CaloCluster* cluster) const
65{
66 float eta = cluster->eta();
67 float phi = cluster->phi();
68
69 float aeta = fabs(eta);
70
71 const float etamin_crack = m_etamin_crack (myctx);
72 const float etamax_crack = m_etamax_crack (myctx);
73 if (aeta < etamin_crack || aeta > etamax_crack)
74 return; // no correction required
75
76 const CxxUtils::Array<1> scint_weight = m_scint_weight (myctx);
77 const CxxUtils::Array<1> correction = m_correction (myctx);
78 assert (scint_weight.size() == correction.size());
79 if (correction.size() == 0) return;
80
82
83 double eh_scint = 0;
84 if(cc.isValid())
85 {
87 cc->beginConstCalo(CaloCell_ID::TILE);
89 cc->endConstCalo(CaloCell_ID::TILE);
90
91 for ( ; f_cell!=l_cell; ++f_cell)
92 {
93 const CaloCell* cell = (*f_cell) ;
94
95 int inum = cell->caloDDE()->getSampling();
96
97 if (CaloSampling::TileGap3 == inum ) {
98 double phic = cell->phi();
99 double etac = cell->eta();
100 if (phic-phi < -pi) phic = phic + twopi;
101 if (phic-phi > pi) phic = phic - twopi;
102 if (etac >= eta-deta && etac <= eta+deta) {
103 if (phic >= phi-dphi && phic <= phi+dphi) {
104 eh_scint += cell->e();
105 }
106 }
107 }
108 }
109 }
110
111 // make the correction
112 double granularity = (etamax_crack - etamin_crack)/correction.size();
113 int ind = static_cast<int> ((aeta - etamin_crack)/granularity);
114
115// Scintillator energy calibration
116 eh_scint = eh_scint * scint_weight[ind];
117
118//Correct for normalization factor total cluster energy and samplings energies
119 double energy = (cluster->e())*correction[ind];
120 setenergy(cluster,energy);
121
122// Add the scintillator energy to the cluster and correct the total energy
123 energy += eh_scint * correction[ind];
124 cluster->setE(energy);
125}
126
127
132StatusCode
134 (const std::string& name)
135{
136 return this->setProperty (StringProperty ("cells_name", name));
137}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
#define pi
constexpr double twopi
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
virtual StatusCode initialize() override
Principal data class for CaloCell clusters.
virtual double e() const
Retrieve energy independent of signal state.
virtual double eta() const
Retrieve eta independent of signal state.
virtual double phi() const
Retrieve phi independent of signal state.
virtual void setE(double e)
Set energy.
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
virtual StatusCode setCaloCellContainerName(const std::string &name) override
Change the name of the CaloCellContainer used by this tool.
Constant< float > m_etamax_crack
SG::ReadHandleKey< CaloCellContainer > m_cells_name
Property: The name of the container in which to look to find tile cells.
Constant< float > m_etamin_crack
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Constant< CxxUtils::Array< 1 > > m_scint_weight
Read-only multidimensional array.
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.