ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DerivationFramework::PhotonsDirectionTool Class Reference

#include <PhotonsDirectionTool.h>

Inheritance diagram for DerivationFramework::PhotonsDirectionTool:
Collaboration diagram for DerivationFramework::PhotonsDirectionTool:

Public Member Functions

 PhotonsDirectionTool (const std::string &t, const std::string &n, const IInterface *p)
 
virtual StatusCode initialize () override final
 
virtual StatusCode addBranches () const override final
 

Private Attributes

SG::ReadHandleKey< xAOD::PhotonContainerm_collName
 
SG::WriteHandleKey< std::vector< float > > m_sgEta
 
SG::WriteHandleKey< std::vector< float > > m_sgPhi
 
SG::WriteHandleKey< std::vector< float > > m_sgEt
 
SG::WriteHandleKey< std::vector< float > > m_sgE
 
bool m_doEta = false
 
bool m_doPhi = false
 
bool m_doEt = false
 
bool m_doE = false
 

Detailed Description

Definition at line 21 of file PhotonsDirectionTool.h.

Constructor & Destructor Documentation

◆ PhotonsDirectionTool()

DerivationFramework::PhotonsDirectionTool::PhotonsDirectionTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 19 of file PhotonsDirectionTool.cxx.

22  : base_class(t, n, p)
23 {
24 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::PhotonsDirectionTool::addBranches ( ) const
finaloverridevirtual

Definition at line 48 of file PhotonsDirectionTool.cxx.

49 {
50  const EventContext& ctx = Gaudi::Hive::currentContext();
51  // Retrieve photon container
53  // define the pointers to vectors which will hold the additional payloads
54  auto recEta = std::make_unique<std::vector<float>>();
55  auto recPhi = std::make_unique<std::vector<float>>();
56  auto recEt = std::make_unique<std::vector<float>>();
57  auto recE = std::make_unique<std::vector<float>>();
58 
59  // Loop over electrons and fill the vectors
60  for (const xAOD::Photon* ph : *photons) {
61  // Prepare variables
62  float eta(0.0), phi(0.0), e(0.0), et(0.0);
63 
64  if (ph->nCaloClusters() > 0) {
65  const xAOD::CaloCluster* gCluster = ph->caloCluster(0);
66  eta = gCluster->etaBE(2);
67  phi = gCluster->phi();
68  e = gCluster->e();
69  et = e / cosh(eta);
70  } else {
72  "Couldn't retrieve photon cluster, will use photon 4-momentum");
73  eta = ph->eta();
74  phi = ph->phi();
75  e = ph->e();
76  et = ph->pt();
77  }
78  recEta->push_back(eta);
79  recPhi->push_back(phi);
80  recEt->push_back(et);
81  recE->push_back(e);
82  } // end of loop over photons
83 
84  // Write payload to StoreGate for downstream client access
85  if (m_doEta) {
87  ATH_CHECK(etas.record(std::move(recEta)));
88  }
89  if (m_doPhi) {
91  ATH_CHECK(phis.record(std::move(recPhi)));
92  }
93  if (m_doEt) {
95  ATH_CHECK(ets.record(std::move(recEt)));
96  }
97  if (m_doE) {
99  ATH_CHECK(es.record(std::move(recE)));
100  }
101  return StatusCode::SUCCESS;
102 }

◆ initialize()

StatusCode DerivationFramework::PhotonsDirectionTool::initialize ( )
finaloverridevirtual

Definition at line 27 of file PhotonsDirectionTool.cxx.

28 {
29  ATH_CHECK(m_collName.initialize());
30 
31  m_doEta = !(m_sgEta.key().empty());
32  m_doPhi = !(m_sgPhi.key().empty());
33  m_doEt = !(m_sgEt.key().empty());
34  m_doE = !(m_sgE.key().empty());
35  if (!m_doEta && !m_doPhi && !m_doE && !m_doEt) {
36  ATH_MSG_ERROR("You are requesting the PhotonsDirectionTool but have "
37  "provided no SG names for any of the results");
38  return StatusCode::FAILURE;
39  }
44  return StatusCode::SUCCESS;
45 }

