ATLAS Offline Software
Loading...
Searching...
No Matches
TrackHandle_xAODTrackParticle.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class TrackHandle_xAODTrackParticle //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: May 2008 //
12// //
14
17#include "VP1Base/VP1Msg.h"
21
22//____________________________________________________________________
24public:
25
26 const Trk::Track * createTrack(Trk::TrackStates* trackStateOnSurfaces) const
27 {
28 if (!trackStateOnSurfaces) {
29 VP1Msg::messageDebug("TrackHandle_xAODTrackParticle WARNING: Could not create track due to null TSOS vector");
30 return nullptr;
31 }
32 if (trackStateOnSurfaces->empty()) {
33 VP1Msg::messageDebug("TrackHandle_xAODTrackParticle WARNING: Could not create track due to empty TSOS vector");
34 delete trackStateOnSurfaces;
35 return nullptr;
36 }
37 Trk::TrackInfo ti(Trk::TrackInfo::Unknown,theclass->extrapolationParticleHypothesis());
38 std::unique_ptr<Trk::TrackStates> sink(trackStateOnSurfaces);
39 const Trk::Track* trk =
40 new Trk::Track(ti,
41 std::move(sink),
42 nullptr /*fitquality*/);
43 if (VP1Msg::verbose())
44 VP1Msg::messageVerbose("TrackHandle_xAODTrackParticle created track with "
45 +QString::number(trackStateOnSurfaces->size())+" parameters");
46 return trk;
47 }
48
49
54
55};
56
57//____________________________________________________________________
59 : TrackHandleBase(ch), m_d(new Imp)
60{
61 m_d->theclass = this;
62 m_d->trackparticle = tp;
63 m_d->trkTrack = nullptr;
64 m_d->trkTrackInit = false;
65
66}
67
68//____________________________________________________________________
73
74//____________________________________________________________________
76{
77 QStringList l;
78 l << "xAODTrackParticle:";
80 return l;
81}
82
83//____________________________________________________________________
85{
86 const Trk::Perigee& p = m_d->trackparticle->perigeeParameters();
87 if (!common()->trackSanityHelper()->isSafe(&p))
88 return Amg::Vector3D(0,0,0);//fixme: warn?
89 return p.momentum();
90}
91
92//____________________________________________________________________
94{
95
96 return m_d->trackparticle->charge();
97}
98
99//____________________________________________________________________
101{
102 if (m_d->trkTrackInit)
103 return m_d->trkTrack;
104 m_d->trkTrackInit = true;
105 std::vector<const Trk::TrackParameters*> trackpars;
106 Trk::TrackStates* trackStateOnSurfaces = new Trk::TrackStates;
107
108 const Trk::Perigee* peri = &(m_d->trackparticle->perigeeParameters());
109
110 trackpars.push_back(peri);
111
112
113 //NB: We only ever created this handle if charge()!=0.0:
114 for (unsigned i = 0; i < trackpars.size(); ++i) {
115 const Trk::TrackParameters* p = (trackpars.at(i));
116 if (!p)
117 continue;
118 if (!common()->trackSanityHelper()->isSafe(p))
119 continue;
120 trackStateOnSurfaces->push_back(new Trk::TrackStateOnSurface(nullptr,p->uniqueClone(),nullptr));
121 }
122 // }
123
124 m_d->trkTrack = m_d->createTrack(trackStateOnSurfaces);
125 return m_d->trkTrack;
126}
127
128//____________________________________________________________________
132
133//____________________________________________________________________
135{
136 uint8_t numberOfPixelHits = 0;
137 if (m_d->trackparticle && m_d->trackparticle->summaryValue(numberOfPixelHits,xAOD::numberOfPixelHits))
138 return numberOfPixelHits;
139 return 0;
140}
141
142//____________________________________________________________________
144{
145 uint8_t numberOfSCTHits = 0;
146 if (m_d->trackparticle && m_d->trackparticle->summaryValue(numberOfSCTHits,xAOD::numberOfSCTHits))
147 return numberOfSCTHits;
148 return 0;
149}
150
151//____________________________________________________________________
153{
154 uint8_t numberOfTRTHits = 0;
155 if (m_d->trackparticle && m_d->trackparticle->summaryValue(numberOfTRTHits,xAOD::numberOfTRTHits))
156 return numberOfTRTHits;
157 return 0;
158}
159
160//____________________________________________________________________
162{
163 return 0;
164}
165//____________________________________________________________________
167{
168 return 0;
169}
170//____________________________________________________________________
172{
173 return 0;
174}//____________________________________________________________________
176{
177 return 0;
178}
179//____________________________________________________________________
181{
182 return 0;
183}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
friend class TrackCollHandleBase
TrackHandleBase(TrackCollHandleBase *)
QStringList baseInfo() const
TrackSysCommonData * common() const
const Trk::Track * createTrack(Trk::TrackStates *trackStateOnSurfaces) const
virtual unsigned getNMuonPhiHits() const
The number of phi hits is part of hit counts below (i.e.
TrackHandle_xAODTrackParticle(TrackCollHandleBase *, const xAOD::TrackParticle *)
virtual QStringList clicked() const
Called when user selects the node (stringlist is displayed in messagebox).
const Trk::Track * provide_pathInfoTrkTrack() const
Contains information about the 'fitter' of this track.
represents the track state (measurement, material, fit parameters and quality) at a surface.
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static bool verbose()
Definition VP1Msg.h:31
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39
Eigen::Matrix< double, 3, 1 > Vector3D
DataVector< const Trk::TrackStateOnSurface > TrackStates
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersBase< TrackParametersDim, Charged > TrackParameters
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].