ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterConstituentsOrigin.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Source code for the CaloClusterConstituentsOrigin implementation class
6// Michael Nelson, CERN & University of Oxford
7//
8//
12
16
19 ATH_MSG_ERROR("As the name suggests, CaloClusterConstituentsOrigin cannot operate on objects of type "
20 << m_inputType);
21 return StatusCode::FAILURE;
22 }
24 return StatusCode::SUCCESS;
25}
26
28 xAOD::CaloClusterContainer* clust = static_cast<xAOD::CaloClusterContainer*> (cont); // Get CaloCluster container
29
31 ATH_CHECK(handle.isValid());
32 //if(not handle.isValid()) {
33 // // Exit silently if we did not find a designated primary vertex
34 // // This leaves the clusters uncorrected, which is fine
35 // return StatusCode::SUCCESS;
36 //}
37 const auto *vertexContainer = handle.cptr();
38
39 for(const xAOD::Vertex* pv : *vertexContainer) {
40 // Apply the origin correction iff a PV is identified
41 if(pv->vertexType()==xAOD::VxType::PriVtx) {return correctToOriginVtx(*clust, *pv);}
42 }
43 // Exit silently if we did not find a designated primary vertex
44 // This leaves the clusters uncorrected, which is fine
45 return StatusCode::SUCCESS;
46}
47// Apply PV origin correction and decorate the CaloCluster container appropriately.
48// We depend on the ClustersAtEMScaleTool to change the calibration state if needed
49// so we can just correct the position based on the default four-momentum
51 for(xAOD::CaloCluster* cl : cont) {
52 if(cl->calE()>1e-9) {
53 xAOD::CaloVertexedTopoCluster corrCL( *cl,vert.position());
54 cl->setEta(corrCL.eta());
55 cl->setPhi(corrCL.phi());
56 }
57 }
58 return StatusCode::SUCCESS;
59}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for reading from StoreGate.
Evaluate cluster kinematics with a different vertex / signal state.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
CaloClusterConstituentsOrigin(const std::string &name)
StatusCode correctToOriginVtx(xAOD::CaloClusterContainer &cont, const xAOD::Vertex &vert) const
SG::ReadHandleKey< xAOD::VertexContainer > m_readVertexContainer_key
StatusCode initialize()
Dummy implementation of the initialisation function.
StatusCode process_impl(xAOD::IParticleContainer *cont) const
JetConstituentModifierBase(const std::string &name)
virtual double phi() const final
The azimuthal angle ( ) of the particle.
virtual double eta() const final
The pseudorapidity ( ) of the particle.
Evaluate cluster kinematics with a different vertex / signal state.
const Amg::Vector3D & position() const
Returns the 3-pos.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
@ PriVtx
Primary vertex.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Vertex_v1 Vertex
Define the latest version of the vertex class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.