ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::AdaptiveVertexFitter Class Reference

#include <AdaptiveVertexFitter.h>

Inheritance diagram for Trk::AdaptiveVertexFitter:
Collaboration diagram for Trk::AdaptiveVertexFitter:

Public Member Functions

virtual StatusCode initialize () override
 AdaptiveVertexFitter (const std::string &t, const std::string &n, const IInterface *p)
 default constructor due to Athena interface
virtual ~AdaptiveVertexFitter ()
 destructor
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const xAOD::TrackParticle * > &vectorTrk, const std::vector< const xAOD::NeutralParticle * > &vectorNeut, const Amg::Vector3D &startingPoint) const override
 Interface for xAOD::TrackParticle with starting point.
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const xAOD::TrackParticle * > &vectorTrk, const Amg::Vector3D &startingPoint) const override
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const xAOD::TrackParticle * > &vectorTrk, const std::vector< const xAOD::NeutralParticle * > &vectorNeut, const xAOD::Vertex &constraint) const override
 Interface for xAOD::TrackParticle with vertex constraint the position of the constraint is ALWAYS the starting point.
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const xAOD::TrackParticle * > &vectorTrk, const xAOD::Vertex &constraint) const override
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const std::vector< const Trk::NeutralParameters * > &neutralPerigeeList, const Amg::Vector3D &startingPoint) const override
 Interface for MeasuredPerigee with starting point.
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const Amg::Vector3D &startingPoint) const override
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const std::vector< const Trk::NeutralParameters * > &neutralPerigeeList, const xAOD::Vertex &constraint) const override
 Interface for MeasuredPerigee with vertex constraint.
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex &constraint) const override
std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::Track * > &Vectortrk, const xAOD::Vertex &constraint, const Amg::Vector3D &startingPoint) const
 fit providing vector of tracks, constraint and startingPoint
std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const std::vector< const Trk::NeutralParameters * > &neutralPerigeeList, const xAOD::Vertex &constraint, const Amg::Vector3D &startingPoint) const
 fit providing vector of ParametersBase, constraint and startingPoint
std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex &constraint, const Amg::Vector3D &startingPoint) const
std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const std::vector< const Trk::NeutralParameters * > &neutralPerigeeList) const override
 fit providing vector of TrackParameters and NeutralParameters
std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList) const override
std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const Trk::TrackParticleBase * > &perigeeList) const
 fit providing vector of TrackParticleBase

Private Member Functions

std::unique_ptr< xAOD::Vertex_fit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const std::vector< const Trk::NeutralParameters * > &neutralPerigeeList=std::vector< const Trk::NeutralParameters * >(), const xAOD::Vertex &constraint=xAOD::Vertex(), const Amg::Vector3D &startingPoint=Amg::Vector3D(), bool IsConstraint=false, bool IsStartingPoint=false) const
 Internal method for fitting a list of TrackParameters and NeutralParameters, with or without constraint and starting point.
std::unique_ptr< xAOD::Vertex_fit (const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex &constraint=xAOD::Vertex(), const Amg::Vector3D &startingPoint=Amg::Vector3D(), bool IsConstraint=false, bool IsStartingPoint=false) const
std::unique_ptr< xAOD::Vertex_fit (const EventContext &ctx, const std::vector< const Trk::Track * > &VectorTrk, const xAOD::Vertex &constraint=xAOD::Vertex(), const Amg::Vector3D &startingPoint=Amg::Vector3D(), bool IsConstraint=false, bool IsStartingPoint=false) const
 Internal method for fitting a list of Tracks, with or without constraint and starting point.
std::unique_ptr< xAOD::Vertexdothefit (const EventContext &ctx, const xAOD::Vertex &ConstraintVertex, const Amg::Vector3D &SeedVertex, std::vector< VxTrackAtVertex > &myLinTracks) const
 Internal method, called by the two _fit internal functions, in order to perform the fit, after having initialized the input (constraint + seed).

Private Attributes

ToolHandle< Trk::IVertexSeedFinderm_SeedFinder
ToolHandle< Trk::IVertexLinearizedTrackFactorym_LinearizedTrackFactory
ToolHandle< Trk::IVertexTrackCompatibilityEstimatorm_TrackCompatibilityEstimator
ToolHandle< Trk::IImpactPoint3dEstimatorm_ImpactPoint3dEstimator
ToolHandle< Trk::IVertexUpdatorm_VertexUpdator
ToolHandle< Trk::IVertexSmootherm_VertexSmoother
ToolHandle< Trk::IVertexAnnealingMakerm_AnnealingMaker
long int m_maxIterations
 Number of maximum iterations.
double m_maxDistToLinPoint
 Maximum distance of linearization point of track to actual fitted vertex before needing to relinearize (in mm).
double m_initialError
 Initial error in form of diagonal elements of the inverse of the covariance matrix (name is misleading: take the error, square it and initialize the variable with its inverse).
bool m_onlyzseed
 Variable is true if seeding has to be performed only on the z direction.
bool m_doSmoothing
 True if smoothing after fit iterations has to be performed: otherwise the Smoother AlgoTool provided to the fitter will be ignored.

Detailed Description

Author
N. Giacinto Piacquadio (Freiburg ATLAS Group)

This class implements a vertexing fitting algorithm which is adaptive and robust, quite insensitive to the presence of outliers.

The vertex algorithm is based on the typical Kalman-Filtering approach, with the difference that the inverse of the covariance matrices of the track parameters of the tracks which enter the fit are reweighted according to the probability of the tracks to be compatible with the vertex to be fit. In this way outliers/tracks which do not belong to the vertex are smoothly rejected.

Since the estimation of the vertex position during the first fit iterations is not particularly good and the compatiblity estimation of the tracks not always reliable, an annealing technique is also implemented, in order to make the rejection of outliers soft in the beginning and harder towards the end of the fit (for this the Annealing Maker class is responsible: as a default the Temperature of this thermodinamical procedure is lowered according to few predefined steps)

For greater modularity the algorithm is divided into 6 modules (AlgTools in Athena):

  1. SeedFinder
  2. LinearizedTrackFactory
  3. TrackCompatibilityEstimator 3b. ImpactPoint3dEstimator
  4. VertexUpdator
  5. VertexSmoother plus another one, which is responsible for letting the temperature go down (the so called "annealing technique")
  6. AnnealingMaker

This kind of algorithm was implemented for the first time by CMS: for information about the theoretical motivations a good reference is Wolfgang Waltenberger's PhD Thesis and many of the calculations implemented have been extensively shown in theoretical & experimental papers by Fruehwirth, Waltenberger, Strandlie et al.


Changes:

David Shope david.nosp@m..ric.nosp@m.hard..nosp@m.shop.nosp@m.e@cer.nosp@m.n.ch (2016-04-19) EDM Migration to xAOD - from Trk::VxCandidate to xAOD::Vertex, from Trk::RecVertex to xAOD::Vertex, from Trk::Vertex to Amg::Vector3D

Definition at line 86 of file AdaptiveVertexFitter.h.

Constructor & Destructor Documentation

◆ AdaptiveVertexFitter()

