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 ROOT::Math::XYZVector &forward, const ROOT::Math::XYZVector &backward, double sagCoeff)
 Constructor for a wire line between forward and backward point.
 
WireLine movedBy (const ROOT::Math::XYZVector &offset) const
 Returns a copy of the wire line moved by a three dimensional offset.
 
WireLine movedBy (const ROOT::Math::XYVector &offset) const
 Returns a copy of the wire line moved by a two dimensional offset.
 
ROOT::Math::XYZVector nominalPos3DAtZ (const double z) const
 Gives the three dimensional position without wire sag effect of the line at the given z value.
 
ROOT::Math::XYVector nominalPos2DAtZ (const double z) const
 Gives the two dimensional position without wire sag effect of the line at the given z value.
 
ROOT::Math::XYZVector sagPos3DAtZ (const double z) const
 Gives the three dimensional position with wire sag effect of the line at the given z value.
 
ROOT::Math::XYVector sagPos2DAtZ (const double z) const
 Gives the two dimensional position with wire sag effect of the line at the given z value.
 
const ROOT::Math::XYVector & nominalMovePerZ () const
 Gives the positional move in the xy projection per unit z.
 
ROOT::Math::XYVector 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 ROOT::Math::XYZVector &pos3D) const
 Calculates the distance of the given point to the wire without wire sag effect.
 
double sagDistance (const ROOT::Math::XYZVector &pos3D) const
 Calculates the distance of the given point to the wire with wire sag effect.
 
ROOT::Math::XYZVector nominalClosest3D (const ROOT::Math::XYZVector &point) const
 Returns the closest approach on the wire without wire sag effect to the give point.
 
ROOT::Math::XYZVector sagClosest3D (const ROOT::Math::XYZVector &point) const
 Returns the closest approach on the wire with wire sag effect to the give point.
 
ROOT::Math::XYZVector forward3D () const
 Gives the position of the forward point.
 
ROOT::Math::XYVector forward2D () const
 Gives the xy position of the forward point.
 
ROOT::Math::XYZVector backward3D () const
 Gives the position of the backward point.
 
ROOT::Math::XYVector backward2D () const
 Gives the xy position of the backward point.
 
ROOT::Math::XYZVector 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.
 
ROOT::Math::XYZVector nominalPerigee3D () const
 Returns the point of nominal closest approach to the z axes.
 
ROOT::Math::XYVector 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 ROOT::Math::XYVector & refPos2D () const
 Returns the xy vector of the reference position.
 
const ROOT::Math::XYZVector & refPos3D () const
 Returns the reference position.
 
double sagCoeff () const
 Returns the wire sag coefficient due to gravity.
 

Private Attributes

ROOT::Math::XYZVector m_refPos3D
 Memory for the reference position.
 
ROOT::Math::XYVector m_refPos2D
 Memory for the 2D reference position (to avoid [-Wreturn-stack-address] in refPos2D())
 
ROOT::Math::XYVector 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 33 of file WireLine.h.

Constructor & Destructor Documentation

◆ WireLine() [1/2]

WireLine ( )
inline

Default constructor initialising to all members to zero.

Definition at line 37 of file WireLine.h.

38 {}

◆ WireLine() [2/2]

