ATLAS Offline Software
Loading...
Searching...
No Matches
RtResolutionChebyshev.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
7#include "GeoModelKernel/throwExcept.h"
8
9#include <algorithm>
10using namespace MuonCalib;
11
14 // check for consistency //
15 if (nPar() < 3) {
16 THROW_EXCEPTION("Not enough parameters!");
17 }
18 if (tLower() >= tUpper()) {
19 THROW_EXCEPTION("Lower time boundary >= upper time boundary!");
20 }
21}
22std::string RtResolutionChebyshev::name() const { return "RtResolutionChebyshev"; }
23double RtResolutionChebyshev::resolution(double t, double /*bgRate*/) const {
25 // INITIAL TIME CHECK //
27 t = std::clamp(t, tLower(), tUpper());
28
30 // VARIABLES //
32 // argument of the Chebyshev polynomials
33 const double x = mapToUnitInterval(t, tLower(), tUpper());
34 double resol{0.0}; // auxiliary resolution
35
37 // CALCULATE r(t) //
39 for (unsigned int k = 0; k < nDoF(); k++) {
40 resol = resol + parameters()[k + 2] * chebyshevPoly1st(k, x);
41 }
42
43 return resol;
44}
45double RtResolutionChebyshev::tLower() const { return par(0); }
46double RtResolutionChebyshev::tUpper() const { return par(1); }
47unsigned int RtResolutionChebyshev::nDoF() const { return nPar() -2; }
48std::vector<double> RtResolutionChebyshev::resParameters() const {
49 std::vector<double> alpha{};
50 alpha.insert(alpha.begin(), parameters().begin()+2, parameters().end());
51 return alpha;
52}
std::vector< size_t > vec
#define x
const ParVec & parameters() const
Definition CalibFunc.h:40
double par(unsigned int index) const
Definition CalibFunc.h:41
unsigned int nPar() const
Definition CalibFunc.h:39
std::vector< double > ParVec
Definition CalibFunc.h:35
Generic interface to retrieve the resolution on the drift radius as a function of the drift time.
virtual double tLower() const
< get the lower drift-time bound
virtual double tUpper() const
get the number of parameters used to describe the resolution
std::vector< double > resParameters() const
virtual unsigned int nDoF() const override final
get the coefficients of the r(t) polynomial
virtual double resolution(double t, double bgRate=0.0) const override final
returns resolution for a give time and background rate
RtResolutionChebyshev(const ParVec &vec)
initialization constructor,
virtual std::string name() const override final
Initialization from a.
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
constexpr double chebyshevPoly1st(const unsigned int order, const double x)
Returns the n-th Chebyshev polynomial of first kind evaluated at x (c.f.
double mapToUnitInterval(const double x, const double lowerEdge, const double upperEdge)
Maps the number x which is in [lowEdge;upperEdge] to the interval [-1;1].
Definition UtilFunc.h:12
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10