Belle II Software development
WireLine Class Reference

A three dimensional limited line represented by its closest approach to the z-axes (reference position ) and its skew parameter. More...

#include <WireLine.h>

Public Member Functions

 WireLine ()
 Default constructor initialising to all members to zero.
 
 WireLine (const Vector3D &forward, const Vector3D &backward, double sagCoeff)
 Constructor for a wire line between forward and backward point.
 
WireLine movedBy (const Vector3D &offset) const
 Returns a copy of the wire line moved by a three dimensional offset.
 
WireLine movedBy (const Vector2D &offset) const
 Returns a copy of the wire line moved by a two dimensional offset.
 
Vector3D nominalPos3DAtZ (const double z) const
 Gives the three dimensional position without wire sag effect of the line at the given z value.
 
Vector2D nominalPos2DAtZ (const double z) const
 Gives the two dimensional position without wire sag effect of the line at the given z value.
 
Vector3D sagPos3DAtZ (const double z) const
 Gives the three dimensional position with wire sag effect of the line at the given z value.
 
Vector2D sagPos2DAtZ (const double z) const
 Gives the two dimensional position with wire sag effect of the line at the given z value.
 
const Vector2DnominalMovePerZ () const
 Gives the positional move in the xy projection per unit z.
 
Vector2D sagMovePerZ (const double z) const
 Gives the two dimensional position with wire sag effect of the line at the given z value.
 
double nominalDistance (const Vector3D &pos3D) const
 Calculates the distance of the given point to the wire without wire sag effect.
 
double sagDistance (const Vector3D &pos3D) const
 Calculates the distance of the given point to the wire with wire sag effect.
 
Vector3D nominalClosest3D (const Vector3D &point) const
 Returns the closest approach on the wire without wire sag effect to the give point.
 
Vector3D sagClosest3D (const Vector3D &point) const
 Returns the closest approach on the wire with wire sag effect to the give point.
 
Vector3D forward3D () const
 Gives the position of the forward point.
 
Vector2D forward2D () const
 Gives the xy position of the forward point.
 
Vector3D backward3D () const
 Gives the position of the backward point.
 
Vector2D backward2D () const
 Gives the xy position of the backward point.
 
Vector3D wireVector () const
 Getter for the vector from backward to the forward position.
 
double forwardZ () const
 Gives the forward z coordinate.
 
double backwardZ () const
 Gives the backward z coordinate.
 
double deltaZ () const
 Returns the difference between forward and backward z.
 
double outOfZBoundsFactor (double z) const
 Returns the amount how much the given z position is outside the bounds in units of the wire length.
 
double forwardPhi () const
 Gives the forward azimuth angle.
 
double backwardPhi () const
 Gives the backward azimuth angle.
 
double forwardCylindricalR () const
 Gives the cylindrical radius of the forward position.
 
double backwardCylindricalR () const
 Gives the cylindrical radius of the backward position.
 
double forwardPhiToRef () const
 Gives the azimuth angle of the forward position relative to the reference position.
 
double backwardPhiToRef () const
 Gives the azimuth angle of the backward position relative to the reference position.
 
double backwardToForwardAngle () const
 Gives the azimuth angle difference from backward to forward position.
 
double tanLambda () const
 Returns the nominal tan lambda of the line. Also know as dz / ds.
 
double lambda () const
 Returns the nominal lambda angle of the line.
 
double tanTheta () const
 Returns the tangent of the opening angle between tangential vector and the z axes Also know as ds / dz.
 
double theta () const
 Returns the nominal opening angle between tangential vector and the z axes.
 
double nominalPerigeeZ () const
 Returns the z coordinate of the point of nominal closest approach to the z axes.
 
Vector3D nominalPerigee3D () const
 Returns the point of nominal closest approach to the z axes.
 
Vector2D nominalPerigee2D () const
 Returns the point of nominal closest approach to the z axes.
 
double refX () const
 Returns the the x coordinate of the reference point.
 
double refY () const
 Returns the the y coordinate of the reference point.
 
double refZ () const
 Returns the the z coordinate of the reference point.
 
double refCylindricalRSquared () const
 Returns the cylindrical radius of the reference position.
 
const Vector2DrefPos2D () const
 Returns the xy vector of the reference position.
 
