ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MdtCalib
MdtCalibData
MdtCalibData
RtResolutionLookUp.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef MUONCALIB_RTRESOLUTIONLOOKUP_H
6
#define MUONCALIB_RTRESOLUTIONLOOKUP_H
7
8
#include <iostream>
9
10
#include "
AthenaKernel/getMessageSvc.h
"
11
#include "GaudiKernel/MsgStream.h"
12
#include "
MdtCalibData/IRtResolution.h
"
13
14
namespace
MuonCalib
{
15
22
23
class
RtResolutionLookUp
:
public
IRtResolution
{
24
public
:
25
explicit
RtResolutionLookUp
(
const
ParVec
&
vec
) :
IRtResolution
(
vec
) {
26
if
(
vec
.size() < 4) {
27
MsgStream log(Athena::getMessageSvc(),
"RtResolutionLookUp"
);
28
log << MSG::WARNING <<
"<to few parameters>"
<< endmsg;
29
}
else
{
30
m_t_min = par(0);
31
m_bin_size = par(1);
32
}
33
}
34
35
virtual
std::string
name
()
const override
{
return
"RtResolutionLookUp"
; }
36
38
double
resolution
(
double
t,
double
)
const
override
final
;
39
virtual
unsigned
int
nDoF
()
const
override final{
40
return
nPar
() -2;
41
}
42
43
double
tLower
()
const
{
44
return
m_t_min
;
45
}
46
47
double
tUpper
()
const
{
48
return
m_t_min
+
m_bin_size
*
nDoF
();
49
}
50
51
private
:
52
int
getBin
(
double
t)
const
{
return
static_cast<
int
>
((t -
m_t_min
) /
m_bin_size
); }
53
54
double
getRadius
(
int
bin
)
const
{
return
par
(
bin
+ 2); }
55
// returns best matching bin within rtRange
56
int
binInRtRange
(
double
t)
const
;
57
58
double
m_t_min
{9e9};
59
double
m_bin_size
{1.};
60
};
61
62
inline
double
RtResolutionLookUp::resolution
(
double
t,
double
)
const
{
63
// get first bin
64
int
bin
=
binInRtRange
(t);
65
66
// shift bin so we are using the last two bins for extrapolation
67
if
(
static_cast<
unsigned
>
(
bin
) >=
nDoF
() - 1)
bin
=
nDoF
() - 2;
68
69
double
r1 =
getRadius
(
bin
);
// get bin value
70
double
r2 =
getRadius
(
bin
+ 1);
// get value of next bin
71
double
dr = r2 - r1;
72
73
// scale factor for interpolation
74
double
scale = (t -
m_t_min
) /
m_bin_size
- (
double
)
bin
;
75
76
double
reso = r1 + dr * scale;
77
return
reso >= 0 ? reso : 0;
78
}
79
80
inline
int
RtResolutionLookUp::binInRtRange
(
double
t)
const
{
81
// get bin
82
int
bin
=
getBin
(t);
83
84
// if t corresponds to a negative bin return first
85
if
(
bin
< 0)
bin
= 0;
86
87
// if t corresponds to a bin outside the range of the lookup table return the last bin
88
if
(
static_cast<
unsigned
>
(
bin
) >=
nDoF
())
bin
=
nDoF
() - 1;
89
90
return
bin
;
91
}
92
}
// namespace MuonCalib
93
#endif
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
IRtResolution.h
MuonCalib::CalibFunc::par
double par(unsigned int index) const
Definition
CalibFunc.h:41
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition
CalibFunc.h:39
MuonCalib::CalibFunc::ParVec
std::vector< double > ParVec
Definition
CalibFunc.h:35
MuonCalib::IRtResolution
Generic interface to retrieve the resolution on the drift radius as a function of the drift time.
Definition
IRtResolution.h:20
MuonCalib::RtResolutionLookUp::m_bin_size
double m_bin_size
Definition
RtResolutionLookUp.h:59
MuonCalib::RtResolutionLookUp::getBin
int getBin(double t) const
Definition
RtResolutionLookUp.h:52
MuonCalib::RtResolutionLookUp::binInRtRange
int binInRtRange(double t) const
Definition
RtResolutionLookUp.h:80
MuonCalib::RtResolutionLookUp::nDoF
virtual unsigned int nDoF() const override final
Returns the number of degrees of freedom of the relation function.
Definition
RtResolutionLookUp.h:39
MuonCalib::RtResolutionLookUp::getRadius
double getRadius(int bin) const
Definition
RtResolutionLookUp.h:54
MuonCalib::RtResolutionLookUp::resolution
double resolution(double t, double) const override final
returns drift radius for a given time
Definition
RtResolutionLookUp.h:62
MuonCalib::RtResolutionLookUp::name
virtual std::string name() const override
Definition
RtResolutionLookUp.h:35
MuonCalib::RtResolutionLookUp::RtResolutionLookUp
RtResolutionLookUp(const ParVec &vec)
Definition
RtResolutionLookUp.h:25
MuonCalib::RtResolutionLookUp::tLower
double tLower() const
Definition
RtResolutionLookUp.h:43
MuonCalib::RtResolutionLookUp::m_t_min
double m_t_min
Definition
RtResolutionLookUp.h:58
MuonCalib::RtResolutionLookUp::tUpper
double tUpper() const
Definition
RtResolutionLookUp.h:47
bin
Definition
BinsDiffFromStripMedian.h:43
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
const
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