Trk::AdaptiveVertexFitter::AdaptiveVertexFitter ( const std::string & t,
const std::string & n,
const IInterface * p )

default constructor due to Athena interface

Definition at line 29 of file AdaptiveVertexFitter.cxx.

29 :
30 base_class(t,n,p),
33 m_initialError(0.0001),
34 m_onlyzseed(false),
35 m_doSmoothing(true)
36 {
37 declareProperty("MaxIterations", m_maxIterations);
38 declareProperty("MaxDistToLinPoint", m_maxDistToLinPoint);
39 declareProperty("InitialError",m_initialError);
40 declareProperty("onlyzseed",m_onlyzseed);
41 declareProperty("DoSmoothing",m_doSmoothing);
42 declareInterface<IVertexFitter>(this);
43 }
double m_initialError
Initial error in form of diagonal elements of the inverse of the covariance matrix (name is misleadin...
bool m_doSmoothing
True if smoothing after fit iterations has to be performed: otherwise the Smoother AlgoTool provided ...
bool m_onlyzseed
Variable is true if seeding has to be performed only on the z direction.
double m_maxDistToLinPoint
Maximum distance of linearization point of track to actual fitted vertex before needing to relineariz...
long int m_maxIterations
Number of maximum iterations.

◆ ~AdaptiveVertexFitter()

Trk::AdaptiveVertexFitter::~AdaptiveVertexFitter ( )
virtualdefault

destructor

Member Function Documentation

◆ _fit() [1/3]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::_fit ( const EventContext & ctx,
const std::vector< const Trk::Track * > & VectorTrk,
const xAOD::Vertex & constraint = xAOD::Vertex(),
const Amg::Vector3D & startingPoint = Amg::Vector3D(),
bool IsConstraint = false,
bool IsStartingPoint = false ) const
private

Internal method for fitting a list of Tracks, with or without constraint and starting point.

Definition at line 258 of file AdaptiveVertexFitter.cxx.

265 { // initialized to false
266
267 ATH_MSG_DEBUG("Called Adaptive vertex with Trk::Track. N. Tracks = " << VectorTrk.size());
268
269 std::vector<const Trk::TrackParameters*> perigeeList;
270 for (const auto *iter : VectorTrk) {
271 if (std::isnan(iter->perigeeParameters()->parameters()[Trk::d0])) {
272 continue;
273 }
274 perigeeList.push_back(iter->perigeeParameters());
275 }
276
277 std::unique_ptr<xAOD::Vertex> FittedVertex = _fit(ctx,perigeeList,constraint,startingPoint,IsConstraint,IsStartingPoint);
278
279 if (FittedVertex==nullptr) {
280 return FittedVertex;
281 }
282
283 //these following lines are really absurd... Why has this to be the case... <19-06-2006>
284 //We need a link which can be dynamically to a Track or a TrackParticle....... )-:
285
286 const std::vector<const Trk::Track*>::const_iterator trkbegin=VectorTrk.begin();
287 const std::vector<const Trk::Track*>::const_iterator trkend=VectorTrk.end();
288
289 const std::vector<VxTrackAtVertex>::iterator vtxbegin=FittedVertex->vxTrackAtVertex().begin();
290 const std::vector<VxTrackAtVertex>::iterator vtxend=FittedVertex->vxTrackAtVertex().end();
291
292 for (std::vector<const Trk::Track*>::const_iterator trkiter=trkbegin;trkiter!=trkend;++trkiter)
293 {
294 for (std::vector<Trk::VxTrackAtVertex>::iterator vtxiter=vtxbegin;vtxiter!=vtxend;++vtxiter)
295 {
296 if(((*trkiter)->perigeeParameters()->momentum() -
297 (*vtxiter).initialPerigee()->momentum()).mag()< 1e-8 &&
298 ((*trkiter)->perigeeParameters()->position() -
299 (*vtxiter).initialPerigee()->position()).mag()< 1e-8)
300 {
301
302 ElementLink<TrackCollection> link;
303 link.setElement(*trkiter);
304 LinkToTrack * linkTT = new LinkToTrack(link);
305 (*vtxiter).setOrigTrack(linkTT);
306 }
307 }
308 }
309
310 //*******************************************************************
311 // TODO: Starting from a vector of Trk::Tracks, can't store
312 // separately from the vxTrackAtVertex vector the links to the
313 // original tracks in xAOD::Vertex (only links to xAOD::TrackParticles and
314 // xAOD::NeutralParticles can be stored)
315 //*******************************************************************
316
317 return FittedVertex;
318 }
#define ATH_MSG_DEBUG(x)
std::unique_ptr< xAOD::Vertex > _fit(const EventContext &ctx, const std::vector< const Trk::TrackParameters * > &perigeeList, const std::vector< const Trk::NeutralParameters * > &neutralPerigeeList=std::vector< const Trk::NeutralParameters * >(), const xAOD::Vertex &constraint=xAOD::Vertex(), const Amg::Vector3D &startingPoint=Amg::Vector3D(), bool IsConstraint=false, bool IsStartingPoint=false) const
Internal method for fitting a list of TrackParameters and NeutralParameters, with or without constrai...
pointer & link(pointer p) const
Return a reference to the link for an element.
@ d0
Definition ParamDefs.h:63

◆ _fit() [2/3]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::_fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const std::vector< const Trk::NeutralParameters * > & neutralPerigeeList = std::vector<const Trk::NeutralParameters*>(),
const xAOD::Vertex & constraint = xAOD::Vertex(),
const Amg::Vector3D & startingPoint = Amg::Vector3D(),
bool IsConstraint = false,
bool IsStartingPoint = false ) const
private

Internal method for fitting a list of TrackParameters and NeutralParameters, with or without constraint and starting point.

Definition at line 113 of file AdaptiveVertexFitter.cxx.

