ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MdtCalib
MdtCalibFitters
src
CurvedCandidateFinder.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MdtCalibFitters/CurvedCandidateFinder.h
"
6
7
#include "
AthenaKernel/getMessageSvc.h
"
8
#include "GaudiKernel/MsgStream.h"
9
10
using namespace
MuonCalib
;
11
12
CurvedCandidateFinder::CurvedCandidateFinder
(
const
MdtHitVec
&hits) :
m_hits
{hits} {}
13
14
const
std::vector<CurvedLine> &
CurvedCandidateFinder::getCandidates
(
const
double
road_width) {
15
Amg::Vector3D
est_dir(0.0, 0.0, 1.0);
16
return
getCandidates
(road_width, est_dir);
17
}
18
19
//*****************************************************************************
20
21
//::::::::::::::::::::::::::
22
//:: METHOD getCandidates ::
23
//::::::::::::::::::::::::::
24
25
const
std::vector<CurvedLine> &
CurvedCandidateFinder::getCandidates
(
const
double
road_width,
const
Amg::Vector3D
&est_dir) {
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
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
CurvedCandidateFinder.h
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
sign
int sign(int a)
Definition
TRT_StrawNeighbourSvc.h:108
y
#define y
z
#define z
MuonCalib::CurvedCandidateFinder::m_hits
MdtHitVec m_hits
Definition
CurvedCandidateFinder.h:56
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
MuonCalib::CurvedCandidateFinder::MdtHitVec
MuonCalibSegment::MdtHitVec MdtHitVec
Definition
CurvedCandidateFinder.h:37
MuonCalib::CurvedCandidateFinder::m_candidates
std::vector< CurvedLine > m_candidates
Definition
CurvedCandidateFinder.h:60
MuonCalib::CurvedCandidateFinder::CurvedCandidateFinder
CurvedCandidateFinder(const MdtHitVec &hits)
Constructor.
Definition
CurvedCandidateFinder.cxx:12
MuonCalib::CurvedLine
Definition
CurvedLine.h:30
MuonCalib::CurvedLine::getTangent
MTStraightLine getTangent(const double loc_z) const
get the tangent to the line a the local z coordinate "loc_z"
Definition
CurvedLine.cxx:112
MuonCalib::MTStraightLine
Definition
MTStraightLine.h:16
MuonCalib::MTStraightLine::directionVector
Amg::Vector3D directionVector() const
get the direction vector of the straight line
Definition
MTStraightLine.cxx:43
MuonCalib::MTStraightLine::positionVector
Amg::Vector3D positionVector() const
get the position vector of the straight line
Definition
MTStraightLine.cxx:42
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition
CscCalcPed.cxx:21
Generated on
for ATLAS Offline Software by
1.17.0