Commit 061232cd authored by Mark Hodgkinson's avatar Mark Hodgkinson
Browse files

Add code to set LC 4-vector of shallow copied FlowElements.

parent 47cd23a8
#include "eflowRec/PFLCNeutralFlowElementCreatorAlgorithm.h"
#include "xAODCore/ShallowCopy.h"
#include "xAODCaloEvent/CaloClusterContainer.h"
PFLCNeutralFlowElementCreatorAlgorithm::PFLCNeutralFlowElementCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) :
AthReentrantAlgorithm(name, pSvcLocator)
......@@ -26,6 +27,17 @@ StatusCode PFLCNeutralFlowElementCreatorAlgorithm::execute(const EventContext& c
SG::WriteHandle<xAOD::FlowElementContainer> neutralFELCContainerWriteHandle(m_neutralFELCContainerWriteHandleKey,ctx);
ATH_CHECK( neutralFELCContainerWriteHandle.record(std::move(neutralFELCContainer),std::move(neutralFELCContainerAux)));
for( unsigned int counter = 0; counter < (*neutralFEContainerReadHandle).size(); counter++){
const xAOD::FlowElement* thisFE = (*neutralFEContainerReadHandle)[counter];
const SG::AuxElement::Accessor<ElementLink<xAOD::CaloClusterContainer> > accShowerSubtractedClusterLink("FEShowerSubtractedClusterLink");
ElementLink<xAOD::CaloClusterContainer> clusElementLink = accShowerSubtractedClusterLink(*thisFE);
xAOD::FlowElement* theCopiedFE = (*neutralFELCContainerWriteHandle)[counter];
theCopiedFE->setP4((*clusElementLink)->pt(), (*clusElementLink)->rawEta(), (*clusElementLink)->rawPhi(), (*clusElementLink)->m());
}
return StatusCode::SUCCESS;
}
......
......@@ -40,7 +40,7 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::execute(const EventContext& ctx
// Record the output containers
SG::WriteHandle<xAOD::FlowElementContainer> neutralFEContainerWriteHandle(m_neutralFEContainerWriteHandleKey,ctx);
std::sort(neutralFEContainer->begin(), neutralFEContainer->end(), [] (const xAOD::FlowElement* fe1, const xAOD::FlowElement* fe2) {return fe1->pt()>fe2->pt();});
std::sort(neutralFEContainer->begin(), neutralFEContainer->end(), [] (const xAOD::FlowElement* fe1, const xAOD::FlowElement* fe2) {return fe1->pt()>fe2->pt();});
ATH_CHECK( neutralFEContainerWriteHandle.record(std::move(neutralFEContainer),std::move(neutralFEContainerAux)) );
return StatusCode::SUCCESS;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment