Commit 47cd23a8 authored by Mark Hodgkinson's avatar Mark Hodgkinson
Browse files

Add algorithm to shallow copy neutral FlowElements such that we can apply LC scale to them.

parent b3ef6cca
#ifndef PFLCNEUTRALFLOWELEMENTCREATORALGORITHM_H
#define PFLCNEUTRALFLOWELEMENTCREATORALGORITHM_H
#include "eflowRec/eflowCaloObject.h"
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "StoreGate/DataHandle.h"
#include "xAODCaloEvent/CaloCluster.h"
#include "xAODPFlow/FlowElement.h"
#include "xAODPFlow/FlowElementContainer.h"
#include "xAODPFlow/PFODefs.h"
class PFLCNeutralFlowElementCreatorAlgorithm : public AthReentrantAlgorithm {
public:
PFLCNeutralFlowElementCreatorAlgorithm(const std::string& name,ISvcLocator* pSvcLocator);
~PFLCNeutralFlowElementCreatorAlgorithm() {}
static const InterfaceID& interfaceID();
StatusCode initialize();
StatusCode execute(const EventContext& ctx) const;
StatusCode finalize();
private:
/** ReadHandleKey for eflowCaloObjectContainer */
SG::ReadHandleKey<xAOD::FlowElementContainer> m_neutralFEContainerReadHandleKey{this,"FEInputContainerName","JetETMissNeutralFlowElements","ReadHandleKey for neutral FlowElementContainer"};
/** WriteHandleKey for neutral FE */
SG::WriteHandleKey<xAOD::FlowElementContainer> m_neutralFELCContainerWriteHandleKey{this,"FELCOutputName","JetETMissLCNeutralFlowElements","WriteHandleKey for LC neutral FlowElementContainer"};
};
#endif
#include "eflowRec/PFLCNeutralFlowElementCreatorAlgorithm.h"
#include "xAODCore/ShallowCopy.h"
PFLCNeutralFlowElementCreatorAlgorithm::PFLCNeutralFlowElementCreatorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator) :
AthReentrantAlgorithm(name, pSvcLocator)
{}
StatusCode PFLCNeutralFlowElementCreatorAlgorithm::initialize(){
ATH_CHECK(m_neutralFEContainerReadHandleKey.initialize());
ATH_CHECK(m_neutralFELCContainerWriteHandleKey.initialize());
return StatusCode::SUCCESS;
}
StatusCode PFLCNeutralFlowElementCreatorAlgorithm::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG("Executing");
/* Create Neutral PFOs from all eflowCaloObjects */
SG::ReadHandle<xAOD::FlowElementContainer> neutralFEContainerReadHandle(m_neutralFEContainerReadHandleKey,ctx);
std::pair< xAOD::FlowElementContainer*, xAOD::ShallowAuxContainer* > shallowCopyPair = xAOD::shallowCopyContainer(*neutralFEContainerReadHandle);
std::unique_ptr<xAOD::FlowElementContainer> neutralFELCContainer{shallowCopyPair.first};
std::unique_ptr<xAOD::ShallowAuxContainer> neutralFELCContainerAux{shallowCopyPair.second};
SG::WriteHandle<xAOD::FlowElementContainer> neutralFELCContainerWriteHandle(m_neutralFELCContainerWriteHandleKey,ctx);
ATH_CHECK( neutralFELCContainerWriteHandle.record(std::move(neutralFELCContainer),std::move(neutralFELCContainerAux)));
return StatusCode::SUCCESS;
}
StatusCode PFLCNeutralFlowElementCreatorAlgorithm::finalize(){
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