ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkVertexFitter
TrkVertexWeightCalculators
src
TrueVertexDistanceWeightCalculator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkVertexWeightCalculators/TrueVertexDistanceWeightCalculator.h
"
6
#include "
VxVertex/VxTrackAtVertex.h
"
7
8
#include "
xAODTracking/TrackParticle.h
"
9
#include "
xAODTracking/Vertex.h
"
10
11
namespace
Trk
{
12
13
StatusCode
14
TrueVertexDistanceWeightCalculator::initialize
()
15
{
16
ATH_CHECK
(
m_mcEventCollectionKey
.initialize());
17
return
StatusCode::SUCCESS;
18
}
19
20
StatusCode
21
TrueVertexDistanceWeightCalculator::finalize
()
22
{
23
return
StatusCode::SUCCESS;
24
}
25
26
// class constructor implementation
27
TrueVertexDistanceWeightCalculator::TrueVertexDistanceWeightCalculator
(
28
const
std::string& t,
29
const
std::string& n,
30
const
IInterface* p)
31
:
AthAlgTool
(t, n, p)
32
{
33
declareInterface<IVertexWeightCalculator>(
this
);
34
}
35
36
double
37
TrueVertexDistanceWeightCalculator::estimateSignalCompatibility
(
38
const
xAOD::Vertex
&
vertex
)
const
39
{
40
return
mEstimateSignalCompatibility
(
vertex
.position());
41
}
42
43
double
44
TrueVertexDistanceWeightCalculator::mEstimateSignalCompatibility
(
45
const
Amg::Vector3D
& vtxPosition)
const
46
{
47
SG::ReadHandle<McEventCollection>
mcColl(
m_mcEventCollectionKey
);
48
49
if
(!mcColl.
isValid
()) {
50
ATH_MSG_WARNING
(
"Could not retrieve McEventCollection "
51
<<
m_mcEventCollectionKey
.key()
52
<<
" from StoreGate. Returning 0 distance."
);
53
return
0;
54
}
55
56
McEventCollection::const_iterator
itr = mcColl->begin();
57
const
HepMC::GenEvent
* myEvent = (*itr);
58
if
(!myEvent) {
59
ATH_MSG_ERROR
(
" Cannot find truth event... Returning 0 distance... "
);
60
return
0;
61
}
62
63
auto
Vert = myEvent->vertices().begin();
64
ATH_MSG_DEBUG
(
"Resulting MC seed: x: "
<< (*Vert)->position().x()
65
<<
" y: "
<< (*Vert)->position().y()
66
<<
" z: "
<< (*Vert)->position().z());
67
double
ztrue = (*Vert)->position().z();
68
69
double
z_vtx_pos = vtxPosition.z();
70
71
double
distance = fabs(z_vtx_pos - ztrue);
72
73
ATH_MSG_DEBUG
(
"Distance of pV from truth:"
<< distance);
74
75
if
(distance == 0.) {
76
ATH_MSG_WARNING
(
" Suspicious 0 distance."
);
77
return
1. / 0.000001;
78
}
79
ATH_MSG_DEBUG
(
" Returning distance: "
<< 1. / distance);
80
return
1. / distance;
81
}
82
}
83
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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
TrackParticle.h
Vertex.h
TrueVertexDistanceWeightCalculator.h
VxTrackAtVertex.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
DataVector< HepMC::GenEvent >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Trk::TrueVertexDistanceWeightCalculator::mEstimateSignalCompatibility
double mEstimateSignalCompatibility(const Amg::Vector3D &vtxPosition) const
Definition
TrueVertexDistanceWeightCalculator.cxx:44
Trk::TrueVertexDistanceWeightCalculator::m_mcEventCollectionKey
SG::ReadHandleKey< McEventCollection > m_mcEventCollectionKey
Definition
TrueVertexDistanceWeightCalculator.h:66
Trk::TrueVertexDistanceWeightCalculator::estimateSignalCompatibility
virtual double estimateSignalCompatibility(const xAOD::Vertex &vertex) const override final
WeightCalculator.
Definition
TrueVertexDistanceWeightCalculator.cxx:37
Trk::TrueVertexDistanceWeightCalculator::initialize
virtual StatusCode initialize() override
Definition
TrueVertexDistanceWeightCalculator.cxx:14
Trk::TrueVertexDistanceWeightCalculator::finalize
virtual StatusCode finalize() override
Definition
TrueVertexDistanceWeightCalculator.cxx:21
Trk::TrueVertexDistanceWeightCalculator::TrueVertexDistanceWeightCalculator
TrueVertexDistanceWeightCalculator(const std::string &t, const std::string &n, const IInterface *p)
constructor
Definition
TrueVertexDistanceWeightCalculator.cxx:27
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
HepMC::GenEvent
HepMC3::GenEvent GenEvent
Definition
GenEvent.h:39
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::vertex
@ vertex
Definition
MeasurementType.h:21
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0