ATLAS Offline Software
Loading...
Searching...
No Matches
ZScanSeedFinder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRKVERTEXSEEDFINDERTOOLS_ZScanSeedFinder_H
6#define TRKVERTEXSEEDFINDERTOOLS_ZScanSeedFinder_H
7
9#include "GaudiKernel/ToolHandle.h"
14
17
18
20
21#include <unordered_map>
22
23namespace Trk
24{
25
26 class Track;
27
28 // @author N. Giacinto Piacquadio (Albert-Ludwigs-Universitaet Freiburg - Germany)
29 //
30 // @ATLAS software
31 //
32 // This class implements a seed finder for the primary vertex finding
33 // which is based on the use of a clustering algorithm over the z position at
34 // point of closest approach to the beam (2d).
35 //
36 // -------------------------------------------
37 // Changes:
38 //
39 // David Shope <david.richard.shope@cern.ch> (2016-04-19)
40 //
41 // EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex,
42 // from Trk::RecVertex to xAOD::Vertex,
43 // from Trk::Vertex to Amg::Vector3D
44
45
46 class ZScanSeedFinder final: public extends<AthAlgTool, IVertexSeedFinder>
47 {
48 public:
49 // Standard Gaudi constructor.
50 ZScanSeedFinder (const std::string& t,
51 const std::string& n,
52 const IInterface* p);
53
54
56
57
58 virtual StatusCode initialize() override;
59 virtual StatusCode finalize() override;
60
61
63
69 virtual Amg::Vector3D
70 findSeed (const std::vector<const Trk::Track*> & vectorTrk,
71 const xAOD::Vertex * constraint=0) const override final;
72
73
79 virtual Amg::Vector3D
80 findSeed (const std::vector<const Trk::TrackParameters*> & perigeeList,
81 const xAOD::Vertex * constraint=0) const override final;
82
83
89 virtual std::vector<Amg::Vector3D>
91 const xAOD::Vertex * constraint=0) const override final;
92
93
100 virtual std::vector<Amg::Vector3D>
102 const xAOD::Vertex * constraint=0) const override final;
103
104
105 private:
107 std::pair<double, double>
109 const xAOD::Vertex* constraint) const;
110
113 const xAOD::Vertex * constraint) const;
114
115
118 const xAOD::Vertex * constraint) const;
119
120 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{
121 this,
122 "EventInfo",
123 "EventInfo",
124 "key for EventInfo retrieval"
125 };
126
127 ToolHandle<IMode1dFinder> m_mode1dfinder{ this,
128 "Mode1dFinder",
129 "Trk::FsmwMode1dFinder" };
130
131 ToolHandle<ITrackToVertexIPEstimator> m_IPEstimator{
132 this,
133 "IPEstimator",
134 "Trk::TrackToVertexIPEstimator"
135 };
136
141 double m_minPt;
143 double m_expPt;
145
146
147 struct Cache {
148 typedef std::pair<Trk::Perigee, Amg::Vector2D> key_t;
149 typedef std::pair<double, double> value_t;
150
151 // functor to hash key for unordered_map
153 size_t operator()(const key_t& p) const
154 {
155 return
156 std::hash<double>()(p.first.parameters()[Trk::d0]) ^
157 std::hash<double>()(p.first.parameters()[Trk::z0]) ^
158 std::hash<double>()(p.first.parameters()[Trk::phi]) ^
159 std::hash<double>()(p.first.parameters()[Trk::theta]) ^
160 std::hash<double>()(p.first.parameters()[Trk::qOverP]) ^
161 std::hash<double>()(p.second.x()) ^
162 std::hash<double>()(p.second.y());
163 }
164 };
165
166 // functor to compare two unordered_map Key values for equality
168 bool operator()(const key_t& left, const key_t& right) const
169 {
170 const AmgVector(5)& lparams = left.first.parameters();
171 const AmgVector(5)& rparams = right.first.parameters();
172 return
173 lparams[Trk::d0] == rparams[Trk::d0] &&
174 lparams[Trk::z0] == rparams[Trk::z0] &&
175 lparams[Trk::phi] == rparams[Trk::phi] &&
176 lparams[Trk::theta] == rparams[Trk::theta] &&
177 lparams[Trk::qOverP] == rparams[Trk::qOverP] &&
178 left.second.x() == right.second.x() &&
179 left.second.y() == right.second.y();
180 }
181 };
182
183
184 // hashtable to avoid computing perigee more than once per track
185 typedef std::unordered_map< key_t, value_t, hash_perigee, pred_perigee>
188
189 EventContext::ContextEvt_t m_evt = -1;
190 std::mutex m_mutex;
191 };
192
194 };
195}
196#endif
Maintain a set of objects, one per slot.
#define AmgVector(rows)
Eigen::Matrix< double, 3, 1 > Vector3D
Define macros for attributes used to control the static checker.
Maintain a set of objects, one per slot.
virtual Amg::Vector3D findSeed(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const =0
Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object.
This class is a simplest representation of a vertex candidate.
std::vector< Trk::DoubleAndWeight > getPositionsCached(const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint) const
virtual StatusCode finalize() override
virtual StatusCode initialize() override
std::pair< double, double > estimateWeight(const Trk::Perigee &iTrk, const xAOD::Vertex *constraint) const
Estimate z-position and weight for one track.
std::vector< Trk::DoubleAndWeight > getPositionsUncached(const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint) const
SG::SlotSpecificObj< Cache > m_cache ATLAS_THREAD_SAFE
virtual std::vector< Amg::Vector3D > findMultiSeeds(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds full vector of linearization points from a vector of tracks and returns it as an Amg::Vector3D ...
ToolHandle< IMode1dFinder > m_mode1dfinder
ZScanSeedFinder(const std::string &t, const std::string &n, const IInterface *p)
ToolHandle< ITrackToVertexIPEstimator > m_IPEstimator
virtual Amg::Vector3D findSeed(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object.
virtual ~ZScanSeedFinder()
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
STL class.
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, 3, 1 > Vector3D
Forward declaration.
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
std::pair< double, double > DoubleAndWeight
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Vertex_v1 Vertex
Define the latest version of the vertex class.
size_t operator()(const key_t &p) const
bool operator()(const key_t &left, const key_t &right) const
std::unordered_map< key_t, value_t, hash_perigee, pred_perigee > WeightMap_t
std::pair< double, double > value_t
EventContext::ContextEvt_t m_evt
std::pair< Trk::Perigee, Amg::Vector2D > key_t
#define private