121 {
122
123 //check the number of tracks
124 if ( (perigeeList.size() + neutralPerigeeList.size())<2 && !IsConstraint ) {
125 msg(MSG::WARNING) << "Not enough tracks (>2) to fit in this event (without constraint)." << endmsg;
126 return nullptr;
127 }
128 if ((perigeeList.size() + neutralPerigeeList.size())<1 && IsConstraint) {
129 msg(MSG::WARNING) << "Not enough tracks (>1) to fit in this event (with constraint)." << endmsg;
130 return nullptr;
131 }
132
133
134 Amg::Vector3D SeedPoint;
135 //now find the best point for seeding and linearization of the tracks
136 if (IsStartingPoint) {
137 SeedPoint=startingPoint;
138 } else {
139 if (perigeeList.size()>1) {
140 if (IsConstraint) {
141 SeedPoint=m_SeedFinder->findSeed(perigeeList,&constraint);
142 } else {
143 SeedPoint=m_SeedFinder->findSeed(perigeeList);
144 }
145 }
146 else if (IsConstraint) {
147 SeedPoint=constraint.position();
148 }
149 else {
150 SeedPoint.setZero();
151 }
152 }
153
154 //in case m_onlyzseed is on, just use only the z component given by the seed finder
155 if (m_onlyzseed&&IsConstraint) {
156 SeedPoint=constraint.position();
157 }
158
159
160 //now create a Global Position with the linearized track and the linearization point
161 //which in this case is taken from the found seed for the vertex
162 //use the linPoint to linearize tracks
163
164 std::vector<VxTrackAtVertex> theLinTracks;
165
166 std::vector<const Trk::TrackParameters*>::const_iterator perigeesBegin=perigeeList.begin();
167 std::vector<const Trk::TrackParameters*>::const_iterator perigeesEnd=perigeeList.end();
168
169 ATH_MSG_DEBUG("Inside fitter with track perigee parameters.");
170 ATH_MSG_DEBUG("Seed point: " << SeedPoint);
171 int myDebugNTrk(0);
172
173 for (std::vector<const Trk::TrackParameters*>::const_iterator perigeesIter=perigeesBegin;perigeesIter!=perigeesEnd;++perigeesIter) {
174 // const MeasuredPerigee* castToMP=dynamic_cast<const MeasuredPerigee*>(*perigeesIter);
175 // if (castToMP==0) {
176 // msg << MSG::ERROR << "Cast to MeasuredPerigee not successfull. Treatment of neutrals not supported. Skipping track..." << endmsg;
177 // continue;
178 // }
179
180 ATH_MSG_DEBUG("Track #" << myDebugNTrk++ << ". TrackParameters: x = " << (*perigeesIter)->position().x() << ", y = "<< (*perigeesIter)->position().y() <<", z = "<< (*perigeesIter)->position().z() << ". Covariance: " << *(*perigeesIter)->covariance());
181
182 VxTrackAtVertex* LinTrackToAdd = new VxTrackAtVertex(0., nullptr, nullptr, (*perigeesIter), nullptr); //TODO: Must think now about when to delete this memory! -David S.
183
184 //m_LinearizedTrackFactory->linearize(*LinTrackToAdd,SeedPoint); why linearize it? maybe you don't need it at all!!!!! <19-05-2006>
185 bool success=m_ImpactPoint3dEstimator->addIP3dAtaPlane(ctx,*LinTrackToAdd,SeedPoint);
186 if (!success)
187 {
188 msg(MSG::DEBUG) << "Adding compatibility to vertex information failed. Newton distance finder didn't converge..." << endmsg;
189 }
190
191 theLinTracks.push_back(*LinTrackToAdd);
192
193 delete LinTrackToAdd; //TODO: is here ok?
194
195 }
196
197 std::vector<const Trk::NeutralParameters*>::const_iterator neutralPerigeesBegin=neutralPerigeeList.begin();
198 std::vector<const Trk::NeutralParameters*>::const_iterator neutralPerigeesEnd =neutralPerigeeList.end();
199
200 ATH_MSG_DEBUG("Inside fitter with neutral perigee parameters.");
201 ATH_MSG_DEBUG("Seed point: " << SeedPoint);
202 int myDebugNNeutral(0);
203 for (std::vector<const Trk::NeutralParameters*>::const_iterator neutralPerigeesIter=neutralPerigeesBegin;neutralPerigeesIter!=neutralPerigeesEnd;++neutralPerigeesIter) {
204
205 ATH_MSG_DEBUG("Neutral #" << myDebugNNeutral++ << ". NeutralParameters: x = " << (*neutralPerigeesIter)->position().x() << ", y = "<< (*neutralPerigeesIter)->position().y() <<", z = "<< (*neutralPerigeesIter)->position().z());
206 ATH_MSG_DEBUG(" Covariance: " << *(*neutralPerigeesIter)->covariance());
207 ATH_MSG_DEBUG(" Momentum: x = " << (*neutralPerigeesIter)->momentum().x() << ", y = "<< (*neutralPerigeesIter)->momentum().y() <<", z = "<< (*neutralPerigeesIter)->momentum().z());
208
209 VxTrackAtVertex* LinTrackToAdd = new VxTrackAtVertex(0., nullptr, nullptr, nullptr, (*neutralPerigeesIter) ); //TODO: Must think now about when to delete this memory! -David S.
210
211 bool success = m_ImpactPoint3dEstimator->addIP3dAtaPlane(ctx,*LinTrackToAdd,SeedPoint);
212 if (!success)
213 {
214 msg(MSG::DEBUG) << "Adding compatibility to vertex information failed. Newton distance finder didn't converge..." << endmsg;
215 }
216
217 theLinTracks.push_back(*LinTrackToAdd);
218
219 delete LinTrackToAdd; //TODO: is here ok?
220 }
221
222
223
224 //Initialize the vertex seed with an arbitrary great error matrix (just starting point,
225 //not really prior information in it)
226 if(msgLvl(MSG::VERBOSE))
227 {
228 msg(MSG::VERBOSE) << "Error at the beginning is set to " << m_initialError << endmsg;
229 }
230
231
232
233
234 xAOD::Vertex ConstraintVertex;
235 ConstraintVertex.makePrivateStore();
236 //use the previous prior vertex info for the initial vertex if there
237 if (IsConstraint ) {
238 ConstraintVertex.setPosition( constraint.position() );
239 ConstraintVertex.setCovariancePosition( constraint.covariancePosition() );
240 ConstraintVertex.setFitQuality( 0., 0. );
241 } else {
242 AmgSymMatrix(3) startingCovMatrix;
243 startingCovMatrix.setIdentity();
244 startingCovMatrix = startingCovMatrix / m_initialError;
245 //now initialize with starting position and covariance matrix
246 ConstraintVertex.setPosition( SeedPoint );
247 ConstraintVertex.setCovariancePosition( startingCovMatrix );
248 ConstraintVertex.setFitQuality( 0., -3. );
249 }
250
251 //now put the linearizedtracks into VxTrackAtVertex
252 return dothefit(ctx,ConstraintVertex,SeedPoint,theLinTracks);
253
254
255 }
#define endmsg
#define AmgSymMatrix(dim)
ToolHandle< Trk::IImpactPoint3dEstimator > m_ImpactPoint3dEstimator
std::unique_ptr< xAOD::Vertex > dothefit(const EventContext &ctx, const xAOD::Vertex &ConstraintVertex, const Amg::Vector3D &SeedVertex, std::vector< VxTrackAtVertex > &myLinTracks) const
Internal method, called by the two _fit internal functions, in order to perform the fit,...
ToolHandle< Trk::IVertexSeedFinder > m_SeedFinder
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
const Amg::Vector3D & position() const
Returns the 3-pos.
Eigen::Matrix< double, 3, 1 > Vector3D
Vertex_v1 Vertex
Define the latest version of the vertex class.
MsgStream & msg
Definition testRead.cxx:32

◆ _fit() [3/3]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::_fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const xAOD::Vertex & constraint = xAOD::Vertex(),
const Amg::Vector3D & startingPoint = Amg::Vector3D(),
bool IsConstraint = false,
bool IsStartingPoint = false ) const
private

Definition at line 605 of file AdaptiveVertexFitter.cxx.

