Belle II Software  release-05-01-25
Circle.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : Circle.cc
5 // Section : Circleing
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a circle
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #define TRGCDC_SHORT_NAMES
15 
16 #include "trg/trg/Constants.h"
17 #include "trg/trg/Point2D.h"
18 #include "trg/cdc/Wire.h"
19 #include "trg/cdc/Link.h"
20 #include "trg/cdc/Circle.h"
21 #include "trg/cdc/CircleFitter.h"
22 #include "trg/cdc/HoughPlane.h"
23 
24 using namespace std;
25 
26 namespace Belle2 {
32  const TRGCDCCircleFitter
33  TRGCDCCircle::_fitter = TRGCDCCircleFitter("TRGCDCCircle Default Fitter");
34 
35  TRGCDCCircle::TRGCDCCircle(const std::vector<TCLink*>& links)
36  : TCTBase("UnknownCircle", 0),
37  _center(ORIGIN),
38  _radius(0),
39  _plane(0)
40  {
41  fitter(& _fitter);
42  append(links);
43  }
44 
45  TRGCDCCircle::TRGCDCCircle(double r,
46  double phi,
47  double charge,
48  const TCHPlane& plane)
49  : TCTBase("unknown", charge),
50  _center(r * cos(phi), r * sin(phi)),
51  _radius(r),
52  _plane(& plane)
53  {
54  fitter(& _fitter);
55  }
56 
58  {
59  }
60 
61  void
62  TRGCDCCircle::dump(const string& cmd, const string& pre) const
63  {
64  cout << pre;
65  cout << "c=" << _center;
66  cout << ":r=" << _radius;
67  if (_plane) cout << ":hp=" << _plane->name();
68  cout << endl;
69  if (cmd.find("detail") != string::npos)
70  TRGCDCTrackBase::dump(cmd, pre);
71  }
72 
73  int
74  TRGCDCCircle::approach2D(TCLink& l) const
75  {
76  HepGeom::Point3D<double> xw = l.cell()->xyPosition();
78 
79  xw.setZ(0.);
81  = _charge * _radius * (xw - xc).unit() + xc;
82  l.positionOnTrack(xv);
83  l.positionOnWire(xw);
84  l.dPhi(0.);
85  return 0;
86  }
87 
89 } // namespace Belle2
Belle2::EvtPDLUtil::charge
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:46
Belle2::ORIGIN
const HepGeom::Point3D< double > ORIGIN
Origin 3D point.
Belle2::TRGCDCTrackBase::_charge
double _charge
Charge.
Definition: TrackBase.h:146
Belle2::TRGCDCTrackBase::dump
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
Definition: TrackBase.cc:66
Belle2::TRGCDCHoughPlaneBase::name
std::string name(void) const
returns name.
Definition: HoughPlaneBase.h:244
Belle2::TRGPoint2D::y
double y(void) const
y of the point
Definition: Point2D.h:103
Belle2::TRGPoint2D::x
double x(void) const
x of the point
Definition: Point2D.h:96
Belle2::TRGCDCCircle::_radius
double _radius
Radius multiplied by charge.
Definition: Circle.h:85
Belle2::TRGCDCCircle::dump
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
dumps debug information.
Definition: Circle.cc:62
Belle2::TRGCDCCircle::_center
TRGPoint2D _center
Position of the circle center.
Definition: Circle.h:82
Belle2::TRGCDCCircle::_plane
const TRGCDCHoughPlane * _plane
Hough plane.
Definition: Circle.h:88
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCCircle::approach2D
int approach2D(TRGCDCLink &) const override
calculate closest approach. Error was happened if return value is not zero.
Definition: Circle.cc:74
Belle2::TRGCDCCircle::~TRGCDCCircle
virtual ~TRGCDCCircle()
Destructor.
Definition: Circle.cc:57
HepGeom::Point3D< double >