Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:33

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Vertexing/Vertex.hpp"
0010 
0011 namespace Acts {
0012 
0013 Vertex::Vertex(const Vector3& position) {
0014   m_position.head<3>() = position;
0015   m_seedPosition.head<3>() = position;
0016 }
0017 
0018 Vertex::Vertex(const Vector4& position)
0019     : m_position(position), m_seedPosition(position) {}
0020 
0021 Vertex::Vertex(const Vector3& position, const SquareMatrix3& covariance,
0022                std::vector<TrackAtVertex> tracks)
0023     : m_tracksAtVertex(std::move(tracks)) {
0024   m_position.head<3>() = position;
0025   m_seedPosition.head<3>() = position;
0026   m_covariance.block<3, 3>(ePos0, ePos0) = covariance;
0027 }
0028 
0029 Vertex::Vertex(const Vector4& position, const SquareMatrix4& covariance,
0030                std::vector<TrackAtVertex> tracks)
0031     : m_position(position),
0032       m_seedPosition(position),
0033       m_covariance(covariance),
0034       m_tracksAtVertex(std::move(tracks)) {}
0035 
0036 Vector3 Vertex::position() const {
0037   return VectorHelpers::position(m_position);
0038 }
0039 
0040 double Vertex::time() const {
0041   return m_position[eTime];
0042 }
0043 
0044 const Vector4& Vertex::fullPosition() const {
0045   return m_position;
0046 }
0047 
0048 Vector4& Vertex::fullPosition() {
0049   return m_position;
0050 }
0051 
0052 const Vector4& Vertex::fullSeedPosition() const {
0053   return m_seedPosition;
0054 }
0055 
0056 Vector4& Vertex::fullSeedPosition() {
0057   return m_seedPosition;
0058 }
0059 
0060 SquareMatrix3 Vertex::covariance() const {
0061   return m_covariance.block<3, 3>(ePos0, ePos0);
0062 }
0063 
0064 const SquareMatrix4& Vertex::fullCovariance() const {
0065   return m_covariance;
0066 }
0067 
0068 SquareMatrix4& Vertex::fullCovariance() {
0069   return m_covariance;
0070 }
0071 
0072 const std::vector<TrackAtVertex>& Vertex::tracks() const {
0073   return m_tracksAtVertex;
0074 }
0075 
0076 std::pair<double, double> Vertex::fitQuality() const {
0077   return {m_chiSquared, m_numberDoF};
0078 }
0079 
0080 void Vertex::setPosition(const Vector3& position) {
0081   m_position.head<3>() = position;
0082 }
0083 
0084 void Vertex::setFullPosition(const Vector4& fullPosition) {
0085   m_position = fullPosition;
0086 }
0087 
0088 void Vertex::setTime(double time) {
0089   m_position[eTime] = time;
0090 }
0091 
0092 void Vertex::setCovariance(const SquareMatrix3& covariance) {
0093   m_covariance.setZero();
0094   m_covariance.block<3, 3>(ePos0, ePos0) = covariance;
0095 }
0096 
0097 void Vertex::setFullCovariance(const SquareMatrix4& covariance) {
0098   m_covariance = covariance;
0099 }
0100 
0101 void Vertex::setTracksAtVertex(std::vector<TrackAtVertex> tracks) {
0102   m_tracksAtVertex = std::move(tracks);
0103 }
0104 
0105 void Vertex::setFitQuality(double chiSquared, double numberDoF) {
0106   m_chiSquared = chiSquared;
0107   m_numberDoF = numberDoF;
0108 }
0109 
0110 void Vertex::setFitQuality(std::pair<double, double> fitQuality) {
0111   m_chiSquared = fitQuality.first;
0112   m_numberDoF = fitQuality.second;
0113 }
0114 
0115 }  // namespace Acts