612 {
613 const std::vector<const Trk::NeutralParameters*> neutralPerigeeList;
614 return _fit(ctx, perigeeList, neutralPerigeeList, constraint, startingPoint, IsConstraint, IsStartingPoint);
615 }

◆ dothefit()

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::dothefit ( const EventContext & ctx,
const xAOD::Vertex & ConstraintVertex,
const Amg::Vector3D & SeedVertex,
std::vector< VxTrackAtVertex > & myLinTracks ) const
private

Internal method, called by the two _fit internal functions, in order to perform the fit, after having initialized the input (constraint + seed).

The real fit happens here.

Definition at line 321 of file AdaptiveVertexFitter.cxx.

326 {
327
328 //now reset the annealing maker
330 m_AnnealingMaker->reset(astate);
331
332 //Count the steps for the fit and the number of relinearizations needed in the fit
333 int num_steps(0);
334
335
336 auto ActualVertex = std::make_unique<xAOD::Vertex>();
337 ActualVertex->makePrivateStore(); // xAOD::VertexContainer will take ownership of AuxStore when ActualVertex is added to it
338 ActualVertex->setPosition( ConstraintVertex.position() );
339 ActualVertex->setCovariancePosition( ConstraintVertex.covariancePosition() / m_AnnealingMaker->getWeight(astate, 1.) );
340 ActualVertex->setFitQuality( ConstraintVertex.chiSquared(), ConstraintVertex.numberDoF() );
341 ActualVertex->vxTrackAtVertex() = myLinTracks;
342 ActualVertex->setVertexType(xAOD::VxType::NotSpecified); // to mimic the initialization present in the old EDM constructor
343
344 Amg::Vector3D NewVertex = SeedVertex;
345
346 Amg::Vector3D ActualSeedPosition = SeedVertex;
347
348 if(msgLvl(MSG::VERBOSE))
349 {
350 msg(MSG::VERBOSE) << "Num max of steps is " << m_maxIterations << endmsg;
351 msg(MSG::VERBOSE) << "m_AnnealingMaker->isEquilibrium() is " << m_AnnealingMaker->isEquilibrium(astate) << endmsg;
352 }
353
354 std::vector<Trk::VxTrackAtVertex>::iterator lintracksBegin = ActualVertex->vxTrackAtVertex().begin();
355 std::vector<Trk::VxTrackAtVertex>::iterator lintracksEnd = ActualVertex->vxTrackAtVertex().end();
356
357 std::vector<Trk::VxTrackAtVertex>::iterator iter;
358
359 bool relinearization = false;
360
361 do {
362
363 ActualVertex->setPosition( ConstraintVertex.position() );
364 ActualVertex->setCovariancePosition( ConstraintVertex.covariancePosition() / m_AnnealingMaker->getWeight(astate, 1.) );
365 ActualVertex->setFitQuality( ConstraintVertex.chiSquared(), ConstraintVertex.numberDoF() );
366
367 if(msgLvl(MSG::DEBUG))
368 {
369 msg(MSG::DEBUG) << "Correction applied to constraint weight is: " << m_AnnealingMaker->getWeight(astate, 1.) << endmsg;
370 }
371
372 //To reweight here through an extrapolation is not ideal, but maybe I'll change this in the future...
373 if(msgLvl(MSG::DEBUG))
374 {
375 msg(MSG::DEBUG) << "New fit step: step number " << num_steps << endmsg;
376 }
377
378 //consider relinearization if you are too far away from the old lin point
379
380
381 relinearization=false;
382 if ( (ActualSeedPosition - SeedVertex).perp() > m_maxDistToLinPoint ) {
383 relinearization=true;
384 if(msgLvl(MSG::DEBUG))
385 {
386 msg(MSG::DEBUG) << "Actual vertex too far away from linearization point: have to linearize tracks again" << endmsg;
387 }
388
389 //collect all measured perigees
390
391 for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
392 //m_LinearizedTrackFactory->linearize(*iter,ActualPosition);
393 bool success=m_ImpactPoint3dEstimator->addIP3dAtaPlane(ctx,*iter,NewVertex);
394 if (!success)
395 {
396 msg(MSG::DEBUG) << "Adding compatibility to vertex information failed. Newton distance finder didn't converge..." << endmsg;
397 }
398 }
399
400 }
401
402
403 lintracksBegin=ActualVertex->vxTrackAtVertex().begin();
404 lintracksEnd=ActualVertex->vxTrackAtVertex().end();
405
406 //now reweight tracks (find chi2 compatibility with actual vertex position)
407 for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
408
409 //estimate the compatibility of the track to the vertex and store it in iter->linState()->m_vtxCompatibility
410 m_TrackCompatibilityEstimator->estimate(*iter,NewVertex);
411
412 //use the obtained estimate and ask the Annealing Maker what is the corresponding weight at the actual temperature step
413 iter->setWeight( m_AnnealingMaker->getWeight( astate, iter->vtxCompatibility() ) );
414 if(msgLvl(MSG::VERBOSE))
415 {
416 msg(MSG::VERBOSE) << "Before annealing: " << iter->vtxCompatibility() <<
417 " Annealing RESULT is:" << iter->weight() << " at T: " <<
418 m_AnnealingMaker->actualTemp(astate) << endmsg;
419 }
420
421
422 }
423
424 //now update with all the tracks info
425 for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
426 if(msgLvl(MSG::VERBOSE))
427 {
428 msg(MSG::VERBOSE) << "Updating vertex with a new track" << endmsg;
429 }
430 try {
431
432 if ( iter->weight() > 1e-3 ) {
433 //now take care if linearization has been done at least once
434 //or if vertex has changed so much so that you need relinearization!
435 if ( iter->linState() == nullptr) {
436 //linearization has not been done so far: do it now!
437 if(msgLvl(MSG::VERBOSE))
438 {
439 msg(MSG::VERBOSE) << "Linearizing track for the first time" << endmsg;
440 }
441
442 m_LinearizedTrackFactory->linearize( *iter, ActualVertex->position() );
443 ATH_MSG_DEBUG( "Linearized track to Seed Point. " << *iter );
444 } else if (relinearization) {
445 //do it again in case of updated vertex too far from previous one
446 if(msgLvl(MSG::VERBOSE))
447 {
448 msg(MSG::VERBOSE) << "Relinearizing track " << endmsg;
449 }
450
451 m_LinearizedTrackFactory->linearize( *iter, NewVertex );
452 ActualSeedPosition=NewVertex;
453 ATH_MSG_DEBUG("Linearized track to new seed Point " << NewVertex << ". " << *iter );
454 }
455 m_VertexUpdator->add(*ActualVertex.get(),*iter);
456 } else {
457 if(msgLvl(MSG::VERBOSE))
458 {
459 msg(MSG::VERBOSE) << "Weight lower than 1e-3, so the track will not be considered anymore" << endmsg;
460 }
461
462 }
463 } catch (...) {
464 msg(MSG::WARNING) << "You have just lost a track" << endmsg;
465 }
466 }
467
468 //show some info about the position
469 if(msgLvl(MSG::DEBUG))
470 {
471 msg(MSG::DEBUG) << "New position x: " << ActualVertex->position().x() << " y: " << ActualVertex->position().y()
472 << " z: " << ActualVertex->position().z() << endmsg;
473 }
474
475
476 NewVertex = ActualVertex->position();
477
478 //now go one step down in the annealing process (lower the temperature - single step)
479 if(msgLvl(MSG::VERBOSE))
480 {
481 msg(MSG::VERBOSE) << "Now calling one step of annealing" << endmsg;
482 }
483
484 m_AnnealingMaker->anneal(astate);
485 num_steps+=1;
486
487 //continue to fit until max iteration number has been reached or "thermal equilibrium"
488 //has been obtained in the annealing process
489
490 } while (num_steps<m_maxIterations && !(m_AnnealingMaker->isEquilibrium(astate)) );
491
492 //Here smooth the vertex (refitting of the track)
493
494 //without smoothing... for the moment...
495 if(m_doSmoothing) {
496 m_VertexSmoother->smooth(*ActualVertex);
497 } else {
498 for (iter=lintracksBegin;iter!=lintracksEnd;++iter) {
499 // const MeasuredPerigee* castToMP=dynamic_cast<const MeasuredPerigee*>(iter->initialPerigee());
500 // if (castToMP==0) {
501 // msg(MSG::WARNING) << "Couldn't cast a track to MeasuredPerigee to smooth it. Neutrals not supported. " <<
502 // " Skipping track. .. " << endmsg;
503 // continue;
504 // }
505 if ( iter->initialPerigee() )
506 iter->setPerigeeAtVertex( ( iter->initialPerigee() )->clone() );
507 else if ( iter->initialNeutralPerigee() )
508 iter->setPerigeeAtVertex( ( iter->initialNeutralPerigee() )->clone() );
509 }
510 }
511
512 if(msgLvl(MSG::DEBUG))
513 {
514 msg(MSG::DEBUG) << "chi2: " << ActualVertex->chiSquared()
515 << "the ndf of the vertex is at fit end: " << ActualVertex->numberDoF() << endmsg;
516 }
517
518
519 //Give back all info into the ActualVertex xAOD::Vertex
520 return ActualVertex;
521 }
Scalar perp() const
perp method - perpendicular length
ToolHandle< Trk::IVertexTrackCompatibilityEstimator > m_TrackCompatibilityEstimator
ToolHandle< Trk::IVertexSmoother > m_VertexSmoother
ToolHandle< Trk::IVertexAnnealingMaker > m_AnnealingMaker
ToolHandle< Trk::IVertexUpdator > m_VertexUpdator
ToolHandle< Trk::IVertexLinearizedTrackFactory > m_LinearizedTrackFactory
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
float chiSquared() const
Returns the of the vertex fit as float.
@ NotSpecified
Default value, no explicit type set.

