ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ThreePointCircle Class Reference

#include <PRD_TruthTrajectorySelectorID.h>

Collaboration diagram for ThreePointCircle:

Public Member Functions

 ThreePointCircle (const std::vector< Amg::Vector3D > &vecPoints)
 The constructor from three points. More...
 
 ~ThreePointCircle ()
 Destructor. More...
 
const Amg::Vector2Dcenter () const
 center More...
 
const Amg::Translation3DframeTranslation () const
 Translation. More...
 
ThreePointCircleoperator= (const ThreePointCircle &)=delete
 
 ThreePointCircle (const ThreePointCircle &)=delete
 
double d0 () const
 
double z0 () const
 
double phi0 () const
 
double eta () const
 
double pT () const
 
double radius () const
 

Private Member Functions

void constructCircle (const Amg::Vector3D &, const Amg::Vector3D &, const Amg::Vector3D &)
 

Private Attributes

Amg::Translation3Dm_translation
 
double m_d0
 
double m_z0
 
double m_phi0
 
double m_eta
 
double m_pt
 
double m_radius {}
 
Amg::Vector2D m_center
 

Detailed Description

Definition at line 16 of file PRD_TruthTrajectorySelectorID.h.

Constructor & Destructor Documentation

◆ ThreePointCircle() [1/2]

ThreePointCircle::ThreePointCircle ( const std::vector< Amg::Vector3D > &  vecPoints)

The constructor from three points.

Definition at line 42 of file PRD_TruthTrajectorySelectorID.cxx.

42  :
43  m_translation(nullptr), m_d0(0.), m_z0(0.), m_phi0(0.), m_eta(0.), m_pt(0.)
44 {
45  if (posVec.size() <3)
46  std::cout << "[WARNING] not enough points" << std::endl;
47  else
48  constructCircle(posVec[0],posVec[1],posVec[2]);
49 }

◆ ~ThreePointCircle()

ThreePointCircle::~ThreePointCircle ( )

Destructor.

Definition at line 51 of file PRD_TruthTrajectorySelectorID.cxx.

52 {
53  delete m_translation;
54 }

◆ ThreePointCircle() [2/2]

ThreePointCircle::ThreePointCircle ( const ThreePointCircle )
delete

Member Function Documentation

◆ center()

const Amg::Vector2D & ThreePointCircle::center ( ) const
inline

center

Definition at line 62 of file PRD_TruthTrajectorySelectorID.h.

62 { return m_center; }

◆ constructCircle()

void ThreePointCircle::constructCircle ( const Amg::Vector3D p1,
const Amg::Vector3D p2,
const Amg::Vector3D p3 
)
private

Definition at line 56 of file PRD_TruthTrajectorySelectorID.cxx.

58  {
59 
60  // get the (x/y) coordinates of all points
61  double translationX = m_translation ? -(m_translation->translation()).x() : 0.;
62  double translationY = m_translation ? -(m_translation->translation()).y() : 0.;
63 
64  double bx = p1.x()+translationX;
65  double by = p1.y()+translationY;
66  double cx = p2.x()+translationX;
67  double cy = p2.y()+translationY;
68  double dx = p3.x()+translationX;
69  double dy = p3.y()+translationY;
70 
71  double temp = cx*cx+cy*cy;
72 
73  // prepare the matrix for the linear equation
74  double bc = (bx*bx + by*by - temp)/2.0;
75  double cd = (temp - dx*dx - dy*dy)/2.0;
76  double det = (bx-cx)*(cy-dy)-(cx-dx)*(by-cy);
77  //if (std::abs(det) < 1.0e-6) {
78  //std::cout << "[WARNING] Determinant is close to 0 " << std::endl;
79  //}
80 
81  // invert the determinant
82  det = 1./det;
83 
84  // x / y coordinate of the center
85  double cRx= (bc*(cy-dy)-cd*(by-cy))*det;
86  double cRy = ((bx-cx)*cd-(cx-dx)*bc)*det;
87 
88  // get the center, radius and momentum
89  m_center = Amg::Vector2D(cRx,cRy);
90  m_radius = sqrt((cRx-bx)*(cRx-bx)+(cRy-by)*(cRy-by));
91  m_pt = m_radius*(0.3*2.);
92 
93  // transverse parameters
94  m_d0 = std::sqrt(cRx*cRx+cRy*cRy)-m_radius;
95 
96  // longitudinal parameters
97  double theta = 1./3*(p1.theta() + p2.theta() + p3.theta());
98  double r1 = p1.perp();
99  double z1 = p1.z();
100  double deltaz = r1/tan(theta);
101  m_z0 = z1 - deltaz;
102  // eta
103  m_eta = 1./3*(p1.eta() + p2.eta() + p3.eta());
104 
105  // get the point of closest approach
106  Amg::Vector2D poca = -m_d0*m_center.unit();
107 
108  // find the closest measurement
109  Amg::Vector2D closestMeasurement = p1.perp() < p2.perp() ?
110  Amg::Vector2D(p1.x(),p1.y()) : Amg::Vector2D(p2.x(),p2.y());
111  if (p3.perp() < p1.perp()) closestMeasurement = Amg::Vector2D(p3.x(),p3.y());
112 
113  // phi0 is the most difficult one, two solution possible
114  Amg::Vector2D directionOne(-cRy,cRx);
115  Amg::Vector2D directionTwo(cRy,-cRx);
116 
117  // build difference vector closest measurement, poca
118  Amg::Vector2D toFirstMeas(closestMeasurement-poca);
119 
120  // check with scalar product
121  m_phi0 = directionOne.dot(toFirstMeas) > 0. ? directionOne.phi() : directionTwo.phi();
122 
123  // now sign d0
124  Amg::Vector3D pocaDir(poca.x(),poca.y(),0.);
126  double signD0 = pocaDir.cross(momDir).z() > 0. ? 1. : -1.;
127  m_d0 = signD0 * std::abs(m_d0);
128 
129  // update the center for the translation
130  m_center += Amg::Vector2D(translationX,translationY);
131 
132 }

