ATLAS Offline Software
Loading...
Searching...
No Matches
egammaDeltaEmax2Alg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
10
11
12#include "egammaDeltaEmax2Alg.h"
15#include <cmath>
16
17
18namespace 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{
43 CHECK( AthAlgorithm::initialize() );
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
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_auxPrefix
Property: Prefix to add to aux data items.
ToolHandle< ICollectionGetterTool > m_getter
Property: Getter for input photon objects.
bool m_allowMissing
Property: If true, don't complain if input objects are missing.
virtual StatusCode execute() override
Standard Gaudi execute method.
egammaDeltaEmax2Alg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
bool m_highLum
Property: True if we should use the high-lum definition of deltaEmax2.
virtual StatusCode initialize() override
Standard Gaudi initialize method.
SG::Decorator< T, ALLOC > Decorator
class to provide type-safe access to aux data.
Definition AuxElement.h:135
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Block filler tool for noisy FEB information.
@ e2tsts1
energy of the cell corresponding to second energy maximum in the first sampling
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
Extra patterns decribing particle interation process.