◆ fit() [1/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::Track * > & Vectortrk,
const xAOD::Vertex & constraint,
const Amg::Vector3D & startingPoint ) const

fit providing vector of tracks, constraint and startingPoint

◆ fit() [2/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList ) const
override

Definition at line 596 of file AdaptiveVertexFitter.cxx.

599 {
600 const std::vector<const Trk::NeutralParameters*> neutralPerigeeList;
601 return fit(ctx,perigeeList,neutralPerigeeList);
602 }
virtual std::unique_ptr< xAOD::Vertex > fit(const EventContext &ctx, const std::vector< const xAOD::TrackParticle * > &vectorTrk, const std::vector< const xAOD::NeutralParticle * > &vectorNeut, const Amg::Vector3D &startingPoint) const override
Interface for xAOD::TrackParticle with starting point.

◆ fit() [3/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const Amg::Vector3D & startingPoint ) const
overridevirtual

Definition at line 565 of file AdaptiveVertexFitter.cxx.

569 {
570 const std::vector<const Trk::NeutralParameters*> neutralPerigeeList;
571 return fit(ctx, perigeeList, neutralPerigeeList, startingPoint);
572 }

◆ fit() [4/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const std::vector< const Trk::NeutralParameters * > & neutralPerigeeList ) const
override

fit providing vector of TrackParameters and NeutralParameters

Definition at line 556 of file AdaptiveVertexFitter.cxx.

560 {
561 return _fit(ctx,perigeeList,neutralPerigeeList,xAOD::Vertex(),Amg::Vector3D(),false,false);
562 }

◆ fit() [5/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const std::vector< const Trk::NeutralParameters * > & neutralPerigeeList,
const Amg::Vector3D & startingPoint ) const
overridevirtual

Interface for MeasuredPerigee with starting point.

Definition at line 524 of file AdaptiveVertexFitter.cxx.

529 {
530
531 return _fit(ctx,perigeeList,neutralPerigeeList,xAOD::Vertex(),startingPoint,false,true);
532 }

◆ fit() [6/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const std::vector< const Trk::NeutralParameters * > & neutralPerigeeList,
const xAOD::Vertex & constraint ) const
overridevirtual

Interface for MeasuredPerigee with vertex constraint.

Definition at line 535 of file AdaptiveVertexFitter.cxx.

540 {
541 return _fit(ctx,perigeeList,neutralPerigeeList,constraint,Amg::Vector3D::Zero(),true);
542 }

◆ fit() [7/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const std::vector< const Trk::NeutralParameters * > & neutralPerigeeList,
const xAOD::Vertex & constraint,
const Amg::Vector3D & startingPoint ) const

fit providing vector of ParametersBase, constraint and startingPoint

Definition at line 545 of file AdaptiveVertexFitter.cxx.

551 {
552 return _fit(ctx,perigeeList,neutralPerigeeList,constraint,startingPoint,true,true);
553 }

◆ fit() [8/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const xAOD::Vertex & constraint ) const
overridevirtual

Definition at line 575 of file AdaptiveVertexFitter.cxx.

579 {
580 const std::vector<const Trk::NeutralParameters*> neutralPerigeeList;
581 return fit(ctx, perigeeList, neutralPerigeeList, constraint);
582 }

◆ fit() [9/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParameters * > & perigeeList,
const xAOD::Vertex & constraint,
const Amg::Vector3D & startingPoint ) const

Definition at line 585 of file AdaptiveVertexFitter.cxx.

590 {
591 const std::vector<const Trk::NeutralParameters*> neutralPerigeeList;
592 return fit(ctx, perigeeList, neutralPerigeeList, constraint, startingPoint);
593 }

◆ fit() [10/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const Trk::TrackParticleBase * > & perigeeList ) const

fit providing vector of TrackParticleBase

◆ fit() [11/14]

virtual std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const xAOD::TrackParticle * > & vectorTrk,
const Amg::Vector3D & startingPoint ) const
inlineoverridevirtual

Definition at line 117 of file AdaptiveVertexFitter.h.

120 {
121 return fit(ctx, vectorTrk, std::vector<const xAOD::NeutralParticle*>(), startingPoint);
122 };

◆ fit() [12/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const xAOD::TrackParticle * > & vectorTrk,
const std::vector< const xAOD::NeutralParticle * > & vectorNeut,
const Amg::Vector3D & startingPoint ) const
overridevirtual

Interface for xAOD::TrackParticle with starting point.

