ATLAS Offline Software
CaloSwGap_g3.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: CaloSwGap_g3.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: L. Carminati
11 CREATED: Feb 2003
12 
13 PURPOSE: Correction for the barrel-endcap cracks
14  Tuned using 100 GeV photons
15 
16 UPDATED: 10/04/03 MW
17  bug fix to take only the cells in near cluster for gap
18  correction
19 
20 Updated: May 5, 2004 (Sven Menke)
21  base class changed from algo to tool
22 
23 Updated: 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 
40 using xAOD::CaloCluster;
41 using CLHEP::pi;
42 using CLHEP::twopi;
43 
44 namespace {
45 
46 const double deta = 0.2;
47 const double dphi = twopi / 64. ;
48 
49 }
50 
55 {
58  return StatusCode::SUCCESS;
59 }
60 
61 
63  CaloCluster* cluster) const
64 {
65  float eta = cluster->eta();
66  float phi = cluster->phi();
67 
68  float aeta = fabs(eta);
69 
70  const float etamin_crack = m_etamin_crack (myctx);
71  const float etamax_crack = m_etamax_crack (myctx);
72  if (aeta < etamin_crack || aeta > etamax_crack)
73  return; // no correction required
74 
75  const CxxUtils::Array<1> scint_weight = m_scint_weight (myctx);
77  assert (scint_weight.size() == correction.size());
78  if (correction.size() == 0) return;
79 
81 
82  double eh_scint = 0;
83  if(cc.isValid())
84  {
86  cc->beginConstCalo(CaloCell_ID::TILE);
88  cc->endConstCalo(CaloCell_ID::TILE);
89 
90  for ( ; f_cell!=l_cell; ++f_cell)
91  {
92  const CaloCell* cell = (*f_cell) ;
93 
94  int inum = cell->caloDDE()->getSampling();
95 
96  if (CaloSampling::TileGap3 == inum ) {
97  double phic = cell->phi();
98  double etac = cell->eta();
99  if (phic-phi < -pi) phic = phic + twopi;
100  if (phic-phi > pi) phic = phic - twopi;
101  if (etac >= eta-deta && etac <= eta+deta) {
102  if (phic >= phi-dphi && phic <= phi+dphi) {
103  eh_scint += cell->e();
104  }
105  }
106  }
107  }
108  }
109 
110  // make the correction
111  double granularity = (etamax_crack - etamin_crack)/correction.size();
112  int ind = static_cast<int> ((aeta - etamin_crack)/granularity);
113 
114 // Scintillator energy calibration
115  eh_scint = eh_scint * scint_weight[ind];
116 
117 //Correct for normalization factor total cluster energy and samplings energies
118  double energy = (cluster->e())*correction[ind];
119  setenergy(cluster,energy);
120 
121 // Add the scintillator energy to the cluster and correct the total energy
122  energy += eh_scint * correction[ind];
123  cluster->setE(energy);
124 }
125 
126 
133  (const std::string& name)
134 {
135  return this->setProperty (StringProperty ("cells_name", name));
136 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CaloUtils::ToolConstantsContext::ctx
const EventContext & ctx() const
Definition: ToolWithConstants.h:63
CxxUtils::Array::size
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition: CaloClusterCorrection.cxx:94
CaloCell.h
CaloSwGap_g3::m_etamax_crack
Constant< float > m_etamax_crack
Definition: CaloSwGap_g3.h:78
CaloSwGap_g3::m_etamin_crack
Constant< float > m_etamin_crack
Definition: CaloSwGap_g3.h:77
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
pi
#define pi
Definition: TileMuonFitter.cxx:65
CaloClusterCorrection::initialize
virtual StatusCode initialize() override
Initialize method.
Definition: CaloClusterCorrection.cxx:47
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
CaloSwGap_g3.h
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
CaloSwGap_g3::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition: CaloSwGap_g3.cxx:54
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloSwGap_g3::m_scint_weight
Constant< CxxUtils::Array< 1 > > m_scint_weight
Definition: CaloSwGap_g3.h:79
CxxUtils::Array< 1 >
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
twopi
constexpr double twopi
Definition: VertexPointEstimator.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CaloCellContainer.h
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCluster::eta
virtual double eta() const
Retrieve eta independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:755
CaloSwGap_g3::m_correction
Constant< CxxUtils::Array< 1 > > m_correction
Definition: CaloSwGap_g3.h:80
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
CaloSwGap_g3::m_cells_name
SG::ReadHandleKey< CaloCellContainer > m_cells_name
Property: The name of the container in which to look to find tile cells.
Definition: CaloSwGap_g3.h:84
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
CaloSwGap_g3::setCaloCellContainerName
virtual StatusCode setCaloCellContainerName(const std::string &name) override
Change the name of the CaloCellContainer used by this tool.
Definition: CaloSwGap_g3.cxx:133
CaloSwGap_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwGap_g3.cxx:62
python.handimod.cc
int cc
Definition: handimod.py:523
CaloCluster::phi
virtual double phi() const
Retrieve phi independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:759