ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRecTools
Root
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
//
9
#include "
AsgDataHandles/ReadHandle.h
"
10
#include "
JetRecTools/CaloClusterConstituentsOrigin.h
"
11
#include "
xAODCaloEvent/CaloVertexedTopoCluster.h
"
12
13
CaloClusterConstituentsOrigin::CaloClusterConstituentsOrigin
(
const
std::string & name):
JetConstituentModifierBase
(name) {
14
declareProperty
(
"VertexContainer"
,
m_readVertexContainer_key
=
"PrimaryVertices"
);
15
}
16
17
StatusCode
CaloClusterConstituentsOrigin::initialize
() {
18
if
(
m_inputType
!=
xAOD::Type::CaloCluster
) {
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
27
StatusCode
CaloClusterConstituentsOrigin::process_impl
(
xAOD::IParticleContainer
* cont)
const
{
28
xAOD::CaloClusterContainer
* clust =
static_cast<
xAOD::CaloClusterContainer
*
>
(cont);
// Get CaloCluster container
29
30
auto
handle =
SG::makeHandle
(
m_readVertexContainer_key
);
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
50
StatusCode
CaloClusterConstituentsOrigin::correctToOriginVtx
(
xAOD::CaloClusterContainer
& cont,
const
xAOD::Vertex
& vert)
const
{
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ReadHandle.h
Handle class for reading from StoreGate.
CaloClusterConstituentsOrigin.h
CaloVertexedTopoCluster.h
Evaluate cluster kinematics with a different vertex / signal state.
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
CaloClusterConstituentsOrigin::CaloClusterConstituentsOrigin
CaloClusterConstituentsOrigin(const std::string &name)
Definition
CaloClusterConstituentsOrigin.cxx:13
CaloClusterConstituentsOrigin::correctToOriginVtx
StatusCode correctToOriginVtx(xAOD::CaloClusterContainer &cont, const xAOD::Vertex &vert) const
Definition
CaloClusterConstituentsOrigin.cxx:50
CaloClusterConstituentsOrigin::m_readVertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_readVertexContainer_key
Definition
CaloClusterConstituentsOrigin.h:44
CaloClusterConstituentsOrigin::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition
CaloClusterConstituentsOrigin.cxx:17
CaloClusterConstituentsOrigin::process_impl
StatusCode process_impl(xAOD::IParticleContainer *cont) const
Definition
CaloClusterConstituentsOrigin.cxx:27
JetConstituentModifierBase::JetConstituentModifierBase
JetConstituentModifierBase(const std::string &name)
Definition
JetConstituentModifierBase.cxx:14
JetConstituentModifierBase::m_inputType
unsigned int m_inputType
Definition
JetConstituentModifierBase.h:60
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::CaloVertexedTopoCluster
Evaluate cluster kinematics with a different vertex / signal state.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloVertexedTopoCluster.h:38
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
Definition
Vertex_v1.cxx:106
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAODType::CaloCluster
@ CaloCluster
The object is a calorimeter cluster.
Definition
ObjectType.h:39
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
xAOD::CaloClusterContainer
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterContainer.h:17
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0