ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
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. More...
 
const std::vector< CurvedLine > & getCandidates (const double &road_width)
 get all candidates connecting all hits within the given road width (mm) More...
 
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 More...
 

Private Attributes

MdtHitVec m_hits
 
std::vector< CurvedLinem_candidates
 

Detailed Description

Definition at line 35 of file CurvedCandidateFinder.h.

Member Typedef Documentation

◆ MdtHitPtr

Definition at line 38 of file CurvedCandidateFinder.h.

◆ MdtHitVec

Definition at line 37 of file CurvedCandidateFinder.h.

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.

12 : m_hits{hits} {}

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 }

◆ 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  Amg::Vector3D mem(points[l]);
111  points[l][1] = (hit[l]->localPosition().y() + aux_dir.y());
112  points[l][2] = (hit[l]->localPosition().z() + aux_dir.z());
113  }
114 
115  // count the number of hits on the line within the given road width //
116  for (auto & ihit : m_hits) {
117  MTStraightLine w(Amg::Vector3D(0.0, ihit->localPosition().y(), ihit->localPosition().z()), xhat, null, null);
118  double d(std::abs((cand_line.getTangent(ihit->localPosition().z())).signDistFrom(w)));
119  if (std::abs(ihit->driftRadius() - d) < road_width) { nb_hits++; }
120  }
121 
122  // add the candidate line to list of candidates if there are enough hits //
123  if (nb_hits == m_hits.size()) { m_candidates.push_back(cand_line); }
124  }
125  }
126  }
127 
128  return m_candidates;
129 }

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:
hist_file_dump.d
d
Definition: hist_file_dump.py:137
MuonCalib::CurvedLine
Definition: CurvedLine.h:31
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::CurvedCandidateFinder::getCandidates
const std::vector< CurvedLine > & getCandidates(const double &road_width)
get all candidates connecting all hits within the given road width (mm)
Definition: CurvedCandidateFinder.cxx:14
z
#define z
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:127
keylayer_zslicemap.max_z
max_z
Definition: keylayer_zslicemap.py:110
keylayer_zslicemap.min_z
min_z
Definition: keylayer_zslicemap.py:111
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonCalib::CurvedCandidateFinder::m_candidates
std::vector< CurvedLine > m_candidates
Definition: CurvedCandidateFinder.h:60
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::MTStraightLine
Definition: MTStraightLine.h:16
MuonCalib::CurvedCandidateFinder::m_hits
MdtHitVec m_hits
Definition: CurvedCandidateFinder.h:56
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
fitman.k
k
Definition: fitman.py:528