ATLAS Offline Software
Loading...
Searching...
No Matches
PFLCNeutralFlowElementCreatorAlgorithm.cxx
Go to the documentation of this file.
4
12
13StatusCode PFLCNeutralFlowElementCreatorAlgorithm::execute(const EventContext& ctx) const {
14
15 ATH_MSG_DEBUG("Executing");
16
17 /* Create Neutral PFOs from all eflowCaloObjects */
19
20 std::pair< std::unique_ptr<xAOD::FlowElementContainer>,
21 std::unique_ptr<xAOD::ShallowAuxContainer> > shallowCopyPair =
22 xAOD::shallowCopyContainer(*neutralFEContainerReadHandle, ctx);
23
25 ATH_CHECK( neutralFELCContainerWriteHandle.record(std::move(shallowCopyPair.first),std::move(shallowCopyPair.second)));
26
27 for( unsigned int counter = 0; counter < (*neutralFEContainerReadHandle).size(); counter++){
28 const xAOD::FlowElement* thisFE = (*neutralFEContainerReadHandle)[counter];
29
30 const static SG::Accessor<ElementLink<xAOD::CaloClusterContainer> > accShowerSubtractedClusterLink("FEShowerSubtractedClusterLink");
31 const ElementLink<xAOD::CaloClusterContainer>& clusElementLink = accShowerSubtractedClusterLink(*thisFE);
32
33 xAOD::FlowElement* theCopiedFE = (*neutralFELCContainerWriteHandle)[counter];
34 //be careful here - cluster p4 methods do not store sign. Thus -ve energy clusters have +ve pt and hence +ve energy
35 //we use eta,phi at EM scale for both 4-vectors - standard FE are at EM scale
36 theCopiedFE->setP4((*clusElementLink)->pt(), (*clusElementLink)->rawEta(), (*clusElementLink)->rawPhi(), (*clusElementLink)->m());
37 }
38
39
40 return StatusCode::SUCCESS;
41}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
SG::WriteHandleKey< xAOD::FlowElementContainer > m_neutralFELCContainerWriteHandleKey
WriteHandleKey for neutral FE.
SG::ReadHandleKey< xAOD::FlowElementContainer > m_neutralFEContainerReadHandleKey
ReadHandleKey for eflowCaloObjectContainer.
Helper class to provide type-safe access to aux data.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setP4(float pt, float eta, float phi, float m)
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.