Member Data Documentation

◆ m_collName

SG::ReadHandleKey<xAOD::PhotonContainer> DerivationFramework::PhotonsDirectionTool::m_collName
private
Initial value:
{ this,
"PhotonContainer",
"Photons",
"Input Photons" }

Definition at line 33 of file PhotonsDirectionTool.h.

◆ m_doE

bool DerivationFramework::PhotonsDirectionTool::m_doE = false
private

Definition at line 61 of file PhotonsDirectionTool.h.

◆ m_doEt

bool DerivationFramework::PhotonsDirectionTool::m_doEt = false
private

Definition at line 60 of file PhotonsDirectionTool.h.

◆ m_doEta

bool DerivationFramework::PhotonsDirectionTool::m_doEta = false
private

Definition at line 58 of file PhotonsDirectionTool.h.

◆ m_doPhi

bool DerivationFramework::PhotonsDirectionTool::m_doPhi = false
private

Definition at line 59 of file PhotonsDirectionTool.h.

◆ m_sgE

SG::WriteHandleKey<std::vector<float> > DerivationFramework::PhotonsDirectionTool::m_sgE
private
Initial value:
{ this,
"ESGEntry",
"",
"output E vector" }

Definition at line 53 of file PhotonsDirectionTool.h.

◆ m_sgEt

SG::WriteHandleKey<std::vector<float> > DerivationFramework::PhotonsDirectionTool::m_sgEt
private
Initial value:
{ this,
"EtSGEntry",
"",
"output E vector" }

Definition at line 48 of file PhotonsDirectionTool.h.

◆ m_sgEta

SG::WriteHandleKey<std::vector<float> > DerivationFramework::PhotonsDirectionTool::m_sgEta
private
Initial value:
{ this,
"EtaSGEntry",
"",
"output Eta vector" }

Definition at line 38 of file PhotonsDirectionTool.h.

◆ m_sgPhi

SG::WriteHandleKey<std::vector<float> > DerivationFramework::PhotonsDirectionTool::m_sgPhi
private
Initial value:
{ this,
"PhiSGEntry",
"",
"output Phi vector" }

Definition at line 43 of file PhotonsDirectionTool.h.


The documentation for this class was generated from the following files:
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
et
Extra patterns decribing particle interation process.
DerivationFramework::PhotonsDirectionTool::m_doE
bool m_doE
Definition: PhotonsDirectionTool.h:61
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
DerivationFramework::PhotonsDirectionTool::m_sgE
SG::WriteHandleKey< std::vector< float > > m_sgE
Definition: PhotonsDirectionTool.h:53
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
DerivationFramework::PhotonsDirectionTool::m_doEt
bool m_doEt
Definition: PhotonsDirectionTool.h:60
DerivationFramework::PhotonsDirectionTool::m_sgEta
SG::WriteHandleKey< std::vector< float > > m_sgEta
Definition: PhotonsDirectionTool.h:38
DerivationFramework::PhotonsDirectionTool::m_sgEt
SG::WriteHandleKey< std::vector< float > > m_sgEt
Definition: PhotonsDirectionTool.h:48
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
DerivationFramework::PhotonsDirectionTool::m_collName
SG::ReadHandleKey< xAOD::PhotonContainer > m_collName
Definition: PhotonsDirectionTool.h:33
DerivationFramework::PhotonsDirectionTool::m_doPhi
bool m_doPhi
Definition: PhotonsDirectionTool.h:59
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:628
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:62
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::PhotonsDirectionTool::m_sgPhi
SG::WriteHandleKey< std::vector< float > > m_sgPhi
Definition: PhotonsDirectionTool.h:43
beamspotman.n
n
Definition: beamspotman.py:731
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
DerivationFramework::PhotonsDirectionTool::m_doEta
bool m_doEta
Definition: PhotonsDirectionTool.h:58
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
xAOD::Photon_v1
Definition: Photon_v1.h:37
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
EgEfficiencyCorr_testFixedInput.etas
list etas
Definition: EgEfficiencyCorr_testFixedInput.py:9