const Vector3DrefPos3D () const
 Returns the reference position.
 
double sagCoeff () const
 Returns the wire sag coefficient due to gravity.
 

Private Attributes

Vector3D m_refPos3D
 Memory for the reference position.
 
Vector2D m_nominalMovePerZ
 Memory for the nominal movement of the xy position per z unit off the reference.
 
double m_forwardZ = 0.0
 Memory for the forward end z coordinate.
 
double m_backwardZ = 0.0
 Memory for the backward end z coordinate.
 
double m_sagCoeff = 0.0
 Memory for the wire sag coefficient.
 

Detailed Description

A three dimensional limited line represented by its closest approach to the z-axes (reference position ) and its skew parameter.

The representation is only suitable for lines out of the xy plane. The endpoints are stored encoded by their z position. The end point with the higher z value is called forward, the one with the smaller is called backward. This class is mainly used to describe the cdc wires with as few parameters as possible and simplifies the retrieval of the two dimensional track reference position, which is taken at the closest approach to the beam z-axes.

A three dimensional limited line

Definition at line 31 of file WireLine.h.

Constructor & Destructor Documentation

◆ WireLine() [1/2]

WireLine ( )
inline

Default constructor initialising to all members to zero.

Definition at line 35 of file WireLine.h.

36 {}

◆ WireLine() [2/2]

WireLine ( const Vector3D forward,
const Vector3D backward,
double  sagCoeff 
)

Constructor for a wire line between forward and backward point.

Definition at line 15 of file WireLine.cc.

18 : m_refPos3D{(backward * forward.z() - forward * backward.z()) / (forward.z() - backward.z()) }
19 , m_nominalMovePerZ{(forward.xy() - backward.xy()) / (forward.z() - backward.z())}
20 , m_forwardZ{forward.z()}
21 , m_backwardZ{backward.z()}
23{
24 B2ASSERT("Wire reference position is not at 0", m_refPos3D.z() == 0);
25}
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496
double m_backwardZ
Memory for the backward end z coordinate.
Definition: WireLine.h:245
Vector2D m_nominalMovePerZ
Memory for the nominal movement of the xy position per z unit off the reference.
Definition: WireLine.h:239
double sagCoeff() const
Returns the wire sag coefficient due to gravity.
Definition: WireLine.h:231
double m_forwardZ
Memory for the forward end z coordinate.
Definition: WireLine.h:242
double m_sagCoeff
Memory for the wire sag coefficient.
Definition: WireLine.h:248
Vector3D m_refPos3D
Memory for the reference position.
Definition: WireLine.h:236

Member Function Documentation

◆ backward2D()

Vector2D backward2D ( ) const
inline

Gives the xy position of the backward point.

Definition at line 122 of file WireLine.h.

123 { return nominalPos2DAtZ(backwardZ()); }
double backwardZ() const
Gives the backward z coordinate.
Definition: WireLine.h:134
Vector2D nominalPos2DAtZ(const double z) const
Gives the two dimensional position without wire sag effect of the line at the given z value.
Definition: WireLine.h:52

◆ backward3D()

Vector3D backward3D ( ) const
inline

Gives the position of the backward point.

Definition at line 118 of file WireLine.h.

119 { return nominalPos3DAtZ(backwardZ()); }
Vector3D nominalPos3DAtZ(const double z) const
Gives the three dimensional position without wire sag effect of the line at the given z value.
Definition: WireLine.h:48

◆ backwardCylindricalR()

double backwardCylindricalR ( ) const
inline

Gives the cylindrical radius of the backward position.

Definition at line 158 of file WireLine.h.

159 { return backward2D().cylindricalR(); }
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
Definition: Vector2D.h:557
Vector2D backward2D() const
Gives the xy position of the backward point.
Definition: WireLine.h:122

◆ backwardPhi()

double backwardPhi ( ) const
inline

Gives the backward azimuth angle.

Definition at line 150 of file WireLine.h.

151 { return backward2D().phi(); }
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition: Vector2D.h:569

◆ backwardPhiToRef()

double backwardPhiToRef ( ) const
inline

Gives the azimuth angle of the backward position relative to the reference position.

Definition at line 166 of file WireLine.h.

