# Project CMSSW displayed by LXR

File indexing completed on 2023-10-25 10:03:03

```0001 #ifndef TR_FastCircle_H_
0002 #define TR_FastCircle_H_
0003 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0004 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0005 #include "FWCore/Utilities/interface/Visibility.h"
0006
0007 /**
0008    Calculate circle parameters (x0, y0, rho) for a circle:
0009    (x-x0)^2 + (y-y0)^2 = rho^2
0010    in Global Cartesian Coordinates in the (x,y) plane for a given set of
0011    GlobalPoints. It is done by mapping the points onto the Riemann Sphere
0012    and fit a plane to the transformed coordinates of the points.
0013    The method is described in:
0014
0015    A.Strandlie, J.Wroldsen, R.Fruehwirth, B.Lillekjendlie:
0016    Particle tracks fitted on the Riemann sphere
0017    Computer Physics Communications 131 (2000) 95-108, 18 January 2000
0018
0019    Implementation: Matthias Winkler, 14 February 2001
0020
0021    This implementation is a specialized version of the general Circle class
0022    for three points.
0023
0024    Update 14.02.2001: For 3 Points (2 RecHits + Vertex) the plain parameters
0025                       n1*x + n2*y + n3*z + c = 0
0026                       are analytically calculable.
0027    Update 14.02.2001: In the case that a circle fit is not possible (points
0028                       are along a straight line) the parameters of the
0029               straight line can be used:
0030               c + n1*x + n2*y = 0
0031  */
0032
0033 class FastCircle {
0034 public:
0035   FastCircle(const GlobalPoint& outerHit, const GlobalPoint& middleHit, const GlobalPoint& aVertex);
0036
0037   FastCircle(const GlobalPoint& outerHit, const GlobalPoint& middleHit, const GlobalPoint& aVertex, double norm);
0038
0039   ~FastCircle() {}
0040
0041   // all returned values have dimensions of cm
0042   // parameters of the circle (circle is valid)
0043   double x0() const { return theX0; }
0044
0045   double y0() const { return theY0; }
0046
0047   double rho() const { return theRho; }
0048
0049   bool isValid() const { return theValid; }
0050
0051   bool isLine() const { return theIsLine; }
0052
0053   // parameters of the straight line
0054   // (if circle is invalid only these are available)
0055   double n1() const { return theN1; }
0056
0057   double n2() const { return theN2; }
0058
0059   double c() const { return theC; }
0060
0061   GlobalPoint const& outerPoint() const { return theOuterPoint; }
0062   GlobalPoint const& innerPoint() const { return theInnerPoint; }
0063   GlobalPoint const& vertexPoint() const { return theVertexPoint; }
0064
0065 private:
0066   GlobalPoint theOuterPoint;
0067   GlobalPoint theInnerPoint;
0068   GlobalPoint theVertexPoint;
0069   double theNorm;
0070
0071   double theX0;
0072   double theY0;
0073   double theRho;
0074
0075   double theN1;
0076   double theN2;
0077   double theC;
0078
0079   bool theValid;
0080   bool theIsLine;
0081
0082   void createCircleParameters() dso_hidden;
0083 };
0084
0085 #endif  //TR_Circle_H_```