Belle II Software development
Circle.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
9//-----------------------------------------------------------------------------
10// Description : A class to represent a circle
11//-----------------------------------------------------------------------------
12
13#define TRGCDC_SHORT_NAMES
14
15#include "trg/trg/Constants.h"
16#include "trg/trg/Point2D.h"
17#include "trg/cdc/Wire.h"
18#include "trg/cdc/Link.h"
19#include "trg/cdc/Circle.h"
20#include "trg/cdc/CircleFitter.h"
21#include "trg/cdc/HoughPlane.h"
22
23using namespace std;
24
25namespace Belle2 {
31 const TRGCDCCircleFitter
32 TRGCDCCircle::_fitter = TRGCDCCircleFitter("TRGCDCCircle Default Fitter");
33
34 TRGCDCCircle::TRGCDCCircle(const std::vector<TRGCDCLink*>& links)
35 : TCTBase("UnknownCircle", 0),
36 _center(ORIGIN),
37 _radius(0),
38 _plane(0)
39 {
40 fitter(& _fitter);
42 }
43
44 TRGCDCCircle::TRGCDCCircle(double r,
45 double phi,
46 double charge,
47 const TRGCDCHoughPlane& plane)
48 : TCTBase("unknown", charge),
49 _center(r * cos(phi), r * sin(phi)),
50 _radius(r),
51 _plane(& plane)
52 {
53 fitter(& _fitter);
54 }
55
57 {
58 }
59
60 void
61 TRGCDCCircle::dump(const string& cmd, const string& pre) const
62 {
63 cout << pre;
64 cout << "c=" << _center;
65 cout << ":r=" << _radius;
66 if (_plane) cout << ":hp=" << _plane->name();
67 cout << endl;
68 if (cmd.find("detail") != string::npos)
69 TRGCDCTrackBase::dump(cmd, pre);
70 }
71
72 int
73 TRGCDCCircle::approach2D(TCLink& l) const
74 {
75 HepGeom::Point3D<double> xw = l.cell()->xyPosition();
77
78 xw.setZ(0.);
80 = _charge * _radius * (xw - xc).unit() + xc;
81 l.positionOnTrack(xv);
82 l.positionOnWire(xw);
83 l.dPhi(0.);
84 return 0;
85 }
86
88} // namespace Belle2
TRGPoint2D _center
Position of the circle center.
Definition: Circle.h:81
double _radius
Radius multiplied by charge.
Definition: Circle.h:84
const TRGCDCHoughPlane * _plane
Hough plane.
Definition: Circle.h:87
A class to represent a Hough parameter plane.
Definition: HoughPlane.h:30
double _charge
Charge.
Definition: TrackBase.h:148
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TrackBase.cc:65
double y(void) const
y of the point
Definition: Point2D.h:99
int approach2D(TRGCDCLink &) const override
calculate closest approach. Error was happened if return value is not zero.
Definition: Circle.cc:73
static const TRGCDCCircleFitter _fitter
Default fitter.
Definition: Circle.h:90
virtual ~TRGCDCCircle()
Destructor.
Definition: Circle.cc:56
const TRGCDCFitter * fitter(void) const
returns a pointer to a default fitter.
Definition: TrackBase.h:262
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: Circle.cc:61
double x(void) const
x of the point
Definition: Point2D.h:92
std::string name(void) const
returns name.
const std::vector< TRGCDCLink * > & links(void) const
returns a vector to track segments.
Definition: TrackBase.cc:123
const HepGeom::Point3D< double > ORIGIN
Origin 3D point.
void append(TRGCDCLink *)
appends a link.
Definition: TrackBase.cc:108
Abstract base class for different kinds of events.
STL namespace.