ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MdtCalib
MdtCalibData
src
RtRelationLookUp.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include <
MdtCalibData/RtRelationLookUp.h
>
5
6
#include <
AthenaKernel/getMessageSvc.h
>
7
#include <GaudiKernel/MsgStream.h>
8
namespace
MuonCalib
{
9
10
RtRelationLookUp::RtRelationLookUp
(
const
ParVec
&
vec
) :
11
IRtRelation
(
vec
) {
12
if
(
vec
.size() < 4) {
13
m_t_min = 9e9;
14
m_bin_size = 1.0;
// will be always out of range
15
MsgStream log(Athena::getMessageSvc(),
"RtRelationLookUp"
);
16
log << MSG::WARNING <<
"<to few parameters>"
<< endmsg;
17
}
else
{
18
m_t_min = par(0);
19
m_bin_size = par(1);
20
if (m_bin_size == 0) {
21
MsgStream log(Athena::getMessageSvc(),
"RtRelationLookUp"
);
22
log << MSG::WARNING <<
"<bin size=0>"
<< endmsg;
23
}
24
}
25
}
26
unsigned
RtRelationLookUp::nDoF
()
const
{
27
return
nPar
() -2;
28
}
29
30
inline
int
RtRelationLookUp::getBin
(
double
t)
const
{
31
double
t_minus_tmin{t -
m_t_min
};
32
double
rel = t_minus_tmin /
m_bin_size
;
33
if
(rel <
static_cast<
double
>
(INT_MIN))
return
INT_MIN;
34
if
(rel >
static_cast<
double
>
(INT_MAX))
return
INT_MAX;
35
return
static_cast<
int
>
(rel);
36
}
37
38
double
RtRelationLookUp::radius
(
double
t)
const
{
39
// get best matching bin in rt range
40
int
bin
=
binInRtRange
(t);
41
42
// shift bin so we are using the last two bins for extrapolation
43
if
(
static_cast<
unsigned
>
(
bin
) >=
nDoF
() - 1)
bin
=
nDoF
() - 2;
44
45
double
r1 =
getRadius
(
bin
);
// get bin value
46
double
r2 =
getRadius
(
bin
+ 1);
// get value of next bin
47
double
dr = r2 - r1;
48
49
// scale factor for interpolation
50
double
scale = (t -
m_t_min
) /
m_bin_size
- (
double
)
bin
;
51
52
double
r
= r1 + dr * scale;
53
54
return
r
>= 0 ?
r
: 0;
55
}
56
57
double
RtRelationLookUp::driftVelocity
(
double
t)
const
{
58
// get best matching bin in rt range
59
int
bin
=
binInRtRange
(t);
60
61
// shift bin so we are using the last two bins for extrapolation
62
if
(
static_cast<
unsigned
>
(
bin
) >=
nDoF
() - 1)
bin
=
nDoF
() - 2;
63
64
double
r1 =
getRadius
(
bin
);
// get bin value
65
double
r2 =
getRadius
(
bin
+ 1);
// get value of next bin
66
double
dr = r2 - r1;
67
68
double
v = dr /
m_bin_size
;
69
70
return
v;
71
}
72
double
RtRelationLookUp::driftAcceleration
(
double
t)
const
{
73
return
(
driftVelocity
(t+1) -
driftVelocity
(t-1)) / 2.;
74
}
75
76
inline
int
RtRelationLookUp::binInRtRange
(
double
t)
const
{
77
// get bin
78
int
bin
=
getBin
(t);
79
80
// if t corresponds to a negativ bin return first
81
if
(
bin
< 0)
bin
= 0;
82
83
// if t corresponds to a bin outside the range of the lookup table return the last bin
84
if
(
static_cast<
unsigned
>
(
bin
) >=
nDoF
())
bin
=
nDoF
() - 1;
85
86
return
bin
;
87
}
88
89
double
RtRelationLookUp::tLower
()
const
{
return
m_t_min
; }
90
double
RtRelationLookUp::tUpper
()
const
{
return
m_t_min
+
m_bin_size
*
nDoF
(); }
91
double
RtRelationLookUp::tBinWidth
()
const
{
return
m_bin_size
; }
92
}
93
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
getBin
int getBin(double x, double min, double step, int clamp_max)
Definition
FPGATrackSimSectorSlice.cxx:209
RtRelationLookUp.h
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition
CalibFunc.h:39
MuonCalib::CalibFunc::ParVec
std::vector< double > ParVec
Definition
CalibFunc.h:35
MuonCalib::IRtRelation
generic interface for a rt-relation
Definition
IRtRelation.h:19
MuonCalib::RtRelationLookUp::binInRtRange
int binInRtRange(double t) const
Definition
RtRelationLookUp.cxx:76
MuonCalib::RtRelationLookUp::RtRelationLookUp
RtRelationLookUp(const ParVec &vec)
Definition
RtRelationLookUp.cxx:10
MuonCalib::RtRelationLookUp::m_bin_size
double m_bin_size
Definition
RtRelationLookUp.h:52
MuonCalib::RtRelationLookUp::tBinWidth
virtual double tBinWidth() const override final
Returns the step-size for the sampling.
Definition
RtRelationLookUp.cxx:91
MuonCalib::RtRelationLookUp::radius
virtual double radius(double t) const override final
returns drift radius for a given time
Definition
RtRelationLookUp.cxx:38
MuonCalib::RtRelationLookUp::getBin
int getBin(double t) const
Definition
RtRelationLookUp.cxx:30
MuonCalib::RtRelationLookUp::driftVelocity
virtual double driftVelocity(double t) const override final
returns drift velocity for a given time
Definition
RtRelationLookUp.cxx:57
MuonCalib::RtRelationLookUp::m_t_min
double m_t_min
Definition
RtRelationLookUp.h:51
MuonCalib::RtRelationLookUp::driftAcceleration
virtual double driftAcceleration(double t) const override final
returns the acceleration for a given time
Definition
RtRelationLookUp.cxx:72
MuonCalib::RtRelationLookUp::nDoF
virtual unsigned nDoF() const override final
Returns the number of degrees of freedom of the relation function.
Definition
RtRelationLookUp.cxx:26
MuonCalib::RtRelationLookUp::getRadius
double getRadius(int bin) const
Definition
RtRelationLookUp.h:47
MuonCalib::RtRelationLookUp::tLower
virtual double tLower() const override final
return rt range
Definition
RtRelationLookUp.cxx:89
MuonCalib::RtRelationLookUp::tUpper
virtual double tUpper() const override final
Returns the upper time covered by the r-t.
Definition
RtRelationLookUp.cxx:90
bin
Definition
BinsDiffFromStripMedian.h:43
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
r
int r
Definition
globals.cxx:22
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