Definition at line 621 of file AdaptiveVertexFitter.cxx.

626 {
627
628 if (vectorTrk.empty()) {
629 msg(MSG::INFO) << "Empty vector of tracks passed" << endmsg;
630 return nullptr;
631 }
632
633 if (vectorNeut.empty()) {
634 msg(MSG::VERBOSE) << "Empty vector of neutrals passed" << endmsg;
635 }
636
637 // making a list of perigee out of the vector of tracks
638 std::vector<const Trk::TrackParameters*> measuredPerigees;
639
640 for (const auto *i : vectorTrk) {
641 const Trk::TrackParameters* tmpMeasPer = &(i->perigeeParameters());
642
643 if (tmpMeasPer != nullptr)
644 measuredPerigees.push_back(tmpMeasPer);
645 else
646 msg(MSG::INFO)
647 << "Failed to dynamic_cast this track parameters to perigee"
648 << endmsg; // TODO: Failed to implicit cast the perigee parameters to
649 // track parameters?
650 }
651
652 // making a list of perigee out of the vector of neutrals
653 std::vector<const Trk::NeutralParameters*> measuredNeutralPerigees;
654
655 for (const auto *i : vectorNeut) {
656 const Trk::NeutralParameters* tmpMeasPer = &(i->perigeeParameters());
657
658 if (tmpMeasPer != nullptr)
659 measuredNeutralPerigees.push_back(tmpMeasPer);
660 else
661 msg(MSG::INFO)
662 << "Failed to dynamic_cast this neutral parameters to perigee"
663 << endmsg; // TODO: Failed to implicit cast the perigee parameters to
664 // neutral parameters?
665 }
666
667 std::unique_ptr<xAOD::Vertex> fittedVertex = _fit(
668 ctx,
669 measuredPerigees,
670 measuredNeutralPerigees,
671 xAOD::Vertex(),
672 startingPoint,
673 false,
674 true);
675
676 // assigning the input tracks to the fitted vertex through VxTrackAtVertices
677 if (fittedVertex == nullptr) {
678 return fittedVertex;
679 }
680
681 if (fittedVertex
682 ->vxTrackAtVertexAvailable()) // TODO: I don't think
683 // vxTrackAtVertexAvailable() does the
684 // same thing as a null pointer check!
685 {
686 if (!fittedVertex->vxTrackAtVertex().empty()) {
687 for (unsigned int i = 0; i < vectorTrk.size(); ++i) {
688
689 LinkToXAODTrackParticle* linkTT = new LinkToXAODTrackParticle();
690 const xAOD::TrackParticleContainer* cont =
691 dynamic_cast<const xAOD::TrackParticleContainer*>(
692 vectorTrk[i]->container());
693 if (cont) {
694 if (!linkTT->toIndexedElement(*cont, vectorTrk[i]->index())) {
695 msg(MSG::WARNING)
696 << "Failed to set the EL for this particle correctly" << endmsg;
697 }
698 } else {
699 msg(MSG::WARNING)
700 << "Failed to identify a container for this TP" << endmsg;
701 } // end of the dynamic cast check
702
703 // vxtrackatvertex takes ownership!
704 (fittedVertex->vxTrackAtVertex())[i].setOrigTrack(linkTT);
705 } // end of loop for setting orig tracks in.
706
707 for (unsigned int i = 0; i < vectorNeut.size(); ++i) {
708 LinkToXAODNeutralParticle* linkTT = new LinkToXAODNeutralParticle();
710 dynamic_cast<const xAOD::NeutralParticleContainer*>(
711 vectorNeut[i]->container());
712 if (cont) {
713 if (!linkTT->toIndexedElement(*cont, vectorNeut[i]->index())) {
714 msg(MSG::WARNING)
715 << "Failed to set the EL for this particle correctly" << endmsg;
716 }
717 } else {
718 msg(MSG::WARNING)
719 << "Failed to identify a container for this TP" << endmsg;
720 } // end of the dynamic cast check
721
722 // vxtrackatvertex takes ownership!
723 (fittedVertex->vxTrackAtVertex())[i + vectorTrk.size()].setOrigTrack(
724 linkTT);
725 } // end of loop for setting orig neutrals in.
726
727 } // end of protection against unsuccessfull updates (no tracks were
728 // added)
729 } // end of vector of tracks check
730
731 // now set links to xAOD::TrackParticles directly in the xAOD::Vertex
732 unsigned int VTAVsize = fittedVertex->vxTrackAtVertex().size();
733 for (unsigned int i = 0; i < VTAVsize; ++i) {
734 Trk::VxTrackAtVertex* VTAV = &(fittedVertex->vxTrackAtVertex().at(i));
735 // TODO: Will this pointer really hold 0 if no VxTrackAtVertex is found?
736 if (not VTAV) {
737 ATH_MSG_WARNING(" Trying to set link to xAOD::TrackParticle. The "
738 "VxTrackAtVertex is not found");
739 continue;
740 }
741
742 Trk::ITrackLink* trklink = VTAV->trackOrParticleLink();
743
744 // See if the trklink is to an xAOD::TrackParticle
745 Trk::LinkToXAODTrackParticle* linkToXAODTP =
746 dynamic_cast<Trk::LinkToXAODTrackParticle*>(trklink);
747 if (linkToXAODTP) {
748
749 // Now set the new link to the xAOD vertex
750 fittedVertex->addTrackAtVertex(*linkToXAODTP, VTAV->weight());
751
752 } else {
753
754 // See if the trklink is to an xAOD::NeutralParticle
755 Trk::LinkToXAODNeutralParticle* linkToXAODTPneutral =
756 dynamic_cast<Trk::LinkToXAODNeutralParticle*>(trklink);
757 if (!linkToXAODTPneutral) {
759 "Skipping track. Trying to set link to something else than "
760 "xAOD::TrackParticle or xAOD::NeutralParticle.");
761 } else {
762 // Now set the newlink to the new xAOD vertex
763 fittedVertex->addNeutralAtVertex(*linkToXAODTPneutral,
764 VTAV->weight());
765 }
766 }
767 } // end of loop
768
769 return fittedVertex;
770
771 }//end of the xAOD starting point fit method
#define ATH_MSG_WARNING(x)
mapped_type at(key_type key) const
Look up an element in the map.
ParametersBase< NeutralParametersDim, Neutral > NeutralParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
NeutralParticleContainer_v1 NeutralParticleContainer
Definition of the current "NeutralParticle container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

◆ fit() [13/14]

std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const xAOD::TrackParticle * > & vectorTrk,
const std::vector< const xAOD::NeutralParticle * > & vectorNeut,
const xAOD::Vertex & constraint ) const
overridevirtual

Interface for xAOD::TrackParticle with vertex constraint the position of the constraint is ALWAYS the starting point.

Definition at line 774 of file AdaptiveVertexFitter.cxx.

