37 return StatusCode::SUCCESS;
47 return StatusCode::FAILURE;
53 return StatusCode::FAILURE;
63 std::vector< SG::ReadDecorHandle<xAOD::FlowElementContainer, float> > layerAccessors_em;
66 layerAccessors_em.emplace_back(key, ctx);
68 std::vector< SG::WriteDecorHandle<xAOD::FlowElementContainer, float> > layerDecors_em;
71 layerDecors_em.emplace_back(key, ctx);
75 std::vector< SG::ReadDecorHandle<xAOD::FlowElementContainer, float> > layerAccessors_had;
78 layerAccessors_had.emplace_back(key, ctx);
80 std::vector< SG::WriteDecorHandle<xAOD::FlowElementContainer, float> > layerDecors_had;
83 layerDecors_had.emplace_back(key, ctx);
95 const auto& layerAccessor = layerAccessors_em.at(iem);
96 auto& layerDecor = layerDecors_em.at(iem);
101 const std::vector<ElementLink<xAOD::IParticleContainer>>& pflowLinks = flow->otherObjectLinks();
103 for (
auto& el : pflowLinks ) {
104 if ( !el.isValid() ) {
throw std::runtime_error(
"Invalid ElementLink found.");};
107 if (c->charge() != 0)
continue;
108 e += layerAccessor(*c);
110 layerDecor(*flow) = e;
118 const auto& layerAccessor = layerAccessors_had.at(ihad);
119 auto& layerDecor = layerDecors_had.at(ihad);
124 const std::vector<ElementLink<xAOD::IParticleContainer>>& pflowLinks = flow->otherObjectLinks();
127 for (
auto& el : pflowLinks ) {
128 if ( !el.isValid() ) {
throw std::runtime_error(
"Invalid ElementLink found.");};
130 if (c->charge() != 0)
continue;
131 e += layerAccessor(*c);
133 layerDecor(*flow) = e;
138 eEMDecorHandle(*flow) = eEM;
139 eHADDecorHandle(*flow) = eHAD;
142 const float eTOT = eEM + eHAD;
144 eFracEMDecorHandle(*flow) = (!eTotZero) ? (eEM / eTOT) : 0.;
145 eFracHADDecorHandle(*flow) = (!eTotZero) ? (eHAD / eTOT) : 0.;
148 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
bool close_to_zero(T value, T eps=std::numeric_limits< T >::epsilon())
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_eFracEMKey
virtual StatusCode execute(const EventContext &) const override
SG::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_emReadDecorKeys
SG::ReadHandleKey< xAOD::FlowElementContainer > m_PFlowContainerKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_eHADKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_eEMKey
virtual StatusCode initialize() override
SG::ReadHandleKey< xAOD::FlowElementContainer > m_FlowContainerKey
SG::WriteDecorHandleKey< xAOD::FlowElementContainer > m_eFracHADKey
FlowEnergyDecorator(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadDecorHandleKeyArray< xAOD::FlowElementContainer > m_hadReadDecorKeys
SG::WriteDecorHandleKeyArray< xAOD::FlowElementContainer > m_hadWriteDecorKeys
SG::WriteDecorHandleKeyArray< xAOD::FlowElementContainer > m_emWriteDecorKeys
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
test if a value is close enough to zero to be an unreliable denominator.
bool close_to_zero(T value, T eps=std::numeric_limits< T >::epsilon())
FlowElement_v1 FlowElement
Definition of the current "pfo version".