208 using namespace Acts::UnitLiterals;
216 theVertexContainer->setStore(theVertexAuxContainer);
222 <<
"), skipping vertexing and returning only dummy...");
226 dummyxAODVertex->
setPosition(beamSpotHandle->beamVtx().position());
228 beamSpotHandle->beamVtx().covariancePosition());
229 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
231 return std::make_pair(theVertexContainer, theVertexAuxContainer);
234 const Acts::Vector3& beamSpotPos = beamSpotHandle->beamVtx().position();
236 beamSpotConstraintVtx.setCovariance(beamSpotHandle->beamVtx().covariancePosition());
238 std::shared_ptr<Acts::PerigeeSurface> perigeeSurface =
239 Acts::Surface::makeShared<Acts::PerigeeSurface>((trackVector[0])->
parameters()->associatedSurface().
transform());
242 Acts::MagneticFieldContext magFieldContext =
m_extrapolationTool->getMagneticFieldContext(ctx);
244 const auto& geoContext
248 std::vector<TrackWrapper> allTracks;
250 for (
const auto& trk : trackVector) {
252 const auto& trkParams = trk->parameters();
253 const auto&
params = trkParams->parameters();
255 Acts::BoundVector actsParams;
258 if(trkParams->covariance() ==
nullptr){
261 auto cov = *(trkParams->covariance());
266 Acts::BoundSquareMatrix covMat;
267 covMat <<
cov(0,0) ,
cov(0,1) ,
cov(0,2) ,
cov(0,3) ,
cov(0,4) *1./(1_MeV), 0
268 ,
cov(1,0) ,
cov(1,1) ,
cov(1,2) ,
cov(1,3) ,
cov(1,4) *1./(1_MeV) , 0
269 ,
cov(2,0) ,
cov(2,1) ,
cov(2,2) ,
cov(2,3) ,
cov(2,4) *1./(1_MeV) , 0
270 ,
cov(3,0) ,
cov(3,1) ,
cov(3,2) ,
cov(3,3) ,
cov(3,4) *1./(1_MeV) , 0
271 ,
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
272 , 0. , 0. , 0. , 0., 0., 1.;
277 std::vector<Acts::InputTrack> allTrackPtrs;
278 allTrackPtrs.reserve(allTracks.size());
280 for(
const auto& trk : allTracks){
281 allTrackPtrs.emplace_back(&trk);
284 Acts::VertexingOptions vertexingOptions(geoContext,
294 Acts::Vector4 vtxConstraintPos;
295 Acts::SquareMatrix4 vtxConstraintCov;
297 auto beamSpotCov = beamSpotHandle->beamVtx().covariancePosition();
299 vtxConstraintPos << beamSpotPos(0), beamSpotPos(1), beamSpotPos(2), 0.;
300 vtxConstraintCov << beamSpotCov(0,0), beamSpotCov(0,1), beamSpotCov(0,2), 0.
301 , beamSpotCov(1,0), beamSpotCov(1,1), beamSpotCov(1,2), 0.
302 , beamSpotCov(2,0), beamSpotCov(2,1), beamSpotCov(2,2), 0.
305 vertexingOptions.constraint.setFullPosition(vtxConstraintPos);
306 vertexingOptions.constraint.setFullCovariance(vtxConstraintCov);
310 auto findResult =
m_vertexFinder->find(allTrackPtrs, vertexingOptions, finderState);
312 if(!findResult.ok()){
314 theVertexContainer->
push_back(dummyxAODVertex);
315 dummyxAODVertex->
setPosition(beamSpotHandle->beamVtx().position());
317 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
320 return std::make_pair(theVertexContainer, theVertexAuxContainer);
323 std::vector<Acts::Vertex> allVertices = *findResult;
325 for(
const auto& vtx : allVertices){
330 xAODVtx->
setFitQuality(vtx.fitQuality().first, vtx.fitQuality().second);
332 const auto& tracks = vtx.tracks();
333 std::vector<Trk::VxTrackAtVertex>* trkAtVtxVec = &(xAODVtx->
vxTrackAtVertex());
334 for(
const auto& trk : tracks){
338 const TrackWrapper* originalParams = trk.originalParams.template as<TrackWrapper>();
342 trkAtVtx.setPerigeeAtVertex(fittedPerigee);
344 trkAtVtx.setVtxCompatibility(trk.vertexCompatibility);
345 trkAtVtx.setWeight(trk.trackWeight);
346 trkAtVtxVec->push_back(trkAtVtx);
359 if (!theVertexContainer->
empty()) {
364 theVertexContainer->
push_back(dummyxAODVertex);
367 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
374 theVertexContainer->
push_back(dummyxAODVertex);
375 dummyxAODVertex->
setPosition(beamSpotHandle->beamVtx().position());
377 dummyxAODVertex->
vxTrackAtVertex() = std::vector<Trk::VxTrackAtVertex>();
383 for (
unsigned int i = 0;
i < theVertexContainer->
size() - 1;
i++) {
386 " Vtx: " <<
i <<
" x= " << (*theVertexContainer)[
i]->position().
x()
387 <<
" y= " << (*theVertexContainer)[
i]->position().
y() <<
" z= "
388 << (*theVertexContainer)[
i]->position().
z() <<
" ntracks= "
389 << (*theVertexContainer)[
i]->vxTrackAtVertex().
size()
390 <<
" chi2= " << (*theVertexContainer)[
i]->
chiSquared()
391 <<
" ndf = " << (*theVertexContainer)[
i]->numberDoF());
398 return std::make_pair(theVertexContainer, theVertexAuxContainer);