ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCalib
MdtCalib
MdtCalibData
src
RtSpline.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// c- c++
6
#include "iostream"
7
8
// this
9
#include "
MdtCalibData/RtSpline.h
"
10
11
// root
12
#include "GeoModelKernel/throwExcept.h"
13
#include "
AthenaKernel/getMessageSvc.h
"
14
#include "GaudiKernel/IMessageSvc.h"
15
#include "GaudiKernel/MsgStream.h"
16
#include "TSpline.h"
17
18
namespace
MuonCalib
{
19
RtSpline::~RtSpline
() =
default
;
20
RtSpline::RtSpline
(
const
ParVec
&
vec
) :
21
IRtRelation
(
vec
) {
22
// check for minimum number of parameters
23
if
(
nPar
() < 6) {
24
THROW_EXCEPTION
(
"Not enough parameters!"
<< std::endl<<
"Minimum number of parameters is 6!"
);
25
}
26
// check if the number of parameters is even
27
if
((
nPar
() % 2) != 0) {
28
THROW_EXCEPTION
(
"RtSpline::_init(): Odd number of parameters!"
);
29
}
30
// create spline
31
std::vector<double>
x
(
nPar
() /2);
32
std::vector<double>
y
(
nPar
() /2);
33
for
(
unsigned
int
i = 0; i <
nPar
() / 2; i++) {
34
x
[i] =
par
(2 * i);
35
y
[i] =
par
(2 * i + 1);
36
}
37
m_sp3
= std::make_unique<TSpline3>(
"Rt Relation"
,
x
.data(),
y
.data(),
nPar
() / 2,
"b2e2"
, 0, 0);
38
}
// end RtSpline::_init
39
double
RtSpline::tBinWidth
()
const
{
40
return
m_sp3
->GetDelta();
41
}
42
unsigned
RtSpline::nDoF
()
const
{
43
return
m_sp3
->GetNp();
44
}
45
double
RtSpline::radius
(
double
t)
const
{
46
// check for t_min and t_max
47
if
(t >
m_sp3
->GetXmax())
return
m_sp3
->Eval(
m_sp3
->GetXmax());
48
if
(t < m_sp3->GetXmin())
return
m_sp3
->Eval(
m_sp3
->GetXmin());
49
double
r
=
m_sp3
->Eval(t);
50
return
r
>= 0 ?
r
: 0;
51
}
52
53
double
RtSpline::driftVelocity
(
double
t)
const
{
return
m_sp3
->Derivative(t); }
54
double
RtSpline::driftAcceleration
(
double
t)
const
{
55
constexpr
double
h
= 1.e-7;
56
return
(
driftVelocity
(t +
h
) -
driftVelocity
(t-
h
))/ (2.*
h
);
57
}
58
double
RtSpline::tLower
()
const
{
return
par
(0); }
59
60
double
RtSpline::tUpper
()
const
{
return
par
(
nPar
() - 2); }
61
62
}
// namespace MuonCalib
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
RtSpline.h
y
#define y
x
#define x
h
Header file for AthHistogramAlgorithm.
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::IRtRelation
generic interface for a rt-relation
Definition
IRtRelation.h:19
MuonCalib::RtSpline::nDoF
virtual unsigned nDoF() const override final
Returns the number of degrees of freedom of the relation function.
Definition
RtSpline.cxx:42
MuonCalib::RtSpline::m_sp3
std::unique_ptr< TSpline3 > m_sp3
Definition
RtSpline.h:37
MuonCalib::RtSpline::tLower
virtual double tLower() const override final
get the lower drift-time bound
Definition
RtSpline.cxx:58
MuonCalib::RtSpline::driftAcceleration
virtual double driftAcceleration(double t) const override final
Returns the acceleration of the r-t relation.
Definition
RtSpline.cxx:54
MuonCalib::RtSpline::tUpper
virtual double tUpper() const override final
get the upper drift-time bound
Definition
RtSpline.cxx:60
MuonCalib::RtSpline::driftVelocity
virtual double driftVelocity(double t) const override final
get the drift velocity
Definition
RtSpline.cxx:53
MuonCalib::RtSpline::RtSpline
RtSpline(const ParVec &vec)
initialization constructor,
Definition
RtSpline.cxx:20
MuonCalib::RtSpline::tBinWidth
virtual double tBinWidth() const override final
Returns the step-size for the sampling.
Definition
RtSpline.cxx:39
MuonCalib::RtSpline::radius
virtual double radius(double t) const override final
get the radius corresponding to the drift time t; 0 or 14.6 is returned if t is outside the range
Definition
RtSpline.cxx:45
MuonCalib::RtSpline::~RtSpline
virtual ~RtSpline()
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
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition
throwExcept.h:10
Generated on
for ATLAS Offline Software by
1.17.0