260{
261 using namespace Acts::UnitLiterals;
262
263 const InDet::BeamSpotData* beamSpotHandle{};
265 return {};
266 }
267 const Acts::Vector3& beamSpotPos = beamSpotHandle->
beamVtx().
position();
268 Acts::Vertex beamSpotConstraintVtx(beamSpotPos);
269 beamSpotConstraintVtx.setCovariance(beamSpotHandle->
beamVtx().covariancePosition());
270
271
272 const Acts::MagneticFieldContext magFieldContext =
m_ctxProvider.getMagneticFieldContext(ctx);
273 const Acts::GeometryContext geoContext =
m_ctxProvider.getGeometryContext(ctx);
274
275
278 theVertexContainer->setStore(theVertexAuxContainer);
279
280 if(trackVector.empty()){
282 theVertexContainer->
push_back(dummyxAODVertex);
286
287 return std::make_pair(theVertexContainer, theVertexAuxContainer);
288 }
289
290 std::shared_ptr<Acts::PerigeeSurface> perigeeSurface =
291 Acts::Surface::makeShared<Acts::PerigeeSurface>(
293
294
295 std::vector<TrackWrapper> allTracks;
296
297 for (const auto& trk : trackVector) {
298 const auto& trkParams = trk->parameters();
299 const auto&
params = trkParams->parameters();
300
301 Acts::BoundVector actsParams;
303
304 if(trkParams->covariance() == nullptr){
305 continue;
306 }
307
308 auto cov = *(trkParams->covariance());
309
310
311
312
313 Acts::BoundMatrix covMat;
314 covMat <<
cov(0,0) ,
cov(0,1) ,
cov(0,2) ,
cov(0,3) ,
cov(0,4) *1./(1_MeV), 0
315 ,
cov(1,0) ,
cov(1,1) ,
cov(1,2) ,
cov(1,3) ,
cov(1,4) *1./(1_MeV) , 0
316 ,
cov(2,0) ,
cov(2,1) ,
cov(2,2) ,
cov(2,3) ,
cov(2,4) *1./(1_MeV) , 0
317 ,
cov(3,0) ,
cov(3,1) ,
cov(3,2) ,
cov(3,3) ,
cov(3,4) *1./(1_MeV) , 0
318 ,
cov(4,0) *1./(1_MeV) ,
cov(4,1) *1./(1_MeV) ,
cov(4,2) *1./(1_MeV) ,
cov(4,3) *1./(1_MeV) ,
cov(4,4) *1./(1_MeV*1_MeV), 0
319 , 0. , 0. , 0. , 0., 0., 1.;
320
321 allTracks.emplace_back(trk.get(),Acts::BoundTrackParameters(perigeeSurface, actsParams, covMat, Acts::ParticleHypothesis::pion()));
322 }
323
324 std::vector<Acts::InputTrack> allTrackPtrs;
325 allTrackPtrs.reserve(allTracks.size());
326
327 for(const auto& trk : allTracks){
328 allTrackPtrs.emplace_back(&trk);
329 }
330
331 Acts::VertexingOptions vertexingOptions( geoContext, magFieldContext );
332
334 beamSpotConstraintVtx.setPosition(Acts::Vector3::Zero());
336 looseConstraintCovariance.setIdentity();
337 looseConstraintCovariance = looseConstraintCovariance * 1
e+8;
338 beamSpotConstraintVtx.setCovariance(looseConstraintCovariance);
339 }
340
342 vertexingOptions.constraint = std::move(beamSpotConstraintVtx);
343
345
346 auto findResult =
m_vertexFinder->find(allTrackPtrs, vertexingOptions, finderState);
347
348 if(!findResult.ok()){
350 theVertexContainer->
push_back(dummyxAODVertex);
354 return std::make_pair(theVertexContainer, theVertexAuxContainer);
355 }
356
357 std::vector<Acts::Vertex> allVertices = *findResult;
358
359 std::vector<VertexAndSignalComp> vtxList;
360
361
362 vtxList.reserve(allVertices.size());
363
364 for(const auto& vtx : allVertices){
365
366 if(vtx.covariance()(0,0)<0||vtx.covariance()(1,1)<0||vtx.covariance()(2,2)<0)
367 continue;
369 xAODVtx->makePrivateStore();
372 xAODVtx->
setFitQuality(vtx.fitQuality().first, vtx.fitQuality().second);
373
374 const auto& tracks = vtx.tracks();
375 std::vector<Trk::VxTrackAtVertex>* trkAtVtxVec = &(xAODVtx->
vxTrackAtVertex());
376 for(const auto& trk : tracks){
377
378
383 continue;
384 }
385
386 const TrackWrapper* originalParams = trk.originalParams.template as<TrackWrapper>();
387
389 Trk::VxTrackAtVertex trkAtVtx(originalParams->trackLink()->clone());
390 trkAtVtx.setPerigeeAtVertex(fittedPerigee);
391 trkAtVtx.setTrackQuality(Trk::FitQuality(trk.chi2Track, trk.ndf));
392 trkAtVtx.setVtxCompatibility(trk.vertexCompatibility);
393 trkAtVtx.setWeight(trk.trackWeight);
394 trkAtVtxVec->push_back(std::move(trkAtVtx));
395
396 const Trk::LinkToXAODTrackParticle* linkToXAODTP =
397 dynamic_cast<const Trk::LinkToXAODTrackParticle*>(originalParams->trackLink());
398 if (linkToXAODTP) {
400 }
401 }
402
404
405 VertexAndSignalComp vertexAndSig(xAODVtx, sigComp);
406 auto it = std::lower_bound( vtxList.begin(), vtxList.end(), vertexAndSig );
407 vtxList.insert( it, vertexAndSig );
408 }
409
410 for(
unsigned int i = 0;
i < vtxList.size();
i++){
411 auto vtx = vtxList[
i].first;
413 if(i == 0){
415 }
416 else{
418 }
419 }
420
421
423 theVertexContainer->
push_back(dummyxAODVertex);
424
425 if(!vtxList.empty()){
426
431 }
432 else{
436 }
437
438 return std::make_pair(theVertexContainer, theVertexAuxContainer);
439}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const T * front() const
Access the first element in the collection as an rvalue.
const Trk::RecVertex & beamVtx() const noexcept
const Amg::Vector3D & position() const
return position of vertex
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
void addTrackAtVertex(const ElementLink< TrackParticleContainer > &tr, float weight=1.0)
Add a new track to the vertex.
void setVertexType(VxType::VertexType vType)
Set the type of the vertex.
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, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Amg::Isometry3D toIsometry3D(const Isometry3D &iso)
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.