ATLAS Offline Software
egammaCaloClusterSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
9 #include <CLHEP/Units/SystemOfUnits.h>
10 
11 #include <cmath>
12 
13 using CLHEP::MeV;
14 
16  const std::string& name,
17  const IInterface* parent) :
18  base_class(type, name, parent)
19 {
20 }
21 
23 {
24  if (!m_egammaCheckEnergyDepositTool.empty()) {
26  } else {
28  }
29 
30  //Shower Shape tools
31  //Initialize tools when non-default values are given
35 
36  if (m_doHadLeak) {
37  ATH_CHECK(m_HadronicLeakageTool.retrieve());
38  } else {
39  m_HadronicLeakageTool.disable();
40  }
41 
42  return StatusCode::SUCCESS;
43 }
44 
46 {
47  return StatusCode::SUCCESS;
48 }
49 
51  const xAOD::CaloCluster* cluster, const CaloDetDescrManager& cmgr) const {
52 
53  // Minimum Cluster energy
54  if (cluster->et() < m_ClusterEtCut) {
55  ATH_MSG_DEBUG("Cluster failed Energy Cut: dont make ROI");
56  return false;
57  }
58 
59  // Accept all clusters in the FCAL
60  if (xAOD::EgammaHelpers::isFCAL(cluster)){
61  return true;
62  }
63 
64  // Sanity check to catch extreme eta values
65  const double eta2 = std::abs(cluster->etaBE(2));
66  if (eta2 > 10) {
67  return false;
68  }
69 
70  // Check energy deposit if requested
71  if (!m_egammaCheckEnergyDepositTool.empty() &&
72  !m_egammaCheckEnergyDepositTool->checkFractioninSamplingCluster(cluster)) {
73  ATH_MSG_DEBUG("Cluster failed sample check: dont make ROI");
74  return false;
75  }
76 
77  // Check second sampling is present
78  if (!cluster->hasSampling(CaloSampling::EMB2) && !cluster->hasSampling(CaloSampling::EME2)){
79  return false;
80  }
81  // minimum energy reconstructed in 2nd sampling
82  constexpr double EM2ENERGY_CUT = 50 * MeV;
83  if (cluster->energyBE(2) < EM2ENERGY_CUT){
84  return false;
85  }
86  // use the egamma definition of EMFrac
87  // (includes presampler and TileGap3/E4, helps with eff in the crack)
88  static const SG::AuxElement::ConstAccessor<float> acc("EMFraction");
89  const double emFrac = acc.isAvailable(*cluster) ? acc(*cluster) : 0.;
90  const double EMEnergy = cluster->e() * emFrac;
91  double EMEt = EMEnergy / std::cosh(eta2);
92  // cluster is in crack region
93  // if at least one clustered cell in EMB and EMEC
94  if (cluster->inBarrel() && cluster->inEndcap()) {
95  EMEt /= m_EMEtSplittingFraction; // rescale EMEt for clusters in the crack
96  }
97 
98  // EMEt cut
99  if (EMEt < m_EMEtCut) {
100  ATH_MSG_DEBUG("Cluster failed EMEt cut: don't make ROI");
101  return false;
102  }
103 
104  // EM fraction cut
105  if (emFrac < m_EMFCut) {
106  ATH_MSG_DEBUG("Cluster failed EM Fraction cut: don't make ROI");
107  return false;
108  }
109 
110  // Reta and Rhad cuts
111  if (m_doReta || m_doHadLeak) {
112  // retrieve the cell containers
114  if (m_doReta) {
116  StatusCode sc =
117  egammaMiddleShape::execute(*cluster, cmgr, *cellcoll, info, true);
118  if (sc.isFailure()) {
119  ATH_MSG_WARNING("call to Middle shape returns failure for execute");
120  return false;
121  }
122  if (info.e277<0 || info.e237<0) {
123  ATH_MSG_DEBUG("Negative e277 or e237: dont make ROI");
124  return false;
125  }
126  if (info.e277 != 0. && info.e237/info.e277 < m_RetaCut) {
127  ATH_MSG_DEBUG("Cluster failed Reta test: dont make ROI");
128  return false;
129  }
130  }
131 
132  if (m_doHadLeak) {
133  // calculate information concerning just the hadronic leakage
135  StatusCode sc = m_HadronicLeakageTool->execute(*cluster, cmgr, *cellcoll, info);
136  if ( sc.isFailure() ) {
137  ATH_MSG_WARNING("call to Iso returns failure for execute");
138  return false;
139  }
140  const double ethad1 = info.ethad1;
141  const double ethad = info.ethad;
142  const double raphad1 = EMEt != 0. ? ethad1 / EMEt : 0.;
143  const double raphad = EMEt != 0. ? ethad / EMEt : 0.;
144  if (eta2 >= 0.8 && eta2 < 1.37) {
145  if (raphad > m_HadLeakCut) {
146  ATH_MSG_DEBUG("Cluster failed Hadronic Leakage test: dont make ROI");
147  return false;
148  }
149  }
150  else if (raphad1 > m_HadLeakCut){
151  ATH_MSG_DEBUG("Cluster failed Hadronic Leakage test: dont make ROI");
152  return false;
153  }
154  }
155  }
156 
157  return true;
158 }
grepfile.info
info
Definition: grepfile.py:38
egammaCaloClusterSelector::m_HadLeakCut
Gaudi::Property< double > m_HadLeakCut
Definition: egammaCaloClusterSelector.h:91
egammaCaloClusterSelector::passSelection
bool passSelection(const xAOD::CaloCluster *cluster, const CaloDetDescrManager &cmgr) const override final
pass the selection described in the class egammaCaloClusterSelector
Definition: egammaCaloClusterSelector.cxx:50
egammaCaloClusterSelector::initialize
virtual StatusCode initialize() override final
Definition: egammaCaloClusterSelector.cxx:22
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CaloCellList.h
egammaCaloClusterSelector::m_cellsKey
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
Name of the cluster intput collection.
Definition: egammaCaloClusterSelector.h:60
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
egammaCaloClusterSelector::m_doReta
bool m_doReta
Definition: egammaCaloClusterSelector.h:95
xAOD::EgammaParameters::ethad1
@ ethad1
transverse energy in the first sampling of the hadronic calorimeters behind the cluster calculated fr...
Definition: EgammaEnums.h:42
egammaCaloClusterSelector.h
xAOD::CaloCluster_v1::et
double et() const
Definition: CaloCluster_v1.h:856
egammaCaloClusterSelector::m_ClusterEtCut
Gaudi::Property< double > m_ClusterEtCut
Definition: egammaCaloClusterSelector.h:74
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
egammaCaloClusterSelector::m_RetaCut
Gaudi::Property< double > m_RetaCut
Definition: egammaCaloClusterSelector.h:87
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
egammaCaloClusterSelector::m_EMEtCut
Gaudi::Property< double > m_EMEtCut
Definition: egammaCaloClusterSelector.h:77
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:644
xAOD::EgammaParameters::ethad
@ ethad
ET leakage into hadronic calorimeter with exclusion of energy in CaloSampling::TileGap3.
Definition: EgammaEnums.h:45
egammaCaloClusterSelector::finalize
virtual StatusCode finalize() override final
Definition: egammaCaloClusterSelector.cxx:45
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::CaloCluster_v1::inEndcap
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
Definition: CaloCluster_v1.h:901
EgammaxAODHelpers.h
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
egammaCaloClusterSelector::HAD_LEAK_DEFAULT_NO_CUT
static constexpr double HAD_LEAK_DEFAULT_NO_CUT
Definition: egammaCaloClusterSelector.h:90
CaloCluster.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::CaloCluster_v1::inBarrel
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
Definition: CaloCluster_v1.h:896
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
egammaCaloClusterSelector::m_HadronicLeakageTool
ToolHandle< IegammaIso > m_HadronicLeakageTool
Tool for hadronic leakage calculation; onlud used if cuts needing are defined.
Definition: egammaCaloClusterSelector.h:70
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
egammaCaloClusterSelector::m_EMEtSplittingFraction
Gaudi::Property< double > m_EMEtSplittingFraction
Definition: egammaCaloClusterSelector.h:80
egammaCaloClusterSelector::egammaCaloClusterSelector
egammaCaloClusterSelector(const std::string &type, const std::string &name, const IInterface *parent)
Definition: egammaCaloClusterSelector.cxx:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::EgammaHelpers::isFCAL
bool isFCAL(const xAOD::CaloCluster *cluster)
return true if the cluster (or the majority of its energy) is in the FCAL0
Definition: EgammaxAODHelpers.cxx:46
egammaCaloClusterSelector::RETA_DEFAULT_NO_CUT
static constexpr double RETA_DEFAULT_NO_CUT
Definition: egammaCaloClusterSelector.h:86
egammaMiddleShape::Info
Definition: egammaMiddleShape.h:30
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
egammaCaloClusterSelector::m_EMFCut
Gaudi::Property< double > m_EMFCut
Definition: egammaCaloClusterSelector.h:83
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::CaloCluster_v1::energyBE
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:630
IegammaIso::Info
Definition: IegammaIso.h:39
egammaCaloClusterSelector::m_doHadLeak
bool m_doHadLeak
Definition: egammaCaloClusterSelector.h:96
egammaCaloClusterSelector::m_egammaCheckEnergyDepositTool
ToolHandle< IegammaCheckEnergyDepositTool > m_egammaCheckEnergyDepositTool
Pointer to the egammaCheckEnergyDepositTool.
Definition: egammaCaloClusterSelector.h:65
xAOD::CaloCluster_v1::hasSampling
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
Definition: CaloCluster_v1.h:890
egammaMiddleShape::execute
static StatusCode execute(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &cmgr, const CaloCellContainer &cell_container, Info &info, bool doRetaOnly=false)
Definition: egammaMiddleShape.cxx:17
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56