Belle II Software  release-05-01-25
ParameterLine2D.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/geometry/ParameterLine2D.h>
11 
12 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
13 
14 #include <ostream>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
20  const double fromSignedRadius,
21  const Vector2D& toCenter,
22  const double toSignedRadius)
23 {
24  Vector2D connecting = toCenter - fromCenter;
25 
26  // Normalize to the coordinate system vector, but keep the original norm
27  const double norm = connecting.normalize();
28 
29  double kappa = (fromSignedRadius - toSignedRadius) / norm;
30  double cokappa = sqrt(1 - kappa * kappa);
31 
32  Vector2D fromPos = Vector2D(connecting, kappa * fromSignedRadius, cokappa * fromSignedRadius);
33  fromPos += fromCenter;
34 
35  Vector2D toPos = Vector2D(connecting, kappa * toSignedRadius, cokappa * toSignedRadius);
36  toPos += toCenter;
37 
38  return ParameterLine2D::throughPoints(fromPos, toPos);
39 }
40 
41 std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const ParameterLine2D& line)
42 {
43  output << "ParameterLine2D(" << line.support() << "," << line.tangential() << ")";
44  return output;
45 }
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::ParameterLine2D::touchingCircles
static ParameterLine2D touchingCircles(const Vector2D &fromCenter, double fromSignedRadius, const Vector2D &toCenter, double toSignedRadius)
Constructs a line touching two circles in one point each.
Definition: ParameterLine2D.cc:19
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::Vector2D::normalize
double normalize()
Normalizes the vector to unit length.
Definition: Vector2D.h:317
Belle2::TrackFindingCDC::ParameterLine2D
A line with a support point and tangential vector.
Definition: ParameterLine2D.h:48
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::ParameterLine2D::throughPoints
static ParameterLine2D throughPoints(const Vector2D &start, const Vector2D &end)
Static constructor for a line between to points.
Definition: ParameterLine2D.h:92