ATLAS Offline Software
SumPtVertexWeightCalculator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
10 #include "xAODTracking/Vertex.h"
11 
12 namespace Trk {
13 
16 {
17  return StatusCode::SUCCESS;
18 } // end of initialize method
19 
22 {
23  return StatusCode::SUCCESS;
24 }
25 
26 // class constructor implementation
28  const std::string& n,
29  const IInterface* p)
30  : AthAlgTool(t, n, p)
31 {
32  declareInterface<IVertexWeightCalculator>(this);
33 }
34 
35 double
37  const xAOD::Vertex& vertex) const
38 {
39  double total_pt = 0;
40  ATH_MSG_DEBUG("Estimating vertex sorting score from "
41  << vertex.nTrackParticles() << " tracks at vertex.");
42  for (const auto& elTrackParticle : vertex.trackParticleLinks()) {
43 
44  if (not elTrackParticle.isValid()) {
46  "No valid link to tracks in xAOD::Vertex object. Skipping track for "
47  "signal compatibility (may be serious).");
48  continue;
49  }
50 
51  const Trk::Perigee& perigee =
52  (*elTrackParticle.cptr())->perigeeParameters();
53  if (m_doSumPt2Selection) {
54  total_pt += std::pow(1. / perigee.parameters()[Trk::qOverP] *
55  sin(perigee.parameters()[Trk::theta]) / 1000.,
56  2);
57  } else {
58  total_pt += std::fabs(1. / perigee.parameters()[Trk::qOverP]) *
59  sin(perigee.parameters()[Trk::theta]) / 1000.;
60  }
61  }
62  return total_pt;
63 }
64 
65 }
66 
Trk::SumPtVertexWeightCalculator::SumPtVertexWeightCalculator
SumPtVertexWeightCalculator(const std::string &t, const std::string &n, const IInterface *p)
constructor
Definition: SumPtVertexWeightCalculator.cxx:27
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
TrackParameters.h
Trk::SumPtVertexWeightCalculator::estimateSignalCompatibility
virtual double estimateSignalCompatibility(const xAOD::Vertex &vertex) const override final
WeightCalculator.
Definition: SumPtVertexWeightCalculator.cxx:36
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::SumPtVertexWeightCalculator::finalize
virtual StatusCode finalize() override
Definition: SumPtVertexWeightCalculator.cxx:21
Trk::SumPtVertexWeightCalculator::initialize
virtual StatusCode initialize() override
Definition: SumPtVertexWeightCalculator.cxx:15
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
VxTrackAtVertex.h
Vertex.h
SumPtVertexWeightCalculator.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::perigeeParameters
@ perigeeParameters
Definition: MeasurementType.h:19
TrackParticle.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthAlgTool
Definition: AthAlgTool.h:26
Trk::SumPtVertexWeightCalculator::m_doSumPt2Selection
Gaudi::Property< bool > m_doSumPt2Selection
Flag to Set SumPt^2 not SumPt as selection criteria.
Definition: SumPtVertexWeightCalculator.h:65