ATLAS Offline Software
Loading...
Searching...
No Matches
CylinderBounds.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6// CylinderBounds.cxx, (c) ATLAS Detector Software
8
9// Trk
11// Gaudi
12#include "GaudiKernel/MsgStream.h"
13// STD
14#include <cmath>
15#include <iomanip>
16#include <iostream>
17
22
31
32Trk::CylinderBounds::CylinderBounds(double radius, double haphi, double halez)
34 , m_checkPhi(true)
35{
39}
40
41Trk::CylinderBounds::CylinderBounds(double radius, double haphi, double averagephi, double halez)
43 , m_checkPhi(true)
44{
49}
50
51bool
53{
54 // check the type first not to compare apples with oranges
55 const Trk::CylinderBounds* cylbo = dynamic_cast<const Trk::CylinderBounds*>(&sbo);
56 if (!cylbo)
57 return false;
58 return (m_boundValues == cylbo->m_boundValues);
59}
60
61double
63{
64 const double pi2 = 2. * M_PI;
65
66 double sZ = fabs(pos[locZ]) - m_boundValues[CylinderBounds::bv_halfZ];
68 if (wF >= M_PI)
69 return sZ;
70 double dF =
72 if (dF > M_PI)
73 dF = pi2 - dF;
74 double sF = 2. * m_boundValues[CylinderBounds::bv_radius] * sin(.5 * (dF - wF));
75
76 if (sF <= 0. || sZ <= 0.) {
77 if (sF > sZ){
78 return sF;
79 }
80
81 return sZ;
82 }
83 return sqrt(sF * sF + sZ * sZ);
84}
85
86// ostream operator overload
87MsgStream&
88Trk::CylinderBounds::dump(MsgStream& sl) const
89{
90 sl << std::setiosflags(std::ios::fixed);
91 sl << std::setprecision(7);
92 sl << "Trk::CylinderBounds: (radius, averagePhi, halfPhiSector, halflengthInZ) = ";
93 sl << "(" << this->r() << ", " << this->averagePhi() << ", ";
94 sl << this->halfPhiSector() << ", " << this->halflengthZ() << ")";
95 sl << std::setprecision(-1);
96 return sl;
97}
98
99std::ostream&
100Trk::CylinderBounds::dump(std::ostream& sl) const
101{
102 sl << std::setiosflags(std::ios::fixed);
103 sl << std::setprecision(7);
104 sl << "Trk::CylinderBounds: (radius, averagePhi, halfPhiSector, halflengthInZ) = ";
105 sl << "(" << this->r() << ", " << this->averagePhi() << ", ";
106 sl << this->halfPhiSector() << ", " << this->halflengthZ() << ")";
107 sl << std::setprecision(-1);
108 return sl;
109}
#define M_PI
Bounds for a cylindrical Surface.
virtual double minDistance(const Amg::Vector2D &pos) const override final
Minimal distance to boundary ( > 0 if outside and <=0 if inside)
virtual MsgStream & dump(MsgStream &sl) const override
Output Method for MsgStream.
double halfPhiSector() const
This method returns the halfPhiSector angle.
std::vector< TDD_real_t > m_boundValues
internal storage of the geometry parameters
CylinderBounds()
Default Constructor.
virtual bool operator==(const SurfaceBounds &sbo) const override
Equality operator.
double averagePhi() const
This method returns the average phi.
double halflengthZ() const
This method returns the halflengthZ.
SurfaceBounds()=default
Default Constructor.
int r
Definition globals.cxx:22
Eigen::Matrix< double, 2, 1 > Vector2D
@ locRPhi
Definition ParamDefs.h:40
@ locZ
local cylindrical
Definition ParamDefs.h:42