Belle II Software development
WireLine.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <cdc/topology/WireLine.h>
9
10#include <framework/logging/Logger.h>
11
12using namespace Belle2;
13using namespace CDC;
14
15WireLine::WireLine(const ROOT::Math::XYZVector& forward,
16 const ROOT::Math::XYZVector& backward,
17 double sagCoeff)
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}
29
30WireLine WireLine::movedBy(const ROOT::Math::XYZVector& offset) const
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}
39
40WireLine WireLine::movedBy(const ROOT::Math::XYVector& offset) const
41{
42 WireLine moved = *this;
43 moved.m_refPos3D += ROOT::Math::XYZVector(offset.X(), offset.Y(), 0);
44 return moved;
45}
const ROOT::Math::XYVector & nominalMovePerZ() const
Gives the positional move in the xy projection per unit z.
Definition WireLine.h:79
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
WireLine()
Default constructor initialising to all members to zero.
Definition WireLine.h:37
double deltaZ() const
Returns the difference between forward and backward z.
Definition WireLine.h:156
WireLine movedBy(const ROOT::Math::XYZVector &offset) const
Returns a copy of the wire line moved by a three dimensional offset.
Definition WireLine.cc:30
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
Abstract base class for different kinds of events.