ATLAS Offline Software
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>
10 using namespace MuonCalib;
11 
13  IRtResolution(vec) {
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 }
22 std::string RtResolutionChebyshev::name() const { return "RtResolutionChebyshev"; }
23 double 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 }
45 double RtResolutionChebyshev::tLower() const { return par(0); }
46 double RtResolutionChebyshev::tUpper() const { return par(1); }
47 unsigned int RtResolutionChebyshev::nDoF() const { return nPar() -2; }
48 std::vector<double> RtResolutionChebyshev::resParameters() const {
49  std::vector<double> alpha{};
50  alpha.insert(alpha.begin(), parameters().begin()+2, parameters().end());
51  return alpha;
52 }
MuonCalib::RtResolutionChebyshev::resParameters
std::vector< double > resParameters() const
Definition: RtResolutionChebyshev.cxx:48
MuonCalib::RtResolutionChebyshev::resolution
virtual double resolution(double t, double bgRate=0.0) const override final
returns resolution for a give time and background rate
Definition: RtResolutionChebyshev.cxx:23
add-xsec-uncert-quadrature-N.alpha
alpha
Definition: add-xsec-uncert-quadrature-N.py:110
MuonCalib::RtResolutionChebyshev::RtResolutionChebyshev
RtResolutionChebyshev(const ParVec &vec)
initialization constructor,
Definition: RtResolutionChebyshev.cxx:12
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonCalib::RtResolutionChebyshev::tUpper
virtual double tUpper() const
get the number of parameters used to describe the resolution
Definition: RtResolutionChebyshev.cxx:46
x
#define x
MuonCalib::RtResolutionChebyshev::nDoF
virtual unsigned int nDoF() const override final
get the coefficients of the r(t) polynomial
Definition: RtResolutionChebyshev.cxx:47
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
MuonCalib::CalibFunc::par
double par(unsigned int index) const
Definition: CalibFunc.h:41
UtilFunc.h
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::CalibFunc::ParVec
std::vector< double > ParVec
Definition: CalibFunc.h:35
MuonCalib::RtResolutionChebyshev::tLower
virtual double tLower() const
< get the lower drift-time bound
Definition: RtResolutionChebyshev.cxx:45
ChebychevPoly.h
MuonCalib::chebyshevPoly1st
constexpr double chebyshevPoly1st(const unsigned int order, const double x)
Returns the n-th Chebyshev polynomial of first kind evaluated at x (c.f.
Definition: ChebychevPoly.h:13
RtResolutionChebyshev.h
MuonCalib::RtResolutionChebyshev::name
virtual std::string name() const override final
Initialization from a
Definition: RtResolutionChebyshev.cxx:22
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
MuonCalib::IRtResolution
Generic interface to retrieve the resolution on the drift radius as a function of the drift time.
Definition: IRtResolution.h:20
MuonCalib::CalibFunc::parameters
const ParVec & parameters() const
Definition: CalibFunc.h:40
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition: CalibFunc.h:39
MuonCalib::mapToUnitInterval
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
fitman.k
k
Definition: fitman.py:528