ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::CurvedCandidateFinder Class Reference

#include <CurvedCandidateFinder.h>

Collaboration diagram for MuonCalib::CurvedCandidateFinder:

Public Types

using MdtHitVec = MuonCalibSegment::MdtHitVec
using MdtHitPtr = MuonCalibSegment::MdtHitPtr

Public Member Functions

 CurvedCandidateFinder (const MdtHitVec &hits)
 Constructor.
const std::vector< CurvedLine > & getCandidates (const double road_width)
 get all candidates connecting all hits within the given road width (mm)
const std::vector< CurvedLine > & getCandidates (const double road_width, const Amg::Vector3D &est_dir)
 get all candidates connecting all hits within the given road width (mm); est_dir is the estimated direction of incidence

Private Attributes

MdtHitVec m_hits
std::vector< CurvedLinem_candidates

Detailed Description

Definition at line 35 of file CurvedCandidateFinder.h.

Member Typedef Documentation

◆ MdtHitPtr

◆ MdtHitVec

Constructor & Destructor Documentation

◆ CurvedCandidateFinder()

CurvedCandidateFinder::CurvedCandidateFinder ( const MdtHitVec & hits)

Constructor.

Parameters
hitsVector of hits used in the candidate finding.

Definition at line 12 of file CurvedCandidateFinder.cxx.

Member Function Documentation

◆ getCandidates() [1/2]

const std::vector< CurvedLine > & CurvedCandidateFinder::getCandidates ( const double road_width)

get all candidates connecting all hits within the given road width (mm)

Definition at line 14 of file CurvedCandidateFinder.cxx.

14 {
15 Amg::Vector3D est_dir(0.0, 0.0, 1.0);
16 return getCandidates(road_width, est_dir);
17}
const std::vector< CurvedLine > & getCandidates(const double road_width)
get all candidates connecting all hits within the given road width (mm)
Eigen::Matrix< double, 3, 1 > Vector3D

◆ getCandidates() [2/2]

const std::vector< CurvedLine > & CurvedCandidateFinder::getCandidates ( const double road_width,
const Amg::Vector3D & est_dir )

get all candidates connecting all hits within the given road width (mm); est_dir is the estimated direction of incidence

Definition at line 25 of file CurvedCandidateFinder.cxx.

25 {
27 // RETURN IF THERE ARE NOT ENOUGH HITS //
29
30 if (m_hits.size() < 3) {
31 MsgStream log(Athena::getMessageSvc(), "CurvedCandidateFinder");
32 log << MSG::WARNING << "Class CurvedCandidateFinder, method getCandidates: Not enough hits to determine a parabola!" << endmsg;
33 }
34
36 // VARIABLES //
38
39 std::array<MdtHitPtr, 3> hit; // three hits defining the candidate line
40 double min_z, max_z, dist(0.0); // auxialiary variables to define the points
41 std::vector<Amg::Vector3D> points(3); // points defining the curved candidate line
42 std::array<int,3> sign {}; // auxiliary sign array
43 Amg::Vector3D null(0.0, 0.0, 0.0); // auxiliary 0 vector
44 Amg::Vector3D xhat(1.0, 0.0, 0.0); // auxiliary unit vector
45 Amg::Vector3D shift_vec(0.0, est_dir.z(), -est_dir.y());
46 shift_vec = shift_vec.unit();
47
49 // FIND THREE HITS WITH LARGEST SEPARATION //
51
52 hit[0] = m_hits[0];
53 hit[2] = m_hits[0];
54
55 min_z = hit[0]->localPosition().z();
56 max_z = hit[2]->localPosition().z();
57
58 // get the points with the smallest and largest local z coordinate //
59 for (unsigned int k = 1; k < m_hits.size(); k++) {
60 if (m_hits[k]->localPosition().z() < min_z) {
61 min_z = m_hits[k]->localPosition().z();
62 hit[0] = m_hits[k];
63 }
64 if (m_hits[k]->localPosition().z() > max_z) {
65 max_z = m_hits[k]->localPosition().z();
66 hit[2] = m_hits[k];
67 }
68 }
69
70 // find a third hit with large separation from these two points //
71 for (auto & ihit : m_hits) {
72 if (ihit != hit[0] && ihit != hit[2]) {
73 if (!hit[1]) {
74 hit[1] = ihit;
75 dist = (hit[2]->localPosition().z() - hit[1]->localPosition().z()) -
76 (hit[1]->localPosition().z() - hit[0]->localPosition().z());
77 } else {
78 if (dist < (hit[2]->localPosition().z() - ihit->localPosition().z()) -
79 (ihit->localPosition().z() - hit[0]->localPosition().z())) {
80 dist = (hit[2]->localPosition().z() - ihit->localPosition().z()) -
81 (ihit->localPosition().z() - hit[0]->localPosition().z());
82 hit[1] = ihit;
83 }
84 }
85 }
86 }
87
89 // CALCULATE CANDIDATE LINES AND COUNT THE NUMBER OF HITS ON THEM //
91
92 // clear candidate vector //
93 m_candidates.clear();
94
95 // search for the candidates //
96 for (sign[0] = -1; sign[0] < 2; sign[0] = sign[0] + 2) {
97 for (sign[1] = -1; sign[1] < 2; sign[1] = sign[1] + 2) {
98 for (sign[2] = -1; sign[2] < 2; sign[2] = sign[2] + 2) {
99 // get a candidate //
100 unsigned int nb_hits(0);
101 for (unsigned int l = 0; l < 3; l++) { points[l] = hit[l]->localPosition() + sign[l] * hit[l]->driftRadius() * shift_vec; }
102 CurvedLine cand_line(points);
103
104 // refine the candidate //
105 for (unsigned int l = 0; l < 3; l++) {
106 MTStraightLine tangent(cand_line.getTangent(hit[l]->localPosition().z()));
107 Amg::Vector3D delta(tangent.positionVector() - hit[l]->localPosition());
108 Amg::Vector3D aux_dir(delta + (delta.dot(tangent.directionVector().unit()) * tangent.directionVector().unit()));
109 aux_dir = hit[l]->driftRadius() * aux_dir.unit();
110 points[l][1] = (hit[l]->localPosition().y() + aux_dir.y());
111 points[l][2] = (hit[l]->localPosition().z() + aux_dir.z());
112 }
113
114 // count the number of hits on the line within the given road width //
115 for (auto & ihit : m_hits) {
116 MTStraightLine w(Amg::Vector3D(0.0, ihit->localPosition().y(), ihit->localPosition().z()), xhat, null, null);
117 double d(std::abs((cand_line.getTangent(ihit->localPosition().z())).signDistFrom(w)));
118 if (std::abs(ihit->driftRadius() - d) < road_width) { nb_hits++; }
119 }
120
121 // add the candidate line to list of candidates if there are enough hits //
122 if (nb_hits == m_hits.size()) { m_candidates.push_back(cand_line); }
123 }
124 }
125 }
126
127 return m_candidates;
128}
#define endmsg
int sign(int a)
#define y
#define z
std::vector< CurvedLine > m_candidates
IMessageSvc * getMessageSvc(bool quiet=false)
l
Printing final latex table to .tex output file.

Member Data Documentation

◆ m_candidates

std::vector<CurvedLine> MuonCalib::CurvedCandidateFinder::m_candidates
private

Definition at line 60 of file CurvedCandidateFinder.h.

◆ m_hits

MdtHitVec MuonCalib::CurvedCandidateFinder::m_hits
private

Definition at line 56 of file CurvedCandidateFinder.h.


The documentation for this class was generated from the following files: