ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
egamma
egammaAlgs
src
egammaAmbiguityRelinker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
egammaAmbiguityRelinker.h
"
6
7
#include "
StoreGate/ReadHandle.h
"
8
#include "
StoreGate/WriteHandle.h
"
9
10
#include "
xAODEgamma/EgammaContainer.h
"
11
#include "
xAODEgamma/Electron.h
"
12
#include "
xAODEgamma/ElectronAuxContainer.h
"
13
#include "
xAODEgamma/ElectronContainer.h
"
14
#include "
xAODEgamma/Photon.h
"
15
#include "
xAODEgamma/PhotonAuxContainer.h
"
16
#include "
xAODEgamma/PhotonContainer.h
"
17
18
#include "
egammaUtils/egAmbLinkHelper.h
"
19
20
21
egammaAmbiguityRelinker::egammaAmbiguityRelinker
(
const
std::string& name,
22
ISvcLocator* pSvcLocator)
23
:
AthReentrantAlgorithm
(name, pSvcLocator)
24
{}
25
26
StatusCode
27
egammaAmbiguityRelinker::initialize
()
28
{
29
// the data handle keys
30
ATH_CHECK
(
m_electronOutputKey
.initialize());
31
ATH_CHECK
(
m_electronInputKey
.initialize());
32
ATH_CHECK
(
m_photonOutputKey
.initialize());
33
ATH_CHECK
(
m_photonInputKey
.initialize());
34
return
StatusCode::SUCCESS;
35
}
36
37
StatusCode
38
egammaAmbiguityRelinker::execute
(
const
EventContext& ctx)
const
{
39
SG::ReadHandle<xAOD::ElectronContainer>
el_inputContainer(
m_electronInputKey
,ctx);
40
SG::WriteHandle<xAOD::ElectronContainer>
el_outputContainer(
m_electronOutputKey
,ctx);
41
SG::ReadHandle<xAOD::PhotonContainer>
ph_inputContainer(
m_photonInputKey
,ctx);
42
SG::WriteHandle<xAOD::PhotonContainer>
ph_outputContainer(
m_photonOutputKey
,ctx);
43
44
ATH_CHECK
(el_outputContainer.
record
(std::make_unique<xAOD::ElectronContainer>(),
45
std::make_unique<xAOD::ElectronAuxContainer>()));
46
47
ATH_CHECK
(ph_outputContainer.
record
(std::make_unique<xAOD::PhotonContainer>(),
48
std::make_unique<xAOD::PhotonAuxContainer>()));
49
50
51
xAOD::ElectronContainer
* electrons = el_outputContainer.
ptr
();
52
xAOD::PhotonContainer
* photons = ph_outputContainer.
ptr
();
53
electrons->reserve(el_inputContainer->size());
54
photons->
reserve
(ph_inputContainer->size());
55
56
for
(
const
xAOD::Electron
* old_el : *el_inputContainer) {
57
xAOD::Electron
* electron = electrons->push_back(std::make_unique<xAOD::Electron>());
58
*electron=*old_el;
59
}
60
61
for
(
const
xAOD::Photon
* old_ph : *ph_inputContainer) {
62
xAOD::Photon
* photon = photons->
push_back
(std::make_unique<xAOD::Photon>());
63
*photon=*old_ph;
64
}
65
66
// Recompute ambiguity links
67
egAmbLinkHelper::doAmbiguityLinks
(ctx, electrons, photons);
68
egAmbLinkHelper::doAmbiguityLinks
(ctx, photons, electrons);
69
70
return
StatusCode::SUCCESS;
71
}
72
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
EgammaContainer.h
ElectronAuxContainer.h
ElectronContainer.h
Electron.h
PhotonContainer.h
Photon.h
PhotonAuxContainer.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
egammaAmbiguityRelinker::initialize
StatusCode initialize() override final
Definition
egammaAmbiguityRelinker.cxx:27
egammaAmbiguityRelinker::m_electronInputKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronInputKey
Name of the electron input collection.
Definition
egammaAmbiguityRelinker.h:54
egammaAmbiguityRelinker::m_photonInputKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonInputKey
Name of the photon input collection.
Definition
egammaAmbiguityRelinker.h:64
egammaAmbiguityRelinker::egammaAmbiguityRelinker
egammaAmbiguityRelinker(const std::string &name, ISvcLocator *pSvcLocator)
Definition
egammaAmbiguityRelinker.cxx:21
egammaAmbiguityRelinker::m_photonOutputKey
SG::WriteHandleKey< xAOD::PhotonContainer > m_photonOutputKey
Name of the photon output collection.
Definition
egammaAmbiguityRelinker.h:59
egammaAmbiguityRelinker::execute
StatusCode execute(const EventContext &ctx) const override final
Definition
egammaAmbiguityRelinker.cxx:38
egammaAmbiguityRelinker::m_electronOutputKey
SG::WriteHandleKey< xAOD::ElectronContainer > m_electronOutputKey
Name of the electron output collection.
Definition
egammaAmbiguityRelinker.h:49
egAmbLinkHelper.h
egammaAmbiguityRelinker.h
egAmbLinkHelper::doAmbiguityLinks
void doAmbiguityLinks(const EventContext &ctx, DataVector< SrcT > *srcContainer, DataVector< DestT > *destContainer)
Definition
egAmbLinkHelper.h:15
xAOD::PhotonContainer
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h:17
xAOD::ElectronContainer
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h:17
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
Generated on
for ATLAS Offline Software by
1.17.0