ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TrkDriftCircleMath::TangentToCircles Class Reference

#include <TangentToCircles.h>

Collaboration diagram for TrkDriftCircleMath::TangentToCircles:

Public Types

typedef std::vector< LineLineVec
 

Public Member Functions

 TangentToCircles ()
 
void debug (bool debug)
 

Static Public Member Functions

static LineVec tangentLines (const DriftCircle &dc1, const DriftCircle &dc2)
 

Private Attributes

bool m_debug
 

Detailed Description

Definition at line 16 of file TangentToCircles.h.

Member Typedef Documentation

◆ LineVec

Definition at line 18 of file TangentToCircles.h.

Constructor & Destructor Documentation

◆ TangentToCircles()

TrkDriftCircleMath::TangentToCircles::TangentToCircles ( )
inline

Definition at line 21 of file TangentToCircles.h.

21 : m_debug(false) {}

Member Function Documentation

◆ debug()

void TrkDriftCircleMath::TangentToCircles::debug ( bool  debug)
inline

Definition at line 25 of file TangentToCircles.h.

25 { m_debug = debug; }

◆ tangentLines()

TangentToCircles::LineVec TrkDriftCircleMath::TangentToCircles::tangentLines ( const DriftCircle dc1,
const DriftCircle dc2 
)
static

Definition at line 11 of file TangentToCircles.cxx.

11  {
12  LineVec lines;
13  lines.reserve(4);
14 
15  double DeltaX = dc2.x() - dc1.x();
16  double DeltaY = dc2.y() - dc1.y();
17  double DistanceOfCenters = std::hypot(DeltaX, DeltaY);
18  if (DistanceOfCenters == 0.) {
19  std::cout << " TangentToCircles::tangentLines >>> ERROR same tube on input " << std::endl;
20  return lines;
21  }
22  double Alpha0 = std::atan2(DeltaY, DeltaX);
23 
24  // Case of 0 drift distances, only 1 line
25  if (dc1.r() == 0. && dc2.r() == 0.) {
26  lines.emplace_back(dc1.position(), Alpha0);
27  return lines;
28  }
29 
30  // Here are the first 2 "inner" lines ....
31  double RSum = dc1.r() + dc2.r();
32 
33  double ratio = RSum / DistanceOfCenters;
34  if (std::abs(ratio) > 1.) return lines;
35 
36  double Alpha1 = std::asin(ratio);
37 
38  double line_phi = Alpha0 + Alpha1;
39  LocVec2D pos1(dc1.x() + dc1.r() * std::sin(line_phi), dc1.y() - dc1.r() * std::cos(line_phi));
40  lines.emplace_back(pos1, line_phi);
41 
42  line_phi = Alpha0 - Alpha1;
43  LocVec2D pos2(dc1.x() - dc1.r() * std::sin(line_phi), dc1.y() + dc1.r() * std::cos(line_phi));
44  lines.emplace_back(pos2, line_phi);
45 
46  // Case where one of the drifts is 0 ==> Only two lines
47  if (dc1.r() == 0. || dc2.r() == 0.) return lines;
48 
49  // ... and here are the other 2 "outer" lines
50  double DeltaR = std::abs(dc2.r() - dc1.r());
51 
52  ratio = DeltaR / DistanceOfCenters;
53  if (std::abs(ratio) > 1.) return lines;
54 
55  double Alpha2 = asin(ratio);
56 
57  if (dc1.r() < dc2.r()) {
58  line_phi = Alpha0 + Alpha2;
59  LocVec2D pos3(dc1.x() - dc1.r() * sin(line_phi), dc1.y() + dc1.r() * cos(line_phi));
60  lines.emplace_back(pos3, line_phi);
61 
62  line_phi = Alpha0 - Alpha2;
63  LocVec2D pos4(dc1.x() + dc1.r() * std::sin(line_phi), dc1.y() - dc1.r() * std::cos(line_phi));
64  lines.emplace_back(pos4, line_phi);
65 
66  } else {
67  line_phi = Alpha0 + Alpha2;
68  LocVec2D pos3(dc1.x() + dc1.r() * std::sin(line_phi), dc1.y() - dc1.r() * std::cos(line_phi));
69  lines.emplace_back(pos3, line_phi);
70 
71  line_phi = Alpha0 - Alpha2;
72  LocVec2D pos4(dc1.x() - dc1.r() * std::sin(line_phi), dc1.y() + dc1.r() * std::cos(line_phi));
73  lines.emplace_back(pos4, line_phi);
74  }
75  return lines;
76  }

Member Data Documentation

◆ m_debug

bool TrkDriftCircleMath::TangentToCircles::m_debug
private

Definition at line 28 of file TangentToCircles.h.


The documentation for this class was generated from the following files:
met::DeltaR
@ DeltaR
Definition: METRecoCommon.h:11
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
CaloCondBlobAlgs_fillNoiseFromASCII.lines
lines
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:104
TrkDriftCircleMath::TangentToCircles::m_debug
bool m_debug
Definition: TangentToCircles.h:28
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
TrkDriftCircleMath::TangentToCircles::debug
void debug(bool debug)
Definition: TangentToCircles.h:25
TrkDriftCircleMath::TangentToCircles::LineVec
std::vector< Line > LineVec
Definition: TangentToCircles.h:18