167 { return backward2D().angleWith(refPos2D()); }
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:197
const Vector2D & refPos2D() const
Returns the xy vector of the reference position.
Definition: WireLine.h:223

◆ backwardToForwardAngle()

double backwardToForwardAngle ( ) const
inline

Gives the azimuth angle difference from backward to forward position.

Definition at line 172 of file WireLine.h.

173 { return backward2D().angleWith(forward2D()) ; }
Vector2D forward2D() const
Gives the xy position of the forward point.
Definition: WireLine.h:114

◆ backwardZ()

double backwardZ ( ) const
inline

Gives the backward z coordinate.

Definition at line 134 of file WireLine.h.

135 { return m_backwardZ; }

◆ deltaZ()

double deltaZ ( ) const
inline

Returns the difference between forward and backward z.

Definition at line 138 of file WireLine.h.

139 { return forwardZ() - backwardZ(); }
double forwardZ() const
Gives the forward z coordinate.
Definition: WireLine.h:130

◆ forward2D()

Vector2D forward2D ( ) const
inline

Gives the xy position of the forward point.

Definition at line 114 of file WireLine.h.

115 { return nominalPos2DAtZ(forwardZ()); }

◆ forward3D()

Vector3D forward3D ( ) const
inline

Gives the position of the forward point.

Definition at line 110 of file WireLine.h.

111 { return nominalPos3DAtZ(forwardZ()); }

◆ forwardCylindricalR()

double forwardCylindricalR ( ) const
inline

Gives the cylindrical radius of the forward position.

Definition at line 154 of file WireLine.h.

155 { return forward2D().cylindricalR(); }

◆ forwardPhi()

double forwardPhi ( ) const
inline

Gives the forward azimuth angle.

Definition at line 146 of file WireLine.h.

147 { return forward2D().phi(); }

◆ forwardPhiToRef()

double forwardPhiToRef ( ) const
inline

Gives the azimuth angle of the forward position relative to the reference position.

Definition at line 162 of file WireLine.h.

163 { return forward2D().angleWith(refPos2D()); }

◆ forwardZ()

double forwardZ ( ) const
inline

Gives the forward z coordinate.

Definition at line 130 of file WireLine.h.

131 { return m_forwardZ; }

◆ lambda()

double lambda ( ) const
inline

Returns the nominal lambda angle of the line.

Definition at line 180 of file WireLine.h.

181 { return std::atan(tanLambda()); }
double tanLambda() const
Returns the nominal tan lambda of the line. Also know as dz / ds.
Definition: WireLine.h:176

◆ movedBy() [1/2]

WireLine movedBy ( const Vector2D offset) const

Returns a copy of the wire line moved by a two dimensional offset.

Definition at line 36 of file WireLine.cc.

