ATLAS Offline Software
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 
14  declareProperty("VertexContainer",m_readVertexContainer_key="PrimaryVertices");
15 }
16 
19  ATH_MSG_ERROR("As the name suggests, CaloClusterConstituentsOrigin cannot operate on objects of type "
20  << m_inputType);
21  return StatusCode::FAILURE;
22  }
23  ATH_CHECK( m_readVertexContainer_key.initialize() );
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  const auto *vertexContainer = handle.cptr();
33 
34  for(const xAOD::Vertex* pv : *vertexContainer) {
35  // Apply the origin correction iff a PV is identified
36  if(pv->vertexType()==xAOD::VxType::PriVtx) {return correctToOriginVtx(*clust, *pv);}
37  }
38  // Exit silently if we did not find a designated primary vertex
39  // This leaves the clusters uncorrected, which is fine
40  return StatusCode::SUCCESS;
41 }
42 // Apply PV origin correction and decorate the CaloCluster container appropriately.
43 // We depend on the ClustersAtEMScaleTool to change the calibration state if needed
44 // so we can just correct the position based on the default four-momentum
46  for(xAOD::CaloCluster* cl : cont) {
47  if(cl->calE()>1e-9) {
48  xAOD::CaloVertexedTopoCluster corrCL( *cl,vert.position());
49  cl->setEta(corrCL.eta());
50  cl->setPhi(corrCL.phi());
51  }
52  }
53  return StatusCode::SUCCESS;
54 }
CaloClusterConstituentsOrigin::process_impl
StatusCode process_impl(xAOD::IParticleContainer *cont) const
Definition: CaloClusterConstituentsOrigin.cxx:27
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::CaloVertexedClusterBase::phi
virtual double phi() const final
The azimuthal angle ( ) of the particle.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloVertexedClusterBase.h:79
xAOD::CaloVertexedClusterBase::eta
virtual double eta() const final
The pseudorapidity ( ) of the particle.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloVertexedClusterBase.h:77
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
CaloClusterConstituentsOrigin::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: CaloClusterConstituentsOrigin.cxx:17
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
CaloClusterConstituentsOrigin::CaloClusterConstituentsOrigin
CaloClusterConstituentsOrigin(const std::string &name)
Definition: CaloClusterConstituentsOrigin.cxx:13
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloClusterConstituentsOrigin::correctToOriginVtx
StatusCode correctToOriginVtx(xAOD::CaloClusterContainer &cont, const xAOD::Vertex &vert) const
Definition: CaloClusterConstituentsOrigin.cxx:45
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
JetConstituentModifierBase
Definition: JetConstituentModifierBase.h:22
ReadHandle.h
Handle class for reading from StoreGate.
CaloVertexedTopoCluster.h
Evaluate cluster kinematics with a different vertex / signal state.
JetConstituentModifierBase::m_inputType
unsigned int m_inputType
Definition: JetConstituentModifierBase.h:60
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
python.changerun.pv
pv
Definition: changerun.py:81
xAOD::CaloVertexedTopoCluster
Evaluate cluster kinematics with a different vertex / signal state.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloVertexedTopoCluster.h:38
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
CaloClusterConstituentsOrigin.h
CaloClusterConstituentsOrigin::m_readVertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_readVertexContainer_key
Definition: CaloClusterConstituentsOrigin.h:44