779 {
780
781 if(vectorTrk.empty())
782 {
783 msg(MSG::INFO)<<"Empty vector of tracks passed"<<endmsg;
784 return nullptr;
785 }
786
787 if(vectorNeut.empty())
788 {
789 msg(MSG::INFO)<<"Empty vector of neutrals passed"<<endmsg;
790 }
791
792 //making a list of perigee out of the vector of tracks
793 std::vector<const Trk::TrackParameters*> measuredPerigees;
794
795 for(const auto *i : vectorTrk)
796 {
797 const Trk::TrackParameters * tmpMeasPer = &(i->perigeeParameters());
798
799 if(tmpMeasPer!=nullptr) measuredPerigees.push_back(tmpMeasPer);
800 else msg(MSG::INFO)<<"Failed to dynamic_cast this track parameters to perigee"<<endmsg; //TODO: Failed to implicit cast the perigee parameters to track parameters?
801 }
802
803 //making a list of perigee out of the vector of neutrals
804 std::vector<const Trk::NeutralParameters*> measuredNeutralPerigees;
805
806 for(const auto *i : vectorNeut)
807 {
808 const Trk::NeutralParameters * tmpMeasPer = &(i->perigeeParameters());
809
810 if(tmpMeasPer!=nullptr) measuredNeutralPerigees.push_back(tmpMeasPer);
811 else msg(MSG::INFO)<<"Failed to dynamic_cast this neutral parameters to perigee"<<endmsg; //TODO: Failed to implicit cast the perigee parameters to neutral parameters?
812 }
813
814
815 std::unique_ptr<xAOD::Vertex> fittedVertex = _fit(ctx, measuredPerigees, measuredNeutralPerigees, constraint, Amg::Vector3D(),true);
816
817
818 //assigning the input tracks to the fitted vertex through VxTrackAtVertices
819 {
820 if( fittedVertex->vxTrackAtVertexAvailable() ) // TODO: I don't think vxTrackAtVertexAvailable() does the same thing as a null pointer check
821 {
822 if(!fittedVertex->vxTrackAtVertex().empty())
823 {
824 for(unsigned int i = 0; i <vectorTrk.size(); ++i)
825 {
826
827 LinkToXAODTrackParticle* linkTT = new LinkToXAODTrackParticle();
828 const xAOD::TrackParticleContainer* cont = dynamic_cast< const xAOD::TrackParticleContainer* >( vectorTrk[ i ]->container() );
829 if( cont )
830 {
831 if( ! linkTT->toIndexedElement( *cont, vectorTrk[ i ]->index() ) )
832 {
833 msg(MSG::WARNING)<<"Failed to set the EL for this particle correctly"<<endmsg;
834 }
835 } else {
836 msg(MSG::WARNING)<<"Failed to identify a container for this TP"<<endmsg;
837 }//end of the dynamic cast check
838
839
840 // vxtrackatvertex takes ownership!
841 ( fittedVertex->vxTrackAtVertex() )[i].setOrigTrack(linkTT);
842 }//end of loop for setting orig tracks in.
843
844 for(unsigned int i = 0; i <vectorNeut.size(); ++i)
845 {
846 LinkToXAODNeutralParticle* linkTT = new LinkToXAODNeutralParticle();
847 const xAOD::NeutralParticleContainer* cont = dynamic_cast< const xAOD::NeutralParticleContainer* >( vectorNeut[ i ]->container() );
848 if( cont )
849 {
850 if( ! linkTT->toIndexedElement( *cont, vectorNeut[ i ]->index() ) )
851 {
852 msg(MSG::WARNING)<<"Failed to set the EL for this particle correctly"<<endmsg;
853 }
854 } else {
855 msg(MSG::WARNING)<<"Failed to identify a container for this NP"<<endmsg;
856 }//end of the dynamic cast check
857
858 // vxtrackatvertex takes ownership!
859 ( fittedVertex->vxTrackAtVertex() )[vectorTrk.size()+i].setOrigTrack(linkTT);
860 }//end of loop for setting orig neutrals in.
861
862 }//end of protection against unsuccessfull updates (no tracks were added)
863 }//end of vector of tracks check
864 }
865
866
867 //now set links to xAOD::TrackParticles directly in the xAOD::Vertex
868 unsigned int VTAVsize = fittedVertex->vxTrackAtVertex().size();
869 for (unsigned int i = 0 ; i < VTAVsize ; ++i)
870 {
871 Trk::VxTrackAtVertex* VTAV = &( fittedVertex->vxTrackAtVertex().at(i) );
872 //TODO: Will this pointer really hold 0 if no VxTrackAtVertex is found?
873 if (not VTAV){
874 ATH_MSG_WARNING (" Trying to set link to xAOD::TrackParticle. The VxTrackAtVertex is not found");
875 continue;
876 }
877
878 Trk::ITrackLink* trklink = VTAV->trackOrParticleLink();
879
880 // See if the trklink is to an xAOD::TrackParticle
881 Trk::LinkToXAODTrackParticle* linkToXAODTP = dynamic_cast<Trk::LinkToXAODTrackParticle*>(trklink);
882 if (linkToXAODTP)
883 {
884
885 //Now set the new link to the xAOD vertex
886 fittedVertex->addTrackAtVertex(*linkToXAODTP, VTAV->weight());
887
888 } else {
889
890 // See if the trklink is to an xAOD::NeutralParticle
891 Trk::LinkToXAODNeutralParticle* linkToXAODTPneutral = dynamic_cast<Trk::LinkToXAODNeutralParticle*>(trklink);
892 if (!linkToXAODTPneutral) {
893 ATH_MSG_WARNING ("Skipping track. Trying to set link to something else than xAOD::TrackParticle or xAOD::NeutralParticle.");
894 } else {
895 //Now set the new link to the new xAOD vertex
896 fittedVertex->addNeutralAtVertex(*linkToXAODTPneutral, VTAV->weight());
897 }
898
899 }
900 } //end of loop
901
902 return fittedVertex;
903
904 }//end of the xAOD constrained fit method

◆ fit() [14/14]

virtual std::unique_ptr< xAOD::Vertex > Trk::AdaptiveVertexFitter::fit ( const EventContext & ctx,
const std::vector< const xAOD::TrackParticle * > & vectorTrk,
const xAOD::Vertex & constraint ) const
inlineoverridevirtual

Definition at line 132 of file AdaptiveVertexFitter.h.

135 {
136 return fit(ctx, vectorTrk, std::vector<const xAOD::NeutralParticle*>(), constraint);
137 };

◆ initialize()

StatusCode Trk::AdaptiveVertexFitter::initialize ( )
overridevirtual

Definition at line 47 of file AdaptiveVertexFitter.cxx.

