ATLAS Offline Software
Loading...
Searching...
No Matches
DecoratePhotonPointingAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
12
14 ISvcLocator* svcLoc)
15 : EL::AnaAlgorithm(name, svcLoc) {}
16
18 ATH_CHECK(m_photonContainerKey.initialize());
19 ATH_CHECK(m_eventInKey.initialize());
20
21 ATH_CHECK(m_pointingTool.retrieve());
22 ATH_CHECK(m_photonVtxTool.retrieve());
23
24 std::string baseName = m_photonContainerKey.key();
25
27 m_zCommon = baseName + "." + m_zCommonDecorName;
28 m_zCommonError = baseName + "." + m_zCommonErrorDecorName;
29
30 ATH_CHECK(m_caloPointingZ.initialize());
31 ATH_CHECK(m_zCommon.initialize());
32 ATH_CHECK(m_zCommonError.initialize());
33
34 return StatusCode::SUCCESS;
35}
36
38
39 const EventContext& ctx = Gaudi::Hive::currentContext();
40
42 if (!egammas.isValid()) {
43 ATH_MSG_ERROR("Invalid egamma container from " << m_photonContainerKey.key());
44 return StatusCode::FAILURE;
45 }
47 ATH_CHECK(eventInfo.isValid());
48
52
53 ATH_CHECK(m_pointingTool->updatePointingAuxdata(*egammas));
54 ATH_CHECK(m_photonVtxTool->decorateInputs(*egammas));
55
56 for(const xAOD::Egamma* photon : *egammas){
57 std::pair<float, float> caloPointing = m_pointingTool->getCaloPointing(photon);
58
59 caloPointingZDec(*photon) = caloPointing.first;
60
62 photons_selected.push_back(photon);
63 std::pair<float, float> zCommon = xAOD::PVHelpers::getZCommonAndError(&(*eventInfo), photons_selected.asDataVector(), 2e3);
64 zCommonDec(*photon) = zCommon.first;
65 zCommonErrorDec(*photon) = zCommon.second;
66 }
67
68 return StatusCode::SUCCESS;
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
DataVector adapter that acts like it holds const pointers.
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
virtual StatusCode initialize() override
SG::ReadHandleKey< xAOD::EgammaContainer > m_photonContainerKey
Gaudi::Property< std::string > m_zCommonDecorName
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_zCommonError
ToolHandle< CP::IPhotonPointingTool > m_pointingTool
SG::ReadHandleKey< xAOD::EventInfo > m_eventInKey
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_zCommon
ToolHandle< CP::IPhotonVertexSelectionTool > m_photonVtxTool
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_caloPointingZ
Gaudi::Property< std::string > m_caloPointingZDecorName
DecoratePhotonPointingAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Gaudi::Property< std::string > m_zCommonErrorDecorName
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
std::pair< float, float > getZCommonAndError(const xAOD::EventInfo *eventInfo, const xAOD::EgammaContainer *egammas, float convPtCut=2e3)
Return zCommon and zCommonError.
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17