◆ d0()

double ThreePointCircle::d0 ( ) const
inline

Definition at line 55 of file PRD_TruthTrajectorySelectorID.h.

55 { return m_d0; }

◆ eta()

double ThreePointCircle::eta ( ) const
inline

Definition at line 58 of file PRD_TruthTrajectorySelectorID.h.

58 { return m_eta; }

◆ frameTranslation()

const Amg::Translation3D * ThreePointCircle::frameTranslation ( ) const
inline

Translation.

Definition at line 64 of file PRD_TruthTrajectorySelectorID.h.

64 { return m_translation; }

◆ operator=()

ThreePointCircle& ThreePointCircle::operator= ( const ThreePointCircle )
delete

◆ phi0()

double ThreePointCircle::phi0 ( ) const
inline

Definition at line 57 of file PRD_TruthTrajectorySelectorID.h.

57 { return m_phi0; }

◆ pT()

double ThreePointCircle::pT ( ) const
inline

Definition at line 59 of file PRD_TruthTrajectorySelectorID.h.

59 { return m_pt; }

◆ radius()

double ThreePointCircle::radius ( ) const
inline

Definition at line 60 of file PRD_TruthTrajectorySelectorID.h.

60 { return m_radius; }

◆ z0()

double ThreePointCircle::z0 ( ) const
inline

Definition at line 56 of file PRD_TruthTrajectorySelectorID.h.

56 { return m_z0; }

Member Data Documentation

◆ m_center

Amg::Vector2D ThreePointCircle::m_center
private

Definition at line 51 of file PRD_TruthTrajectorySelectorID.h.

◆ m_d0

double ThreePointCircle::m_d0
private

Definition at line 49 of file PRD_TruthTrajectorySelectorID.h.

◆ m_eta

double ThreePointCircle::m_eta
private

Definition at line 49 of file PRD_TruthTrajectorySelectorID.h.

◆ m_phi0

double ThreePointCircle::m_phi0
private

Definition at line 49 of file PRD_TruthTrajectorySelectorID.h.

◆ m_pt

double ThreePointCircle::m_pt
private

Definition at line 49 of file PRD_TruthTrajectorySelectorID.h.

◆ m_radius

double ThreePointCircle::m_radius {}
private

Definition at line 50 of file PRD_TruthTrajectorySelectorID.h.

◆ m_translation

Amg::Translation3D* ThreePointCircle::m_translation
private

Definition at line 47 of file PRD_TruthTrajectorySelectorID.h.

◆ m_z0

double ThreePointCircle::m_z0
private

Definition at line 49 of file PRD_TruthTrajectorySelectorID.h.


The documentation for this class was generated from the following files:
ThreePointCircle::m_phi0
double m_phi0
Definition: PRD_TruthTrajectorySelectorID.h:49
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
ThreePointCircle::m_z0
double m_z0
Definition: PRD_TruthTrajectorySelectorID.h:49
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
x
#define x
PlotCalibFromCool.cx
cx
Definition: PlotCalibFromCool.py:666
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
ThreePointCircle::m_eta
double m_eta
Definition: PRD_TruthTrajectorySelectorID.h:49
ThreePointCircle::m_pt
double m_pt
Definition: PRD_TruthTrajectorySelectorID.h:49
fitman.bx
bx
Definition: fitman.py:410
ThreePointCircle::m_d0
double m_d0
Definition: PRD_TruthTrajectorySelectorID.h:49
fitman.by
by
Definition: fitman.py:411
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
ThreePointCircle::m_translation
Amg::Translation3D * m_translation
Definition: PRD_TruthTrajectorySelectorID.h:47
ThreePointCircle::m_radius
double m_radius
Definition: PRD_TruthTrajectorySelectorID.h:50
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ThreePointCircle::m_center
Amg::Vector2D m_center
Definition: PRD_TruthTrajectorySelectorID.h:51
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
y
#define y
PlotCalibFromCool.cy
cy
Definition: PlotCalibFromCool.py:667
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
calibdata.cd
cd
Definition: calibdata.py:51
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
MCP::ScaleSmearParam::r1
@ r1
TRTCalib_cfilter.p3
p3
Definition: TRTCalib_cfilter.py:132
ThreePointCircle::constructCircle
void constructCircle(const Amg::Vector3D &, const Amg::Vector3D &, const Amg::Vector3D &)
Definition: PRD_TruthTrajectorySelectorID.cxx:56