CMS 3D CMS Logo

ConformalMappingFit.cc
Go to the documentation of this file.
1 #include "ConformalMappingFit.h"
2 
3 using namespace std;
4 
5 template <class T>
6 T sqr(T t) {
7  return t * t;
8 }
9 
10 ConformalMappingFit::ConformalMappingFit(const std::vector<PointXY>& hits,
11  const std::vector<float>& errRPhi2,
12  const Rotation* rot)
13  : theRotation(rot), myRotation(rot == nullptr) {
15  int hits_size = hits.size();
16  for (int i = 0; i < hits_size; i++) {
17  if (!theRotation)
18  findRot(hits[i]);
19  PointUV point(hits[i], 1. / errRPhi2[i], theRotation);
20  theFit.addPoint(point.u(), point.v(), point.weight());
21  }
22 }
23 
25  myRotation = true;
26  typedef Rotation::GlobalVector GlobalVector; // ::GlobalVector is float!
27  GlobalVector aX = GlobalVector(p.x(), p.y(), 0.).unit();
28  GlobalVector aY(-aX.y(), aX.x(), 0.);
29  GlobalVector aZ(0., 0., 1.);
30  theRotation = new Rotation(aX, aY, aZ);
31 }
32 
34  if (myRotation)
35  delete theRotation;
36 }
37 
38 double ConformalMappingFit::phiRot() const { return atan2(theRotation->xy(), theRotation->xx()); }
39 
41  double val = fabs(2. * theFit.parA());
42  double err = 2. * sqrt(theFit.varAA());
43  return Measurement1D(val, err);
44 }
45 
47  double val = phiRot() + atan(theFit.parB());
48  double err = sqrt(theFit.varBB());
49  return Measurement1D(val, err);
50 }
51 
53  double val = -theFit.parC();
54  double err = sqrt(theFit.varCC());
55  return Measurement1D(val, err);
56 }
57 
58 int ConformalMappingFit::charge() const { return (theFit.parA() > 0.) ? -1 : 1; }
double parC() const
Definition: ParabolaFit.h:40
T xx() const
double varCC() const
Definition: ParabolaFit.h:55
Measurement1D curvature() const
const Rotation * theRotation
#define nullptr
T y() const
Definition: PV3DBase.h:60
Measurement1D directionPhi() const
T xy() const
double varBB() const
Definition: ParabolaFit.h:50
void findRot(const PointXY &)
Measurement1D impactParameter() const
T sqrt(T t)
Definition: SSEVec.h:19
void addPoint(double x, double y)
Definition: ParabolaFit.cc:9
T y() const
Cartesian y coordinate.
ConformalMappingFit(const std::vector< PointXY > &hits, const std::vector< float > &errRPhi2, const Rotation *rotation=nullptr)
Vector3DBase unit() const
Definition: Vector3DBase.h:54
double parB() const
Definition: ParabolaFit.h:35
TkRotation< double > Rotation
double parA() const
Definition: ParabolaFit.h:30
T sqr(T t)
long double T
T x() const
Definition: PV3DBase.h:59
double varAA() const
Definition: ParabolaFit.h:45
T x() const
Cartesian x coordinate.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
Global3DVector GlobalVector
Definition: GlobalVector.h:10