ATLAS Offline Software
Z0PVTrackComaptibilityEstimator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 
8 #include "TrkTrack/Track.h"
9 
11 
13 
15 
16 
17 
18 namespace Trk{
19 
21  const std::string& name,
22  const IInterface* parent) :
23  base_class(type, name, parent),
24  m_ipEstimator("Trk::TrackToVertexIPEstimator"),
25  m_z0SignificanceMax(30.)
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(track, track, (*primaryVertexContainer)[index], false);
68 
69  bool pileup = false;
70 
71  double sumptPV = 0;
72 
73  /*
74  for(std::vector<Trk::VxTrackAtVertex*>::const_iterator track =
75  (*primaryVertexContainer)[index]->vxTrackAtVertex()->begin();
76  track != (*primaryVertexContainer)[index]->vxTrackAtVertex()->end(); ++track){
77 
78  sumptPV += (*track)->initialPerigee()->momentum().perp();
79  }
80  */
81 
82  // TODO: perhaps calculate sumptPV using VxTracksAtVertex in xAOD::Vertex? -David S.
83  for(unsigned int i = 0; i < (*primaryVertexContainer)[index]->nTrackParticles(); ++i){
84 
85  sumptPV += (*primaryVertexContainer)[index]->trackParticle(i)->perigeeParameters().momentum().perp();
86  }
87 
88  for(unsigned int i = 0; i < primaryVertexContainer->size(); i++){
89 
90  double sumpt = 0.;
91 
92  if( i != index &&
93  (*primaryVertexContainer)[i]->vertexType() != xAOD::VxType::NoVtx ){
94  /*
95  for(std::vector<Trk::VxTrackAtVertex*>::const_iterator track =
96  (*primaryVertexContainer)[i]->vxTrackAtVertex()->begin();
97  track != (*primaryVertexContainer)[i]->vxTrackAtVertex()->end(); ++track){
98 
99  sumpt += (*track)->initialPerigee()->momentum().perp();
100  }
101  */
102 
103  // TODO: perhaps calculate sumptPV using VxTracksAtVertex in xAOD::Vertex? -David S.
104  for(unsigned int itrk = 0; itrk < (*primaryVertexContainer)[i]->nTrackParticles(); ++itrk){
105 
106  sumpt += (*primaryVertexContainer)[i]->trackParticle(itrk)->perigeeParameters().momentum().perp();
107  }
108  double vxReach =
109  std::abs((*primaryVertexContainer)[i]->position().z()
110  - (*primaryVertexContainer)[index]->position().z()) * sumpt / (sumpt + sumptPV);
111 
112  if(std::abs(ip->IPz0 + (*primaryVertexContainer)[index]->position().z() -
113  (*primaryVertexContainer)[i]->position().z()) < vxReach){
114 
115  pileup = true;
116  }
117  }
118  }
119 
120  return std::abs(ip->IPz0) / ip->sigmaz0 < m_z0SignificanceMax && !pileup;
121  }
122 
123 }
TrackParameters.h
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
index
Definition: index.py:1
Trk::Z0PVTrackCompatibilityEstimator::m_z0SignificanceMax
double m_z0SignificanceMax
Definition: Z0PVTrackCompatibilityEstimator.h:62
Trk::Z0PVTrackCompatibilityEstimator::initialize
virtual StatusCode initialize()
Definition: Z0PVTrackComaptibilityEstimator.cxx:34
TrackParticleBase.h
xAOD::VxType::NoVtx
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Definition: TrackingPrimitives.h:570
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Track.h
Trk::Z0PVTrackCompatibilityEstimator::Z0PVTrackCompatibilityEstimator
Z0PVTrackCompatibilityEstimator(const std::string &type, const std::string &name, const IInterface *parent)
Definition: Z0PVTrackComaptibilityEstimator.cxx:20
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VxTrackAtVertex.h
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::Z0PVTrackCompatibilityEstimator::m_ipEstimator
ToolHandle< Trk::ITrackToVertexIPEstimator > m_ipEstimator
Definition: Z0PVTrackCompatibilityEstimator.h:60
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Trk::Z0PVTrackCompatibilityEstimator::finalize
virtual StatusCode finalize()
Definition: Z0PVTrackComaptibilityEstimator.cxx:48
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
dqt_zlumi_pandas.pileup
pileup
Definition: dqt_zlumi_pandas.py:174
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::Z0PVTrackCompatibilityEstimator::isCompatible
bool isCompatible(const xAOD::TrackParticle *track, const xAOD::VertexContainer *pvContainer, unsigned int pvIndex=0) const
Definition: Z0PVTrackComaptibilityEstimator.cxx:57
Z0PVTrackCompatibilityEstimator.h
xAOD::vertexType
vertexType
Definition: Vertex_v1.cxx:166
DeMoScan.index
string index
Definition: DeMoScan.py:364
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Trk::Z0PVTrackCompatibilityEstimator::~Z0PVTrackCompatibilityEstimator
virtual ~Z0PVTrackCompatibilityEstimator()
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7