ATLAS Offline Software
PFLCNeutralFlowElementCreatorAlgorithm.cxx
Go to the documentation of this file.
2 #include "xAODCore/ShallowCopy.h"
4 
6 
9 
10  return StatusCode::SUCCESS;
11 }
12 
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 }
ShallowCopy.h
PFLCNeutralFlowElementCreatorAlgorithm::m_neutralFELCContainerWriteHandleKey
SG::WriteHandleKey< xAOD::FlowElementContainer > m_neutralFELCContainerWriteHandleKey
WriteHandleKey for neutral FE.
Definition: PFLCNeutralFlowElementCreatorAlgorithm.h:29
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
PFLCNeutralFlowElementCreatorAlgorithm::initialize
StatusCode initialize()
Definition: PFLCNeutralFlowElementCreatorAlgorithm.cxx:5
PFLCNeutralFlowElementCreatorAlgorithm::m_neutralFEContainerReadHandleKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_neutralFEContainerReadHandleKey
ReadHandleKey for eflowCaloObjectContainer.
Definition: PFLCNeutralFlowElementCreatorAlgorithm.h:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
PFLCNeutralFlowElementCreatorAlgorithm::execute
StatusCode execute(const EventContext &ctx) const
Definition: PFLCNeutralFlowElementCreatorAlgorithm.cxx:13
xAOD::shallowCopyContainer
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Definition: ShallowCopy.h:110
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CaloClusterContainer.h
xAOD::FlowElement_v1::setP4
void setP4(float pt, float eta, float phi, float m)
Definition: FlowElement_v1.cxx:39
PFLCNeutralFlowElementCreatorAlgorithm.h
test_pyathena.counter
counter
Definition: test_pyathena.py:15
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25