ATLAS Offline Software
Loading...
Searching...
No Matches
TrackSurfaceIntersection.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TrackSurfaceIntersection.cxx, (c) ATLAS Detector software
8
9// Trk
11// Gaudi
12#include "GaudiKernel/MsgStream.h"
13// STD
14#include <iomanip>
15#include <iostream>
16#include <sstream>
17
18// constructor
20 const Amg::Vector3D& pos,
21 const Amg::Vector3D& dir,
22 double path)
23 : m_position(pos)
24 , m_direction(dir)
25 , m_pathlength(path)
26{
27}
28
37
39 const TrackSurfaceIntersection& other,
40 std::unique_ptr<IIntersectionCache> cache)
41 : m_position(other.m_position)
44 , m_cache(std::move(cache))
45{
46}
47
50{
51 if (this != &other) {
52 m_position = other.m_position;
53 m_direction = other.m_direction;
54 m_pathlength = other.m_pathlength;
55 m_cache = other.m_cache ? other.m_cache->clone() : nullptr;
56 }
57 return *this;
58}
59
60// Overload of << operator for both, MsgStream and std::ostream for debug output
61MsgStream&
62Trk::operator<<(MsgStream& sl, const Trk::TrackSurfaceIntersection& tsfi)
63{
64 std::ostringstream os;
65 os<<tsfi;
66 sl<<os.str();
67 return sl;
68}
69
70std::ostream&
71Trk::operator<<(std::ostream& sl, const Trk::TrackSurfaceIntersection& tsfi)
72{
73 const auto old_flags = sl.flags();
74 const auto old_prec = sl.precision();
75
76 sl.setf(std::ios::fixed, std::ios::floatfield);
77 sl.precision(7);
78
79 sl << "Trk::TrackSurfaceIntersection\n"
80 << " position [mm] = (" << tsfi.position().x() << ", "
81 << tsfi.position().y() << ", " << tsfi.position().z() << ")\n"
82 << " direction = (" << tsfi.direction().x() << ", "
83 << tsfi.direction().y() << ", " << tsfi.direction().z() << ")\n"
84 << " pathlength [mm] = " << tsfi.pathlength() << '\n';
85
86 sl.flags(old_flags);
87 sl.precision(old_prec);
88 return sl;
89}
An intersection with a Surface is given by.
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.
std::unique_ptr< IIntersectionCache > m_cache
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.
TrackSurfaceIntersection(const Amg::Vector3D &pos, const Amg::Vector3D &dir, double path)
Constructor.
TrackSurfaceIntersection & operator=(const TrackSurfaceIntersection &other)
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
double pathlength() const
Method to retrieve the pathlength propagated till the Intersection.
Eigen::Matrix< double, 3, 1 > Vector3D
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
STL namespace.