37{
38 WireLine moved = *this;
39 moved.m_refPos3D += offset;
40 return moved;
41}
A three dimensional limited line represented by its closest approach to the z-axes (reference positio...
Definition: WireLine.h:31

◆ movedBy() [2/2]

WireLine movedBy ( const Vector3D offset) const

Returns a copy of the wire line moved by a three dimensional offset.

Definition at line 27 of file WireLine.cc.

28{
29 WireLine moved = *this;
30 moved.m_refPos3D += offset.xy() + nominalMovePerZ() * offset.z();
31 moved.m_forwardZ += offset.z();
32 moved.m_backwardZ += offset.z();
33 return moved;
34}
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
const Vector2D & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Definition: WireLine.h:71

◆ nominalClosest3D()

Vector3D nominalClosest3D ( const Vector3D point) const
inline

Returns the closest approach on the wire without wire sag effect to the give point.

Definition at line 98 of file WireLine.h.

99 { return refPos3D() - (point - refPos3D()).parallelVector(Vector3D(nominalMovePerZ(), 1)); }
const Vector3D & refPos3D() const
Returns the reference position.
Definition: WireLine.h:227
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:34

◆ nominalDistance()

double nominalDistance ( const Vector3D pos3D) const
inline

Calculates the distance of the given point to the wire without wire sag effect.

Definition at line 86 of file WireLine.h.

87 { return (pos3D - refPos3D()).orthogonalComp(Vector3D(nominalMovePerZ(), 1)); }

◆ nominalMovePerZ()

const Vector2D & nominalMovePerZ ( ) const
inline

Gives the positional move in the xy projection per unit z.

Definition at line 71 of file WireLine.h.

72 { return m_nominalMovePerZ; }

◆ nominalPerigee2D()

Vector2D nominalPerigee2D ( ) const
inline

Returns the point of nominal closest approach to the z axes.

Definition at line 203 of file WireLine.h.

Vector2D orthogonalVector(const Vector2D &relativTo) const
Calculates the part of this vector that is parallel to the given vector.
Definition: Vector2D.h:438

◆ nominalPerigee3D()

Vector3D nominalPerigee3D ( ) const
inline

Returns the point of nominal closest approach to the z axes.

Definition at line 199 of file WireLine.h.

200 { return nominalPos3DAtZ(nominalPerigeeZ()); }
double nominalPerigeeZ() const
Returns the z coordinate of the point of nominal closest approach to the z axes.
Definition: WireLine.h:195

◆ nominalPerigeeZ()

double nominalPerigeeZ ( ) const
inline

Returns the z coordinate of the point of nominal closest approach to the z axes.

Definition at line 195 of file WireLine.h.

double dot(const Vector2D &rhs) const
Calculates the two dimensional dot product.
Definition: Vector2D.h:158
double normSquared() const
Calculates .
Definition: Vector2D.h:169

◆ nominalPos2DAtZ()

Vector2D nominalPos2DAtZ ( const double  z) const
inline

Gives the two dimensional position without wire sag effect of the line at the given z value.

Definition at line 52 of file WireLine.h.

53 { return refPos2D() + nominalMovePerZ() * z; }

◆ nominalPos3DAtZ()

Vector3D nominalPos3DAtZ ( const double  z) const
inline

Gives the three dimensional position without wire sag effect of the line at the given z value.

Definition at line 48 of file WireLine.h.

49 { return Vector3D(nominalPos2DAtZ(z), z); }

◆ outOfZBoundsFactor()

double outOfZBoundsFactor ( double  z) const
inline

Returns the amount how much the given z position is outside the bounds in units of the wire length.

Definition at line 142 of file WireLine.h.

143 { return std::fmax(backwardZ() - z, z - forwardZ()) / deltaZ(); }
double deltaZ() const
Returns the difference between forward and backward z.
Definition: WireLine.h:138

◆ refCylindricalRSquared()

double refCylindricalRSquared ( ) const
inline

Returns the cylindrical radius of the reference position.

Definition at line 219 of file WireLine.h.

220 { return m_refPos3D.cylindricalRSquared(); }
double cylindricalRSquared() const
Getter for the squared cylindrical radius ( xy projected squared norm )
Definition: Vector3D.h:528

◆ refPos2D()

const Vector2D & refPos2D ( ) const
inline

Returns the xy vector of the reference position.

Definition at line 223 of file WireLine.h.

224 { return m_refPos3D.xy(); }

◆ refPos3D()

const Vector3D & refPos3D ( ) const
inline

Returns the reference position.

Definition at line 227 of file WireLine.h.

228 { return m_refPos3D; }

◆ refX()

double refX ( ) const
inline

Returns the the x coordinate of the reference point.

Definition at line 207 of file WireLine.h.

208 { return m_refPos3D.x(); }
double x() const
Getter for the x coordinate.
Definition: Vector3D.h:472

◆ refY()

double refY ( ) const
inline

Returns the the y coordinate of the reference point.

Definition at line 211 of file WireLine.h.

212 { return m_refPos3D.y(); }
double y() const
Getter for the y coordinate.
Definition: Vector3D.h:484

◆ refZ()

double refZ ( ) const
inline

Returns the the z coordinate of the reference point.

Definition at line 215 of file WireLine.h.

216 { return m_refPos3D.z(); }

◆ sagClosest3D()

Vector3D sagClosest3D ( const Vector3D point) const
inline

Returns the closest approach on the wire with wire sag effect to the give point.

Definition at line 102 of file WireLine.h.

103 {
104 Vector3D wirePos3D = sagPos3DAtZ(point.z());
105 Vector3D movePerZ(sagMovePerZ(point.z()), 1);
106 return wirePos3D - (point - wirePos3D).parallelVector(movePerZ);
107 }
Vector2D sagMovePerZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Definition: WireLine.h:75
Vector3D sagPos3DAtZ(const double z) const
Gives the three dimensional position with wire sag effect of the line at the given z value.
Definition: WireLine.h:56

◆ sagCoeff()

double sagCoeff ( ) const
inline

Returns the wire sag coefficient due to gravity.

Definition at line 231 of file WireLine.h.

232 { return m_sagCoeff; }

◆ sagDistance()

double sagDistance ( const Vector3D pos3D) const
inline

Calculates the distance of the given point to the wire with wire sag effect.

Definition at line 90 of file WireLine.h.

91 {
92 Vector3D wirePos3D = sagPos3DAtZ(pos3D.z());
93 Vector3D movePerZ(sagMovePerZ(pos3D.z()), 1);
94 return (pos3D - wirePos3D).orthogonalComp(movePerZ);
95 }

◆ sagMovePerZ()

Vector2D sagMovePerZ ( const double  z) const
inline

Gives the two dimensional position with wire sag effect of the line at the given z value.

Efficient version without divisions

Definition at line 75 of file WireLine.h.

76 {
78 Vector2D movePerZ = nominalMovePerZ();
79 double xzFactorSquared = 1 + nominalMovePerZ().x() * nominalMovePerZ().x();
80 double sagDYDZ = - sagCoeff() * xzFactorSquared * (forwardZ() + backwardZ() - 2 * z);
81 movePerZ.setY(movePerZ.y() + sagDYDZ);
82 return movePerZ;
83 }
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595

◆ sagPos2DAtZ()

Vector2D sagPos2DAtZ ( const double  z) const
inline

Gives the two dimensional position with wire sag effect of the line at the given z value.

Efficient version without divisions

Definition at line 60 of file WireLine.h.

61 {
63 Vector2D pos2D = nominalPos2DAtZ(z);
64 double xzFactorSquared = 1 + nominalMovePerZ().x() * nominalMovePerZ().x();
65 double sagY = - sagCoeff() * xzFactorSquared * (forwardZ() - z) * (z - backwardZ());
66 pos2D.setY(pos2D.y() + sagY);
67 return pos2D;
68 }

◆ sagPos3DAtZ()

Vector3D sagPos3DAtZ ( const double  z) const
inline

Gives the three dimensional position with wire sag effect of the line at the given z value.

Definition at line 56 of file WireLine.h.

57 { return Vector3D(sagPos2DAtZ(z), z); }
Vector2D sagPos2DAtZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Definition: WireLine.h:60

◆ tanLambda()

double tanLambda ( ) const
inline

Returns the nominal tan lambda of the line. Also know as dz / ds.

Definition at line 176 of file WireLine.h.

177 { return 1 / nominalMovePerZ().norm(); }
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:175

◆ tanTheta()

double tanTheta ( ) const
inline

Returns the tangent of the opening angle between tangential vector and the z axes Also know as ds / dz.

Definition at line 187 of file WireLine.h.

188 { return std::atan(nominalMovePerZ().norm()); }

◆ theta()

double theta ( ) const
inline

Returns the nominal opening angle between tangential vector and the z axes.

Definition at line 191 of file WireLine.h.

192 { return std::atan(nominalMovePerZ().norm()); }

◆ wireVector()

Vector3D wireVector ( ) const
inline

Getter for the vector from backward to the forward position.

Definition at line 126 of file WireLine.h.

127 { return Vector3D(nominalMovePerZ() * deltaZ(), deltaZ()); }

Member Data Documentation

◆ m_backwardZ

double m_backwardZ = 0.0
private

Memory for the backward end z coordinate.

Definition at line 245 of file WireLine.h.

◆ m_forwardZ

double m_forwardZ = 0.0
private

Memory for the forward end z coordinate.

Definition at line 242 of file WireLine.h.

◆ m_nominalMovePerZ

Vector2D m_nominalMovePerZ
private

Memory for the nominal movement of the xy position per z unit off the reference.

Definition at line 239 of file WireLine.h.

◆ m_refPos3D

Vector3D m_refPos3D
private

Memory for the reference position.

Definition at line 236 of file WireLine.h.

◆ m_sagCoeff

double m_sagCoeff = 0.0
private

Memory for the wire sag coefficient.

Definition at line 248 of file WireLine.h.


The documentation for this class was generated from the following files: