ATLAS Offline Software
egammaDeltaEmax2Alg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
12 #include "egammaDeltaEmax2Alg.h"
15 #include <cmath>
16 
17 
18 namespace D3PD {
19 
20 
22  ISvcLocator* svcloc)
23  : AthAlgorithm (name, svcloc),
24  m_getter (this)
25 {
26  declareProperty ("AuxPrefix", m_auxPrefix,
27  "Prefix to add to aux data items.");
28  declareProperty ("Getter", m_getter,
29  "Getter instance for the input egamma objects.");
30  declareProperty ("AllowMissing", m_allowMissing = false,
31  "If true, don't complain if input objects are missing.");
32  declareProperty ("HighLum", m_highLum = false,
33  "True if we should use the high-lum definition "
34  "of deltaEmax2.");
35 }
36 
37 
42 {
44  CHECK( m_getter.retrieve() );
45  CHECK( m_getter->configureD3PD<xAOD::Egamma>() );
46  return StatusCode::SUCCESS;
47 }
48 
49 
54 {
55  xAOD::Egamma::Decorator<float> deltaemax2 (m_auxPrefix + "deltaEmax2");
56 
57  CHECK( m_getter->reset (m_allowMissing) );
58  while (const xAOD::Egamma* g = m_getter->next<xAOD::Egamma>())
59  {
60  deltaemax2(*g) = -999;
61  const xAOD::CaloCluster* cluster = g->caloCluster();
62  if (cluster) {
63  double eta2 = std::fabs(cluster->etaBE(2));
64  // Protect against soft E topo clusters that don't have samp info.
65  if (eta2 > 900)
66  eta2 = std::fabs(cluster->eta());
67  double et = cluster->e()/std::cosh(eta2);
68  float emax2 = 0;
69  emax2 = g->showerShapeValue (xAOD::EgammaParameters::e2tsts1);
70 
71  if (m_highLum)
72  deltaemax2(*g) = emax2/(1000.+0.0049*et);
73  else
74  deltaemax2(*g) = emax2/(1000.+0.009*et);
75  }
76 
77  m_getter->releaseElement (g);
78  }
79 
80  return StatusCode::SUCCESS;
81 }
82 
83 
84 } // namespace D3PD
D3PD::egammaDeltaEmax2Alg::egammaDeltaEmax2Alg
egammaDeltaEmax2Alg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
Definition: egammaDeltaEmax2Alg.cxx:21
et
Extra patterns decribing particle interation process.
D3PD::egammaDeltaEmax2Alg::m_getter
ToolHandle< ICollectionGetterTool > m_getter
Property: Getter for input photon objects.
Definition: egammaDeltaEmax2Alg.h:55
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
D3PD::egammaDeltaEmax2Alg::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition: egammaDeltaEmax2Alg.cxx:41
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
initialize
void initialize()
Definition: run_EoverP.cxx:894
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
D3PD::egammaDeltaEmax2Alg::m_auxPrefix
std::string m_auxPrefix
Property: Prefix to add to aux data items.
Definition: egammaDeltaEmax2Alg.h:52
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::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
CaloCluster.h
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
D3PD::egammaDeltaEmax2Alg::m_allowMissing
bool m_allowMissing
Property: If true, don't complain if input objects are missing.
Definition: egammaDeltaEmax2Alg.h:58
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
egammaDeltaEmax2Alg.h
AthAlgorithm
Definition: AthAlgorithm.h:47
D3PD::egammaDeltaEmax2Alg::execute
virtual StatusCode execute() override
Standard Gaudi execute method.
Definition: egammaDeltaEmax2Alg.cxx:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::egammaDeltaEmax2Alg::m_highLum
bool m_highLum
Property: True if we should use the high-lum definition of deltaEmax2.
Definition: egammaDeltaEmax2Alg.h:61
xAOD::EgammaParameters::e2tsts1
@ e2tsts1
energy of the cell corresponding to second energy maximum in the first sampling
Definition: EgammaEnums.h:108
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265