ATLAS Offline Software
TrackHandle_TrackParticle.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_TrackParticle //
9 // //
10 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11 // Initial version: May 2008 //
12 // //
14 
17 #include "VP1Base/VP1Msg.h"
19 #include "Particle/TrackParticle.h"
22 
23 //____________________________________________________________________
25 public:
26 
27  const Trk::Track * createTrack(Trk::TrackStates* trackStateOnSurfaces) const
28  {
29  if (!trackStateOnSurfaces) {
30  VP1Msg::messageDebug("TrackHandle_TrackParticle WARNING: Could not create track due to null TSOS vector");
31  return nullptr;
32  }
33  if (trackStateOnSurfaces->empty()) {
34  VP1Msg::messageDebug("TrackHandle_TrackParticle WARNING: Could not create track due to empty TSOS vector");
35  delete trackStateOnSurfaces;
36  return nullptr;
37  }
39  std::unique_ptr<Trk::TrackStates> sink(trackStateOnSurfaces);
40  const Trk::Track* trk =
41  new Trk::Track(ti,
42  std::move(sink),
43  nullptr /*fitquality*/);
44  if (VP1Msg::verbose())
45  VP1Msg::messageVerbose("TrackHandle_TrackParticle created track with "
46  +QString::number(trackStateOnSurfaces->size())+" parameters");
47  return trk;
48  }
50 
55 
56 };
57 
58 //____________________________________________________________________
60  : TrackHandleBase(ch), m_d(new Imp)
61 {
62  m_d->theclass = this;
63  m_d->trackparticle = tp;
64  m_d->trkTrack = nullptr;
65  m_d->trkTrackInit = false;
66 
67 }
68 
69 //____________________________________________________________________
71 {
72  delete m_d;
73 }
74 
75 //____________________________________________________________________
77 {
78  QStringList l;
79  l << "TrackParticle:";
81  return l;
82 }
83 
84 //____________________________________________________________________
86 {
87  const Trk::Perigee* p = m_d->trackparticle->perigee();
88  if (!common()->trackSanityHelper()->isSafe(p))
89  return Amg::Vector3D(0,0,0);//fixme: warn?
90  return p->momentum();
91 }
92 
93 //____________________________________________________________________
95 {
96  const Trk::Perigee* p = m_d->trackparticle->perigee();
97  if (!common()->trackSanityHelper()->isSafe(p))
98  return unknown();//fixme: warn
99  return p->charge();
100 }
101 
102 //____________________________________________________________________
104 {
105  if (m_d->trkTrackInit)
106  return m_d->trkTrack;
107  m_d->trkTrackInit = true;
108  const std::vector<const Trk::TrackParameters*>& trackpars = m_d->trackparticle->trackParameters();
109  Trk::TrackStates* trackStateOnSurfaces = new Trk::TrackStates;
110 
111  if (!trackpars.empty()) {
112  bool needresorting = trackpars.at(0)!=m_d->trackparticle->perigee();//Needed since TrackParticles are (at the moment)
113  //created with the first parameter put last
114  if (needresorting) {
115  const Trk::TrackParameters* p = trackpars.at(trackpars.size()-1);
116  if (p)
117  trackStateOnSurfaces->push_back(new Trk::TrackStateOnSurface(nullptr,p->uniqueClone(),nullptr));
118  }
119  unsigned limit(needresorting?trackpars.size()-1:trackpars.size());
120 
121  //NB: We only ever created this handle if charge()!=0.0:
122  for (unsigned i = 0; i < limit; ++i) {
123  const Trk::TrackParameters* p = trackpars.at(i);
124  if (!p)
125  continue;
126  if (!common()->trackSanityHelper()->isSafe(p))
127  continue;
128  trackStateOnSurfaces->push_back(new Trk::TrackStateOnSurface(nullptr,p->uniqueClone(),nullptr));
129  }
130  }
131 
132  m_d->trkTrack = m_d->createTrack(trackStateOnSurfaces);
133  return m_d->trkTrack;
134 }
135 
136 //____________________________________________________________________
138 {
139 }
140 
141 //____________________________________________________________________
143 {
145 }
146 //____________________________________________________________________
148 {
150 }
151 //____________________________________________________________________
153 {
155 }
156 //____________________________________________________________________
158 {
160 }
161 //____________________________________________________________________
163 {
165 }
166 //____________________________________________________________________
168 {
170 }//____________________________________________________________________
172 {
174 }
175 //____________________________________________________________________
177 {
179 }
180 
181 //____________________________________________________________________
183 {
185 }
186 
187 
188 
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
TrackCollHandleBase.h
TrackHandle_TrackParticle::~TrackHandle_TrackParticle
virtual ~TrackHandle_TrackParticle()
Definition: TrackHandle_TrackParticle.cxx:70
Trk::TrackInfo
Contains information about the 'fitter' of this track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:32
TrackCollHandleBase
Definition: TrackCollHandleBase.h:49
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
TrackHandle_TrackParticle::Imp::trkTrackInit
bool trkTrackInit
Definition: TrackHandle_TrackParticle.cxx:54
TrackParameters.h
TrackParticle.h
TrackHandle_TrackParticle::clicked
virtual QStringList clicked() const
Called when user selects the node (stringlist is displayed in messagebox).
Definition: TrackHandle_TrackParticle.cxx:76
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::numberOfCscEtaHits
@ numberOfCscEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:108
TrackHandle_TrackParticle::getNMuonPrecisionHits
virtual unsigned getNMuonPrecisionHits() const
Definition: TrackHandle_TrackParticle.cxx:182
VP1Msg.h
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
TrackHandle_TrackParticle::Imp::trackparticle
const Rec::TrackParticle * trackparticle
Definition: TrackHandle_TrackParticle.cxx:52
xAOD::JetInput::Track
@ Track
Definition: JetContainerInfo.h:61
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
Trk::TrackParticleBase::trackSummary
const TrackSummary * trackSummary() const
accessor function for TrackSummary.
Definition: TrackParticleBase.h:247
ParticleTest.tp
tp
Definition: ParticleTest.py:25
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
Trk::numberOfTgcPhiHits
@ numberOfTgcPhiHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:105
TrackHandle_TrackParticle::getNPixelHits
virtual unsigned getNPixelHits() const
Definition: TrackHandle_TrackParticle.cxx:142
VP1TrackSanity.h
TrackHandle_TrackParticle::TrackHandle_TrackParticle
TrackHandle_TrackParticle(TrackCollHandleBase *, const Rec::TrackParticle *)
Definition: TrackHandle_TrackParticle.cxx:59
TrackHandle_TrackParticle::getNTRTHits
virtual unsigned getNTRTHits() const
Definition: TrackHandle_TrackParticle.cxx:152
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrackHandle_TrackParticle
Definition: TrackHandle_TrackParticle.h:23
TrackHandle_TrackParticle::Imp::createTrack
const Trk::Track * createTrack(Trk::TrackStates *trackStateOnSurfaces) const
Definition: TrackHandle_TrackParticle.cxx:27
Trk::TrackStates
DataVector< const Trk::TrackStateOnSurface > TrackStates
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:30
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrackHandle_TrackParticle::provide_pathInfoTrkTrack
const Trk::Track * provide_pathInfoTrkTrack() const
Definition: TrackHandle_TrackParticle.cxx:103
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
TrackHandle_TrackParticle::momentum
virtual Amg::Vector3D momentum() const
Definition: TrackHandle_TrackParticle.cxx:85
DataVector< const Trk::TrackStateOnSurface >
TrackHandle_TrackParticle::getNMuonPhiHits
virtual unsigned getNMuonPhiHits() const
The number of phi hits is part of hit counts below (i.e.
Definition: TrackHandle_TrackParticle.cxx:157
TrackHandle_TrackParticle::ensureTouchedMuonChambersInitialised
void ensureTouchedMuonChambersInitialised() const
Definition: TrackHandle_TrackParticle.cxx:137
Trk::numberOfTgcEtaHits
@ numberOfTgcEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:106
TrackHandle_TrackParticle::calculateCharge
double calculateCharge() const
Definition: TrackHandle_TrackParticle.cxx:94
TrackHandle_TrackParticle::getNMDTHits
virtual unsigned getNMDTHits() const
Definition: TrackHandle_TrackParticle.cxx:162
TrackHandleBase::common
TrackSysCommonData * common() const
Definition: TrackHandleBase.cxx:255
TrackHandleBase::extrapolationParticleHypothesis
virtual Trk::ParticleHypothesis extrapolationParticleHypothesis() const
Default implementation of this next method bases hypothesis on pdgCode() and charge():
Definition: TrackHandleBase.cxx:1534
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
Trk::numberOfRpcPhiHits
@ numberOfRpcPhiHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:109
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
python.selection.number
number
Definition: selection.py:20
Trk::TrackParticleBase::trackParameters
const std::vector< const TrackParameters * > & trackParameters() const
Returns the track parameters.
Definition: TrackParticleBase.h:243
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TrackHandle_TrackParticle::Imp
Definition: TrackHandle_TrackParticle.cxx:24
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TrackHandle_TrackParticle::m_d
Imp * m_d
Definition: TrackHandle_TrackParticle.h:54
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
TrackHandle_TrackParticle.h
TrackHandle_TrackParticle::getNCSCHits
virtual unsigned getNCSCHits() const
Definition: TrackHandle_TrackParticle.cxx:176
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
TrackHandle_TrackParticle::getNTGCHits
virtual unsigned getNTGCHits() const
Definition: TrackHandle_TrackParticle.cxx:171
TrackHandleBase::baseInfo
QStringList baseInfo() const
Definition: TrackHandleBase.cxx:1551
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
Trk::numberOfRpcEtaHits
@ numberOfRpcEtaHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:110
TrackHandle_TrackParticle::getNRPCHits
virtual unsigned getNRPCHits() const
Definition: TrackHandle_TrackParticle.cxx:167
Trk::TrackSummary::get
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
Trk::TrackParticleBase::perigee
const Perigee * perigee() const
Attempts to cast the definingParameters() to Perigee.
Definition: TrackParticleBase.h:263
TrackHandleBase
Definition: TrackHandleBase.h:56
TrackHandle_TrackParticle::Imp::trkTrack
const Trk::Track * trkTrack
Definition: TrackHandle_TrackParticle.cxx:53
TrackHandleBase::unknown
static double unknown()
Definition: TrackHandleBase.h:102
updateCoolNtuple.limit
int limit
Definition: updateCoolNtuple.py:45
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::numberOfCscPhiHits
@ numberOfCscPhiHits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:107
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
TrackHandle_TrackParticle::getNSCTHits
virtual unsigned getNSCTHits() const
Definition: TrackHandle_TrackParticle.cxx:147
Trk::numberOfMdtHits
@ numberOfMdtHits
number of mdt hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:103
Trk::TrackInfo::Unknown
@ Unknown
Track fitter not defined.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:41
TrackHandle_TrackParticle::Imp::theclass
TrackHandle_TrackParticle * theclass
Definition: TrackHandle_TrackParticle.cxx:51