WireLine ( const ROOT::Math::XYZVector & forward,
const ROOT::Math::XYZVector & 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_forwardZ{forward.z()}
20 , m_backwardZ{backward.z()}
22{
23 m_refPos2D = ROOT::Math::XYVector(m_refPos3D.x(), m_refPos3D.y());
24 const double deltaZ = forward.z() - backward.z();
25 m_nominalMovePerZ = ROOT::Math::XYVector((forward.x() - backward.x()) / deltaZ, (forward.y() - backward.y()) / deltaZ);
26
27 B2ASSERT("Wire reference position is not at 0", m_refPos3D.z() == 0);
28}
double m_backwardZ
Memory for the backward end z coordinate.
Definition WireLine.h:266
ROOT::Math::XYZVector m_refPos3D
Memory for the reference position.
Definition WireLine.h:254
double deltaZ() const
Returns the difference between forward and backward z.
Definition WireLine.h:156
double sagCoeff() const
Returns the wire sag coefficient due to gravity.
Definition WireLine.h:249
ROOT::Math::XYVector m_refPos2D
Memory for the 2D reference position (to avoid [-Wreturn-stack-address] in refPos2D())
Definition WireLine.h:257
ROOT::Math::XYVector m_nominalMovePerZ
Memory for the nominal movement of the xy position per z unit off the reference.
Definition WireLine.h:260
double m_forwardZ
Memory for the forward end z coordinate.
Definition WireLine.h:263
double m_sagCoeff
Memory for the wire sag coefficient.
Definition WireLine.h:269

Member Function Documentation

◆ backward2D()

ROOT::Math::XYVector backward2D ( ) const
inline

Gives the xy position of the backward point.

Definition at line 137 of file WireLine.h.

138 { return nominalPos2DAtZ(backwardZ()); }

◆ backward3D()

ROOT::Math::XYZVector backward3D ( ) const
inline

Gives the position of the backward point.

Definition at line 133 of file WireLine.h.

134 { return nominalPos3DAtZ(backwardZ()); }

◆ backwardCylindricalR()

double backwardCylindricalR ( ) const
inline

Gives the cylindrical radius of the backward position.

Definition at line 176 of file WireLine.h.

177 { return backward2D().R(); }

◆ backwardPhi()

double backwardPhi ( ) const
inline

Gives the backward azimuth angle.

Definition at line 168 of file WireLine.h.

169 { return backward2D().Phi(); }

◆ backwardPhiToRef()

double backwardPhiToRef ( ) const
inline

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

Definition at line 184 of file WireLine.h.

185 { return VectorUtil::Angle(backward2D(), refPos2D()); }

◆ backwardToForwardAngle()

double backwardToForwardAngle ( ) const
inline

Gives the azimuth angle difference from backward to forward position.

Definition at line 190 of file WireLine.h.

191 { return VectorUtil::Angle(backward2D(), forward2D()); }

◆ backwardZ()

double backwardZ ( ) const
inline

Gives the backward z coordinate.

Definition at line 152 of file WireLine.h.

153 { return m_backwardZ; }

◆ deltaZ()

double deltaZ ( ) const
inline

Returns the difference between forward and backward z.

Definition at line 156 of file WireLine.h.

157 { return forwardZ() - backwardZ(); }

◆ forward2D()

ROOT::Math::XYVector forward2D ( ) const
inline

Gives the xy position of the forward point.

Definition at line 129 of file WireLine.h.

130 { return nominalPos2DAtZ(forwardZ()); }

◆ forward3D()

ROOT::Math::XYZVector forward3D ( ) const
inline

Gives the position of the forward point.

Definition at line 125 of file WireLine.h.

126 { return nominalPos3DAtZ(forwardZ()); }

◆ forwardCylindricalR()

double forwardCylindricalR ( ) const
inline

Gives the cylindrical radius of the forward position.

Definition at line 172 of file WireLine.h.

173 { return forward2D().R(); }

◆ forwardPhi()

double forwardPhi ( ) const
inline

Gives the forward azimuth angle.

Definition at line 164 of file WireLine.h.

165 { return forward2D().Phi(); }

◆ forwardPhiToRef()

double forwardPhiToRef ( ) const
inline

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

Definition at line 180 of file WireLine.h.

181 { return VectorUtil::Angle(forward2D(), refPos2D()); }

◆ forwardZ()

double forwardZ ( ) const
inline

Gives the forward z coordinate.

Definition at line 148 of file WireLine.h.

149 { return m_forwardZ; }

◆ lambda()

double lambda ( ) const
inline

Returns the nominal lambda angle of the line.

Definition at line 198 of file WireLine.h.

199 { return std::atan(tanLambda()); }

◆ movedBy() [1/2]

WireLine movedBy ( const ROOT::Math::XYVector & offset) const

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

Definition at line 40 of file WireLine.cc.

41{
42 WireLine moved = *this;
43 moved.m_refPos3D += ROOT::Math::XYZVector(offset.X(), offset.Y(), 0);
44 return moved;
45}
WireLine()
Default constructor initialising to all members to zero.
Definition WireLine.h:37

◆ movedBy() [2/2]

WireLine movedBy ( const ROOT::Math::XYZVector & offset) const

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

Definition at line 30 of file WireLine.cc.

31{
32 WireLine moved = *this;
33 const ROOT::Math::XYVector tmp = nominalMovePerZ();
34 moved.m_refPos3D += ROOT::Math::XYZVector(offset.X(), offset.Y(), 0) + ROOT::Math::XYZVector(tmp.X(), tmp.Y(), 0) * offset.z();
35 moved.m_forwardZ += offset.z();
36 moved.m_backwardZ += offset.z();
37 return moved;
38}
const ROOT::Math::XYVector & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Definition WireLine.h:79

◆ nominalClosest3D()

ROOT::Math::XYZVector nominalClosest3D ( const ROOT::Math::XYZVector & point) const
inline

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

Definition at line 109 of file WireLine.h.

110 {
111 return refPos3D() - ROOT::Math::VectorUtil::ProjVector((point - refPos3D()), ROOT::Math::XYZVector(nominalMovePerZ().X(),
112 nominalMovePerZ().Y(), 1));
113 }

◆ nominalDistance()

double nominalDistance ( const ROOT::Math::XYZVector & pos3D) const
inline

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

Definition at line 94 of file WireLine.h.

95 {
96 return ROOT::Math::VectorUtil::Perp((pos3D - refPos3D()), ROOT::Math::XYZVector(nominalMovePerZ().X(), nominalMovePerZ().Y(), 1));
97 }

◆ nominalMovePerZ()

const ROOT::Math::XYVector & nominalMovePerZ ( ) const
inline

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

Definition at line 79 of file WireLine.h.

80 { return m_nominalMovePerZ; }

◆ nominalPerigee2D()

ROOT::Math::XYVector nominalPerigee2D ( ) const
inline

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

Definition at line 221 of file WireLine.h.

222 { return VectorUtil::orthogonalVector(refPos2D(), nominalMovePerZ()); }

◆ nominalPerigee3D()

ROOT::Math::XYZVector nominalPerigee3D ( ) const
inline

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

Definition at line 217 of file WireLine.h.

218 { return nominalPos3DAtZ(nominalPerigeeZ()); }

◆ nominalPerigeeZ()

double nominalPerigeeZ ( ) const
inline

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

Definition at line 213 of file WireLine.h.

214 { return -refPos2D().Dot(nominalMovePerZ()) / nominalMovePerZ().Mag2(); }

◆ nominalPos2DAtZ()

ROOT::Math::XYVector 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 57 of file WireLine.h.

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

◆ nominalPos3DAtZ()

ROOT::Math::XYZVector 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 50 of file WireLine.h.

51 {
52 const ROOT::Math::XYVector& tmp = nominalPos2DAtZ(z);
53 return ROOT::Math::XYZVector(tmp.X(), tmp.Y(), z);
54 }

◆ 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 160 of file WireLine.h.

161 { return std::fmax(backwardZ() - z, z - forwardZ()) / deltaZ(); }

◆ refCylindricalRSquared()

double refCylindricalRSquared ( ) const
inline

Returns the cylindrical radius of the reference position.

Definition at line 237 of file WireLine.h.

238 { return m_refPos3D.Perp2(); }

◆ refPos2D()

const ROOT::Math::XYVector & refPos2D ( ) const
inline

Returns the xy vector of the reference position.

Definition at line 241 of file WireLine.h.

242 { return m_refPos2D; }

◆ refPos3D()

const ROOT::Math::XYZVector & refPos3D ( ) const
inline

Returns the reference position.

Definition at line 245 of file WireLine.h.

246 { return m_refPos3D; }

◆ refX()

double refX ( ) const
inline

Returns the the x coordinate of the reference point.

Definition at line 225 of file WireLine.h.

226 { return m_refPos3D.x(); }

◆ refY()

double refY ( ) const
inline

Returns the the y coordinate of the reference point.

Definition at line 229 of file WireLine.h.

230 { return m_refPos3D.y(); }

◆ refZ()

double refZ ( ) const
inline

Returns the the z coordinate of the reference point.

Definition at line 233 of file WireLine.h.

234 { return m_refPos3D.z(); }

◆ sagClosest3D()

ROOT::Math::XYZVector sagClosest3D ( const ROOT::Math::XYZVector & point) const
inline

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

Definition at line 116 of file WireLine.h.

117 {
118 const ROOT::Math::XYZVector& wirePos3D = sagPos3DAtZ(point.z());
119 const ROOT::Math::XYVector& tmp = sagMovePerZ(point.z());
120 const ROOT::Math::XYZVector movePerZ(tmp.X(), tmp.Y(), 1);
121 return wirePos3D - ROOT::Math::VectorUtil::ProjVector((point - wirePos3D), movePerZ);
122 }

◆ sagCoeff()

double sagCoeff ( ) const
inline

Returns the wire sag coefficient due to gravity.

Definition at line 249 of file WireLine.h.

250 { return m_sagCoeff; }

◆ sagDistance()

double sagDistance ( const ROOT::Math::XYZVector & pos3D) const
inline

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

Definition at line 100 of file WireLine.h.

101 {
102 const ROOT::Math::XYZVector& wirePos3D = sagPos3DAtZ(pos3D.z());
103 const ROOT::Math::XYVector& tmp = sagMovePerZ(pos3D.z());
104 const ROOT::Math::XYZVector movePerZ(tmp.X(), tmp.Y(), 1);
105 return ROOT::Math::VectorUtil::Perp((pos3D - wirePos3D), movePerZ);
106 }

◆ sagMovePerZ()

ROOT::Math::XYVector 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 83 of file WireLine.h.

84 {
86 ROOT::Math::XYVector movePerZ = nominalMovePerZ();
87 double xzFactorSquared = 1 + nominalMovePerZ().X() * nominalMovePerZ().X();
88 double sagDYDZ = - sagCoeff() * xzFactorSquared * (forwardZ() + backwardZ() - 2 * z);
89 movePerZ.SetY(movePerZ.Y() + sagDYDZ);
90 return movePerZ;
91 }

◆ sagPos2DAtZ()

ROOT::Math::XYVector 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 68 of file WireLine.h.

69 {
71 ROOT::Math::XYVector pos2D = nominalPos2DAtZ(z);
72 double xzFactorSquared = 1 + nominalMovePerZ().X() * nominalMovePerZ().X();
73 double sagY = - sagCoeff() * xzFactorSquared * (forwardZ() - z) * (z - backwardZ());
74 pos2D.SetY(pos2D.Y() + sagY);
75 return pos2D;
76 }

◆ sagPos3DAtZ()

ROOT::Math::XYZVector 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 61 of file WireLine.h.

62 {
63 const ROOT::Math::XYVector& tmp = sagPos2DAtZ(z);
64 return ROOT::Math::XYZVector(tmp.X(), tmp.Y(), z);
65 }

◆ tanLambda()

double tanLambda ( ) const
inline

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

Definition at line 194 of file WireLine.h.

195 { return 1 / nominalMovePerZ().R(); }

◆ 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 205 of file WireLine.h.

206 { return std::atan(nominalMovePerZ().R()); }
double R
typedef autogenerated by FFTW

◆ theta()

double theta ( ) const
inline

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

Definition at line 209 of file WireLine.h.

210 { return std::atan(nominalMovePerZ().R()); }

◆ wireVector()

ROOT::Math::XYZVector wireVector ( ) const
inline

Getter for the vector from backward to the forward position.

Definition at line 141 of file WireLine.h.

142 {
143 const ROOT::Math::XYVector& tmp = nominalMovePerZ() * deltaZ();
144 return ROOT::Math::XYZVector(tmp.X(), tmp.Y(), deltaZ());
145 }

Member Data Documentation

◆ m_backwardZ

double m_backwardZ = 0.0
private

Memory for the backward end z coordinate.

Definition at line 266 of file WireLine.h.

◆ m_forwardZ

double m_forwardZ = 0.0
private

Memory for the forward end z coordinate.

Definition at line 263 of file WireLine.h.

◆ m_nominalMovePerZ

ROOT::Math::XYVector m_nominalMovePerZ
private

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

Definition at line 260 of file WireLine.h.

◆ m_refPos2D

ROOT::Math::XYVector m_refPos2D
private

Memory for the 2D reference position (to avoid [-Wreturn-stack-address] in refPos2D())

Definition at line 257 of file WireLine.h.

◆ m_refPos3D

ROOT::Math::XYZVector m_refPos3D
private

Memory for the reference position.

Definition at line 254 of file WireLine.h.

◆ m_sagCoeff

double m_sagCoeff = 0.0
private

Memory for the wire sag coefficient.

Definition at line 269 of file WireLine.h.


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