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< xAOD::FlowElementContainer*, xAOD::ShallowAuxContainer* > shallowCopyPair = xAOD::shallowCopyContainer(*neutralFEContainerReadHandle);
21 std::unique_ptr<xAOD::FlowElementContainer> neutralFELCContainer{shallowCopyPair.first};
22 std::unique_ptr<xAOD::ShallowAuxContainer> neutralFELCContainerAux{shallowCopyPair.second};
24 ATH_CHECK( neutralFELCContainerWriteHandle.record(std::move(neutralFELCContainer),std::move(neutralFELCContainerAux)));
25
26 for( unsigned int counter = 0; counter < (*neutralFEContainerReadHandle).size(); counter++){
27 const xAOD::FlowElement* thisFE = (*neutralFEContainerReadHandle)[counter];
28
29 const static SG::AuxElement::Accessor<ElementLink<xAOD::CaloClusterContainer> > accShowerSubtractedClusterLink("FEShowerSubtractedClusterLink");
30 const ElementLink<xAOD::CaloClusterContainer>& clusElementLink = accShowerSubtractedClusterLink(*thisFE);
31
32 xAOD::FlowElement* theCopiedFE = (*neutralFELCContainerWriteHandle)[counter];
33 //be careful here - cluster p4 methods do not store sign. Thus -ve energy clusters have +ve pt and hence +ve energy
34 //we use eta,phi at EM scale for both 4-vectors - standard FE are at EM scale
35 theCopiedFE->setP4((*clusElementLink)->pt(), (*clusElementLink)->rawEta(), (*clusElementLink)->rawPhi(), (*clusElementLink)->m());
36 }
37
38
39 return StatusCode::SUCCESS;
40}
#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.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
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.