ATLAS Offline Software
Loading...
Searching...
No Matches
Z0PVTrackCompatibilityEstimator.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
7
8#include "TrkTrack/Track.h"
9
11
13
15
16
17
18namespace Trk{
19
21 const std::string& name,
22 const IInterface* parent) :
23 base_class(type, name, parent),
24 m_ipEstimator("Trk::TrackToVertexIPEstimator"),
26 {
27 declareProperty("IPEstimator", m_ipEstimator, "Impact parameter estimator tool");
28 declareProperty("Z0SignificanceMax", m_z0SignificanceMax);
29 }
30
32
33
35
36 ATH_MSG_INFO( "Initializing Z0PVTrackCompatibilityEstimator" );
37
38 StatusCode sc = m_ipEstimator.retrieve();
39 if( !sc.isSuccess() ){
40 msg(MSG::FATAL) << "Unable to retrieve impact parameter estimator tool" << endmsg;
41 return sc;
42 }
43
44 return StatusCode::SUCCESS;
45 }
46
47
49
50 ATH_MSG_INFO( "Finalizing Z0PVTrackCompatibilityEstimator" );
51
52 return StatusCode::SUCCESS;
53 }
54
55
56
58 const xAOD::VertexContainer* primaryVertexContainer, unsigned int index) const{
59
60 return isCompatible( &(track->perigeeParameters()), primaryVertexContainer, index );
61 }
62
64 const xAOD::VertexContainer* primaryVertexContainer, unsigned int index) const{
65
66 // TODO: do we want to doRemoval here? (I have it as false for now)
67 std::unique_ptr<ImpactParametersAndSigma> ip = m_ipEstimator->estimate(Gaudi::Hive::currentContext(),
68 track, track, (*primaryVertexContainer)[index], false);
69
70 bool pileup = false;
71
72 double sumptPV = 0;
73
74
75 // TODO: perhaps calculate sumptPV using VxTracksAtVertex in xAOD::Vertex? -David S.
76 for(unsigned int i = 0; i < (*primaryVertexContainer)[index]->nTrackParticles(); ++i){
77
78 sumptPV += (*primaryVertexContainer)[index]->trackParticle(i)->perigeeParameters().momentum().perp();
79 }
80
81 for(unsigned int i = 0; i < primaryVertexContainer->size(); i++){
82
83 double sumpt = 0.;
84
85 if( i != index &&
86 (*primaryVertexContainer)[i]->vertexType() != xAOD::VxType::NoVtx ){
87
88
89 // TODO: perhaps calculate sumptPV using VxTracksAtVertex in xAOD::Vertex? -David S.
90 for(unsigned int itrk = 0; itrk < (*primaryVertexContainer)[i]->nTrackParticles(); ++itrk){
91
92 sumpt += (*primaryVertexContainer)[i]->trackParticle(itrk)->perigeeParameters().momentum().perp();
93 }
94 if ((sumpt + sumptPV) == 0.)[[unlikely]]{
95 ATH_MSG_ERROR("isCompatible: Divisor 'sumpt + sumptPV' is zero.");
96 return false;
97 }
98 double vxReach =
99 std::abs((*primaryVertexContainer)[i]->position().z()
100 - (*primaryVertexContainer)[index]->position().z()) * sumpt / (sumpt + sumptPV);
101
102 if(std::abs(ip->IPz0 + (*primaryVertexContainer)[index]->position().z() -
103 (*primaryVertexContainer)[i]->position().z()) < vxReach){
104
105 pileup = true;
106 }
107 }
108 }
109
110 return std::abs(ip->IPz0) / ip->sigmaz0 < m_z0SignificanceMax && !pileup;
111 }
112
113}
#define endmsg
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
static Double_t sc
size_type size() const noexcept
Returns the number of elements in the collection.
ToolHandle< Trk::ITrackToVertexIPEstimator > m_ipEstimator
Z0PVTrackCompatibilityEstimator(const std::string &type, const std::string &name, const IInterface *parent)
bool isCompatible(const xAOD::TrackParticle *track, const xAOD::VertexContainer *pvContainer, unsigned int pvIndex=0) const
Ensure that the ATLAS eigen extensions are properly loaded.
@ z
global position (cartesian)
Definition ParamDefs.h:57
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition index.py:1
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
#define unlikely(x)
MsgStream & msg
Definition testRead.cxx:32