ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TriggerMatchingTool
Root
EgammaDRScoringTool.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TriggerMatchingTool/EgammaDRScoringTool.h
"
6
#include "
FourMomUtils/xAODP4Helpers.h
"
7
#include "
xAODBase/IParticle.h
"
8
#include "
xAODCaloEvent/CaloCluster.h
"
9
#include "
xAODEgamma/Egamma.h
"
10
#include "
AthContainers/ConstAccessor.h
"
11
#include <sstream>
12
13
// Anonymous namespace for helper functions
14
namespace
{
15
float
dr
(
const
xAOD::CaloCluster
&lhs,
const
xAOD::CaloCluster
&rhs)
16
{
17
return
xAOD::P4Helpers::deltaR
(lhs.
etaBE
(2), lhs.
phiBE
(2), rhs.
etaBE
(2), rhs.
phiBE
(2));
18
}
19
float
dr
(
const
xAOD::IParticle
&online,
const
xAOD::CaloCluster
&
offline
,
bool
useDecor =
true
)
20
{
21
static
const
SG::ConstAccessor<float>
cl_eta2Acc (
"cl_eta2"
);
22
static
const
SG::ConstAccessor<float>
cl_phi2Acc (
"cl_phi2"
);
23
double
lhs_eta = useDecor ? cl_eta2Acc(online) :
online
.
eta
();
24
double
lhs_phi = useDecor ? cl_phi2Acc(online) :
online
.
phi
();
25
double
rhs_eta =
offline
.etaBE(2);
26
double
rhs_phi =
offline
.phiBE(2);
27
28
return
xAOD::P4Helpers::deltaR
(lhs_eta, lhs_phi, rhs_eta, rhs_phi);
29
}
30
}
31
32
namespace
Trig
{
33
EgammaDRScoringTool::EgammaDRScoringTool
(
const
std::string &name) :
34
asg
::
AsgTool
(name)
35
{
36
declareProperty
(
"UseClusterDecorator"
,
m_useClusterDecorator
=
true
,
37
"Use the decorated cluster values instead of the link to the cluster."
);
38
}
39
40
StatusCode
EgammaDRScoringTool::initialize
()
41
{
42
return
StatusCode::SUCCESS;
43
}
44
45
float
EgammaDRScoringTool::score
(
46
const
xAOD::IParticle
&online,
47
const
xAOD::IParticle
&
offline
)
const
48
{
49
switch
(online.type())
50
{
51
case
xAOD::Type::CaloCluster
:
52
return
dr(
53
dynamic_cast<
const
xAOD::CaloCluster
&
>
(online),
54
dynamic_cast<
const
xAOD::CaloCluster
&
>
(
offline
));
55
case
xAOD::Type::Electron
:
56
if
(
m_useClusterDecorator
)
57
{
58
return
dr(online,
59
*
dynamic_cast<
const
xAOD::Egamma
&
>
(
offline
).caloCluster(),
true
);
60
}
else
{
61
return
dr(
62
*
dynamic_cast<
const
xAOD::Egamma
&
>
(online).caloCluster(),
63
*
dynamic_cast<
const
xAOD::Egamma
&
>
(
offline
).caloCluster());
64
}
65
case
xAOD::Type::Photon
:
66
return
dr(
67
*
dynamic_cast<
const
xAOD::Egamma
&
>
(online).caloCluster(),
68
*
dynamic_cast<
const
xAOD::Egamma
&
>
(
offline
).caloCluster());
69
default
:
70
{
71
std::string
msg
=
"Not an egamma type: "
+ std::to_string(online.type());
72
throw
std::runtime_error(
msg
);
73
}
74
}
75
76
}
77
}
//> end namespace Trig
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
EgammaDRScoringTool.h
Egamma.h
IParticle.h
CaloCluster.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
Trig::EgammaDRScoringTool::score
virtual float score(const xAOD::IParticle &online, const xAOD::IParticle &offline) const override
Calculate the matching score for a pair of particles.
Definition
EgammaDRScoringTool.cxx:45
Trig::EgammaDRScoringTool::EgammaDRScoringTool
EgammaDRScoringTool(const std::string &name)
Definition
EgammaDRScoringTool.cxx:33
Trig::EgammaDRScoringTool::m_useClusterDecorator
bool m_useClusterDecorator
Use decorated cluster information.
Definition
EgammaDRScoringTool.h:32
Trig::EgammaDRScoringTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
EgammaDRScoringTool.cxx:40
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
xAOD::CaloCluster_v1::phiBE
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
Definition
CaloCluster_v1.cxx:634
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition
CaloCluster_v1.cxx:628
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
TileSyncBch.online
str online
Definition
TileSyncBch.py:112
Trig
The common trigger namespace for trigger analysis tools.
Definition
LArCellMonAlg.h:33
asg
Definition
DataHandleTestTool.h:28
offline
python.TurnDataReader.dr
dr
Definition
TurnDataReader.py:111
xAODType::Photon
@ Photon
The object is a photon.
Definition
ObjectType.h:47
xAODType::CaloCluster
@ CaloCluster
The object is a calorimeter cluster.
Definition
ObjectType.h:39
xAODType::Electron
@ Electron
The object is an electron.
Definition
ObjectType.h:46
xAOD::P4Helpers::deltaR
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Definition
xAODP4Helpers.h:150
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::Egamma
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition
Egamma.h:17
msg
MsgStream & msg
Definition
testRead.cxx:32
xAODP4Helpers.h
Generated on
for ATLAS Offline Software by
1.17.0