48 {
49 StatusCode s = AlgTool::initialize();
50 if (s.isFailure())
51 {
52 msg(MSG::FATAL) << "AlgTool::initialize() failed" << endmsg;
53 return StatusCode::FAILURE;
54 }
55 if ( m_SeedFinder.retrieve().isFailure() ) {
56 msg(MSG::FATAL) << "Failed to retrieve tool " << m_SeedFinder << endmsg;
57 return StatusCode::FAILURE;
58 }
59 msg(MSG::INFO) << "Retrieved tool " << m_SeedFinder << endmsg;
60
61
62 if ( m_LinearizedTrackFactory.retrieve().isFailure() ) {
63 msg(MSG::FATAL) << "Failed to retrieve tool " << m_LinearizedTrackFactory << endmsg;
64 return StatusCode::FAILURE;
65 }
66 msg(MSG::INFO) << "Retrieved tool " << m_LinearizedTrackFactory << endmsg;
67
68
69 if ( m_TrackCompatibilityEstimator.retrieve().isFailure() ) {
70 msg(MSG::FATAL) << "Failed to retrieve tool " << m_TrackCompatibilityEstimator << endmsg;
71 return StatusCode::FAILURE;
72 }
73 msg(MSG::INFO) << "Retrieved tool " << m_TrackCompatibilityEstimator << endmsg;
74
75
76 if ( m_ImpactPoint3dEstimator.retrieve().isFailure() ) {
77 msg(MSG::FATAL) << "Failed to retrieve tool " << m_ImpactPoint3dEstimator << endmsg;
78 return StatusCode::FAILURE;
79 }
80 msg(MSG::INFO) << "Retrieved tool " << m_ImpactPoint3dEstimator << endmsg;
81
82
83 if ( m_VertexUpdator.retrieve().isFailure() ) {
84 msg(MSG::FATAL) << "Failed to retrieve tool " << m_VertexUpdator << endmsg;
85 return StatusCode::FAILURE;
86 }
87 msg(MSG::INFO) << "Retrieved tool " << m_VertexUpdator << endmsg;
88
89
90 //loading smoother in case required
92 {
93 if ( m_VertexSmoother.retrieve().isFailure() ) {
94 msg(MSG::FATAL) << "Failed to retrieve tool " << m_VertexSmoother << endmsg;
95 return StatusCode::FAILURE;
96 }
97 msg(MSG::INFO) << "Retrieved tool " << m_VertexSmoother << endmsg;
98
99 }//end of smoothing options
100
101 if ( m_AnnealingMaker.retrieve().isFailure() ) {
102 msg(MSG::FATAL) << "Failed to retrieve tool " << m_AnnealingMaker << endmsg;
103 return StatusCode::FAILURE;
104 }
105 msg(MSG::INFO) << "Retrieved tool " << m_AnnealingMaker << endmsg;
106
107
108 return StatusCode::SUCCESS;
109 }
::StatusCode StatusCode
StatusCode definition for legacy code.

Member Data Documentation

◆ m_AnnealingMaker

ToolHandle<Trk::IVertexAnnealingMaker> Trk::AdaptiveVertexFitter::m_AnnealingMaker
private
Initial value:
{
this,
"AnnealingMaker",
"Trk::DetAnnealingMaker"
}

Definition at line 274 of file AdaptiveVertexFitter.h.

274 {
275 this,
276 "AnnealingMaker",
277 "Trk::DetAnnealingMaker"
278 };

◆ m_doSmoothing

bool Trk::AdaptiveVertexFitter::m_doSmoothing
private

True if smoothing after fit iterations has to be performed: otherwise the Smoother AlgoTool provided to the fitter will be ignored.

Definition at line 314 of file AdaptiveVertexFitter.h.

◆ m_ImpactPoint3dEstimator

ToolHandle<Trk::IImpactPoint3dEstimator> Trk::AdaptiveVertexFitter::m_ImpactPoint3dEstimator
private
Initial value:
{
this,
"ImpactPoint3dEstimator",
"Trk::ImpactPoint3dEstimator/ImpactPoint3dEstimator"
}

Definition at line 261 of file AdaptiveVertexFitter.h.

261 {
262 this,
263 "ImpactPoint3dEstimator",
264 "Trk::ImpactPoint3dEstimator/ImpactPoint3dEstimator"
265 };

◆ m_initialError

double Trk::AdaptiveVertexFitter::m_initialError
private

Initial error in form of diagonal elements of the inverse of the covariance matrix (name is misleading: take the error, square it and initialize the variable with its inverse).

Definition at line 299 of file AdaptiveVertexFitter.h.

◆ m_LinearizedTrackFactory

ToolHandle<Trk::IVertexLinearizedTrackFactory> Trk::AdaptiveVertexFitter::m_LinearizedTrackFactory
private
Initial value:
{
this,
"LinearizedTrackFactory",
"Trk::FullLinearizedTrackFactory"
}

Definition at line 252 of file AdaptiveVertexFitter.h.

252 {
253 this,
254 "LinearizedTrackFactory",
255 "Trk::FullLinearizedTrackFactory"
256 };

◆ m_maxDistToLinPoint

double Trk::AdaptiveVertexFitter::m_maxDistToLinPoint
private

Maximum distance of linearization point of track to actual fitted vertex before needing to relinearize (in mm).

Definition at line 291 of file AdaptiveVertexFitter.h.

◆ m_maxIterations

long int Trk::AdaptiveVertexFitter::m_maxIterations
private

Number of maximum iterations.

Definition at line 284 of file AdaptiveVertexFitter.h.

◆ m_onlyzseed

bool Trk::AdaptiveVertexFitter::m_onlyzseed
private

Variable is true if seeding has to be performed only on the z direction.

In this case, as a guess of the initial position in the transverse plane, the x and y position of the beam spot are used.

Definition at line 307 of file AdaptiveVertexFitter.h.

◆ m_SeedFinder

ToolHandle<Trk::IVertexSeedFinder> Trk::AdaptiveVertexFitter::m_SeedFinder
private
Initial value:
{
this,
"SeedFinder",
"Trk::CrossDistancesSeedFinder"
}

Definition at line 247 of file AdaptiveVertexFitter.h.

247 {
248 this,
249 "SeedFinder",
250 "Trk::CrossDistancesSeedFinder"
251 };

◆ m_TrackCompatibilityEstimator

ToolHandle<Trk::IVertexTrackCompatibilityEstimator> Trk::AdaptiveVertexFitter::m_TrackCompatibilityEstimator
private
Initial value:
{ this,
"TrackCompatibilityEstimato",
"Trk::Chi2TrackCompatibilityEstimator" }

Definition at line 258 of file AdaptiveVertexFitter.h.

258 { this,
259 "TrackCompatibilityEstimato",
260 "Trk::Chi2TrackCompatibilityEstimator" };

◆ m_VertexSmoother

ToolHandle<Trk::IVertexSmoother> Trk::AdaptiveVertexFitter::m_VertexSmoother
private
Initial value:
{
this,
"VertexSmoother",
"Trk::DummyVertexSmoother"
}

Definition at line 269 of file AdaptiveVertexFitter.h.

269 {
270 this,
271 "VertexSmoother",
272 "Trk::DummyVertexSmoother"
273 };

◆ m_VertexUpdator

ToolHandle<Trk::IVertexUpdator> Trk::AdaptiveVertexFitter::m_VertexUpdator
private
Initial value:
{ this,
"VertexUpdator",
"Trk::KalmanVertexUpdator" }

Definition at line 266 of file AdaptiveVertexFitter.h.

266 { this,
267 "VertexUpdator",
268 "Trk::KalmanVertexUpdator" };

The documentation for this class was generated from the following files: