Belle II Software  release-06-01-15
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 
23 using namespace std;
24 
25 namespace Belle2 {
31  const TRGCDCCircleFitter
32  TRGCDCCircle::_fitter = TRGCDCCircleFitter("TRGCDCCircle Default Fitter");
33 
34  TRGCDCCircle::TRGCDCCircle(const std::vector<TCLink*>& links)
35  : TCTBase("UnknownCircle", 0),
36  _center(ORIGIN),
37  _radius(0),
38  _plane(0)
39  {
40  fitter(& _fitter);
41  append(links);
42  }
43 
44  TRGCDCCircle::TRGCDCCircle(double r,
45  double phi,
46  double charge,
47  const TCHPlane& 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 
56  TRGCDCCircle::~TRGCDCCircle()
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();
76  HepGeom::Point3D<double> xc(_center.x(), _center.y(), 0.);
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
const HepGeom::Point3D< double > ORIGIN
Origin 3D point.
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44
Abstract base class for different kinds of events.