ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigL2MuonSA
src
TgcFit.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef TRIGL2MUONSA_TGCFIT_H
6
#define TRIGL2MUONSA_TGCFIT_H
7
8
#include "
AthenaBaseComps/AthAlgTool.h
"
9
10
#include "GaudiKernel/StatusCode.h"
11
#include "
GeoPrimitives/GeoPrimitives.h
"
12
#include "
GeoPrimitives/GeoPrimitivesHelpers.h
"
13
14
#include "
TgcFitResult.h
"
15
16
namespace
TrigL2MuonSA
{
17
18
/*
19
* Statistical routines and fit information (TGC points, statistics, etc.).
20
*/
21
class
TgcFit
:
public
AthAlgTool
22
{
23
public
:
24
enum
Status
25
{
26
FIT_NONE
,
27
FIT_POINT
,
28
FIT_LINE
29
};
30
/*
31
* A 2D point used in statistics and fits.
32
* X is always the Z-value of a digit and Y is either phi or eta.
33
*/
34
struct
Point
35
{
36
int
nIdx
;
37
int
nStation
;
38
double
fX
;
39
double
fY
;
40
bool
bOutlier
;
41
double
fW
;
42
double
fChi2
;
43
44
/*
45
* Default constructor.
46
*/
47
Point
() :
nIdx
(0),
nStation
(0),
fX
(0.0),
fY
(0.0),
bOutlier
(false),
fW
(0.0),
fChi2
(0.0)
48
{}
49
/*
50
* Constructor.
51
*/
52
Point
(
int
nIdx
,
int
nStation
,
double
fX
,
double
fY
,
double
fW
= 1.0) :
53
nIdx
(
nIdx
),
nStation
(
nStation
),
fX
(
fX
),
fY
(
fY
),
bOutlier
(false),
fW
(
fW
),
fChi2
(0.0)
54
{}
55
/*
56
* Add a constant to the coordinate.
57
*/
58
void
operator+=
(
double
fD)
59
{
60
fX
+= fD;
61
fY
+= fD;
62
}
63
/*
64
* Add one point to another.
65
*/
66
void
operator+=
(
const
Point
& p)
67
{
68
fX
+= p.fX;
69
fY
+= p.fY;
70
}
71
/*
72
* Devide the coordiante by a constant.
73
*/
74
void
operator/=
(
double
fD)
75
{
76
if
(fD != 0.0)
77
{
78
fX
/= fD;
79
fY
/= fD;
80
}
81
}
82
};
83
/*
84
* A list of points.
85
*/
86
typedef
std::vector<Point>
PointArray
;
87
91
struct
SimpleStats
92
{
93
int
n
;
94
double
fMean
;
95
double
fStd
;
96
double
fChi2
;
97
101
SimpleStats
() :
102
n
(0),
fMean
(0.0),
fStd
(0.0),
fChi2
(0.0)
103
{}
104
108
void
clear
()
109
{
110
n
= 0;
111
fMean
=
fStd
=
fChi2
= 0.0;
112
}
113
};
114
115
/*
116
* A structure to hold linear fit statistics.
117
*/
118
struct
LinStats
119
{
120
int
n
;
121
double
fIntercept
;
122
double
fSlope
;
123
double
fR2
;
124
double
fAdjR2
;
125
double
fChi2
;
126
double
fCov00
,
fCov01
,
fCov11
;
127
128
/*
129
* Default constructor.
130
*/
131
LinStats
() :
132
n
(0),
fIntercept
(0.0),
fSlope
(0.0),
fR2
(0.0),
fAdjR2
(0.0),
fChi2
(0.0),
133
fCov00
(0.0),
fCov01
(0.0),
fCov11
(0.0)
134
{}
135
/*
136
* Clear statistics before a new fit.
137
*/
138
void
clear
()
139
{
140
n
= 0;
141
fIntercept
=
fSlope
=
fR2
=
fAdjR2
=
fChi2
=
fCov00
=
fCov01
=
fCov11
= 0.0;
142
}
143
/*
144
* Calculate projected values given fit results.
145
* @parma fX The X value of the point to project.
146
* @return The projected Y value.
147
*/
148
double
eval
(
double
fX)
const
;
149
};
150
151
public
:
152
153
/*
154
* Default constuctor.
155
*/
156
TgcFit
(
const
std::string&
type
,
157
const
std::string& name,
158
const
IInterface* parent);
159
160
// not used
161
void
setFitParameters
(
double
CHI2_TEST,
162
unsigned
MIN_WIRE_POINTS,
163
unsigned
MIN_STRIP_POINTS);
164
165
166
/*
167
* Get the fit data for strip (phi) fit;
168
*/
169
const
LinStats
&
getStripLinStats
()
const
;
170
/*
171
* Get the fit data for wire (eta) fit;
172
*/
173
const
LinStats
&
getWireLinStats
()
const
;
174
/*
175
* Fit a straight line throuh points. Ignore outliers.
176
* @param points The input list of data points.
177
* @param stats The statistics struct to fill with fit results.
178
*/
179
void
linReg
(
PointArray
& points,
LinStats
& stats)
const
;
180
/*
181
* Calculate simple statistics for the Y values of a set of points.
182
* @param points The input list of data points.
183
* @param stats The statistics struct to fill with fit results.
184
*/
185
void
SimpleStatistics
(
PointArray
& points,
SimpleStats
& stats)
const
;
186
/*
187
* Fit data to TGC. Calculate outliers and fit lines to strip and wire points.
188
*/
189
Status
runTgcMiddle
(
PointArray
& stripPoints,
PointArray
& wirePoints,
TgcFitResult
& fitResult)
const
;
190
Status
runTgcInner
(
PointArray
& stripPoints,
PointArray
& wirePoints,
TgcFitResult
& fitResult)
const
;
191
192
protected
:
193
PointArray
m_superPoints
;
194
size_t
countUniqueStations
(
const
TrigL2MuonSA::TgcFit::PointArray
&)
const
;
195
double
m_CHI2_TEST
{ 10.0 };
196
unsigned
m_MIN_WIRE_POINTS
{ 4 };
197
unsigned
m_MIN_STRIP_POINTS
{ 3 };
198
199
void
printDebug
(
const
std::string&
str
)
const
{
ATH_MSG_DEBUG
(
str
); };
200
};
201
202
}
203
204
#endif
AthAlgTool.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GeoPrimitivesHelpers.h
GeoPrimitives.h
TgcFitResult.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
TrigL2MuonSA::TgcFitResult
Definition
TgcFitResult.h:11
TrigL2MuonSA::TgcFit::getStripLinStats
const LinStats & getStripLinStats() const
TrigL2MuonSA::TgcFit::SimpleStatistics
void SimpleStatistics(PointArray &points, SimpleStats &stats) const
Definition
TgcFit.cxx:54
TrigL2MuonSA::TgcFit::TgcFit
TgcFit(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TgcFit.cxx:20
TrigL2MuonSA::TgcFit::getWireLinStats
const LinStats & getWireLinStats() const
TrigL2MuonSA::TgcFit::linReg
void linReg(PointArray &points, LinStats &stats) const
Definition
TgcFit.cxx:114
TrigL2MuonSA::TgcFit::m_MIN_WIRE_POINTS
unsigned m_MIN_WIRE_POINTS
Test for outliers: w * (value - mean)^2 > CHI2_TEST.
Definition
TgcFit.h:196
TrigL2MuonSA::TgcFit::PointArray
std::vector< Point > PointArray
Definition
TgcFit.h:86
TrigL2MuonSA::TgcFit::printDebug
void printDebug(const std::string &str) const
Definition
TgcFit.h:199
TrigL2MuonSA::TgcFit::Status
Status
Definition
TgcFit.h:25
TrigL2MuonSA::TgcFit::FIT_LINE
@ FIT_LINE
Definition
TgcFit.h:28
TrigL2MuonSA::TgcFit::FIT_POINT
@ FIT_POINT
Definition
TgcFit.h:27
TrigL2MuonSA::TgcFit::FIT_NONE
@ FIT_NONE
Definition
TgcFit.h:26
TrigL2MuonSA::TgcFit::runTgcMiddle
Status runTgcMiddle(PointArray &stripPoints, PointArray &wirePoints, TgcFitResult &fitResult) const
Definition
TgcFit.cxx:200
TrigL2MuonSA::TgcFit::runTgcInner
Status runTgcInner(PointArray &stripPoints, PointArray &wirePoints, TgcFitResult &fitResult) const
Definition
TgcFit.cxx:318
TrigL2MuonSA::TgcFit::countUniqueStations
size_t countUniqueStations(const TrigL2MuonSA::TgcFit::PointArray &) const
Definition
TgcFit.cxx:188
TrigL2MuonSA::TgcFit::m_MIN_STRIP_POINTS
unsigned m_MIN_STRIP_POINTS
Minimum number of strip points for linear fit.
Definition
TgcFit.h:197
TrigL2MuonSA::TgcFit::setFitParameters
void setFitParameters(double CHI2_TEST, unsigned MIN_WIRE_POINTS, unsigned MIN_STRIP_POINTS)
Definition
TgcFit.cxx:30
TrigL2MuonSA::TgcFit::m_superPoints
PointArray m_superPoints
List of wire (eta) super-points.
Definition
TgcFit.h:193
TrigL2MuonSA::TgcFit::m_CHI2_TEST
double m_CHI2_TEST
Definition
TgcFit.h:195
TrigL2MuonSA
Definition
AlignmentBarrelLUT.h:13
str
Definition
BTagTrackIpAccessor.cxx:11
type
TrigL2MuonSA::TgcFit::LinStats
Definition
TgcFit.h:119
TrigL2MuonSA::TgcFit::LinStats::fIntercept
double fIntercept
Intercept of the fit line.
Definition
TgcFit.h:121
TrigL2MuonSA::TgcFit::LinStats::n
int n
Number of points.
Definition
TgcFit.h:120
TrigL2MuonSA::TgcFit::LinStats::clear
void clear()
Definition
TgcFit.h:138
TrigL2MuonSA::TgcFit::LinStats::fAdjR2
double fAdjR2
R-squared adjusted for small samples.
Definition
TgcFit.h:124
TrigL2MuonSA::TgcFit::LinStats::fCov00
double fCov00
Definition
TgcFit.h:126
TrigL2MuonSA::TgcFit::LinStats::fChi2
double fChi2
Total Chi2.
Definition
TgcFit.h:125
TrigL2MuonSA::TgcFit::LinStats::fCov01
double fCov01
Definition
TgcFit.h:126
TrigL2MuonSA::TgcFit::LinStats::fSlope
double fSlope
Slope of the fit line.
Definition
TgcFit.h:122
TrigL2MuonSA::TgcFit::LinStats::fCov11
double fCov11
Definition
TgcFit.h:126
TrigL2MuonSA::TgcFit::LinStats::fR2
double fR2
R-squared of the fit.
Definition
TgcFit.h:123
TrigL2MuonSA::TgcFit::LinStats::eval
double eval(double fX) const
Definition
TgcFit.cxx:42
TrigL2MuonSA::TgcFit::LinStats::LinStats
LinStats()
Definition
TgcFit.h:131
TrigL2MuonSA::TgcFit::Point::nIdx
int nIdx
Index of point in original list of digits.
Definition
TgcFit.h:36
TrigL2MuonSA::TgcFit::Point::Point
Point()
Definition
TgcFit.h:47
TrigL2MuonSA::TgcFit::Point::operator/=
void operator/=(double fD)
Definition
TgcFit.h:74
TrigL2MuonSA::TgcFit::Point::Point
Point(int nIdx, int nStation, double fX, double fY, double fW=1.0)
Definition
TgcFit.h:52
TrigL2MuonSA::TgcFit::Point::fY
double fY
Y coordinate.
Definition
TgcFit.h:39
TrigL2MuonSA::TgcFit::Point::fX
double fX
X coordinate.
Definition
TgcFit.h:38
TrigL2MuonSA::TgcFit::Point::bOutlier
bool bOutlier
Indicates an outlier (excluded from all calculations).
Definition
TgcFit.h:40
TrigL2MuonSA::TgcFit::Point::fW
double fW
Weight.
Definition
TgcFit.h:41
TrigL2MuonSA::TgcFit::Point::operator+=
void operator+=(double fD)
Definition
TgcFit.h:58
TrigL2MuonSA::TgcFit::Point::fChi2
double fChi2
Chi2 contribution.
Definition
TgcFit.h:42
TrigL2MuonSA::TgcFit::Point::nStation
int nStation
Index of station: 0-3 for TGC.
Definition
TgcFit.h:37
TrigL2MuonSA::TgcFit::Point::operator+=
void operator+=(const Point &p)
Definition
TgcFit.h:66
TrigL2MuonSA::TgcFit::SimpleStats
A structure to hold simple statisitcs.
Definition
TgcFit.h:92
TrigL2MuonSA::TgcFit::SimpleStats::fChi2
double fChi2
Chi2 of all valid points.
Definition
TgcFit.h:96
TrigL2MuonSA::TgcFit::SimpleStats::clear
void clear()
Clear statistics before a new fit.
Definition
TgcFit.h:108
TrigL2MuonSA::TgcFit::SimpleStats::n
int n
Number of valid points.
Definition
TgcFit.h:93
TrigL2MuonSA::TgcFit::SimpleStats::SimpleStats
SimpleStats()
Constructor.
Definition
TgcFit.h:101
TrigL2MuonSA::TgcFit::SimpleStats::fStd
double fStd
Standard deviation.
Definition
TgcFit.h:95
TrigL2MuonSA::TgcFit::SimpleStats::fMean
double fMean
Mean.
Definition
TgcFit.h:94
Generated on
for ATLAS Offline Software by
1.17.0