ATLAS Offline Software
TrChebyshev.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "GeoModelKernel/throwExcept.h"
8 
9 namespace MuonCalib{
10  TrChebyshev::TrChebyshev(const IRtRelationPtr& rtRelation, const ParVec& vec) : ITrRelation{rtRelation, vec} {
11  if (minRadius() >= maxRadius()) {
12  THROW_EXCEPTION("Minimum radius greater than maximum radius!");
13  }
14  }
15  std::string TrChebyshev::name() const { return "TrChebyshev"; }
16 
17  std::optional<double> TrChebyshev::driftTime(const double r) const {
18  if (r < minRadius() || r > maxRadius()) return std::nullopt;
19  const double reducedR = 2 * (r - 0.5 * (maxRadius() + minRadius())) / (maxRadius() - minRadius());
20  double time{0.};
21  for (unsigned int k = 0; k < nPar() - 2; ++k) {
22  time += par(k+2) * chebyshevPoly1st(k, reducedR);
23  }
24  return std::make_optional(time);
25 
26 
27  }
28  std::optional<double> TrChebyshev::driftTimePrime(const double r) const {
29  if (r < minRadius() || r > maxRadius()) return std::nullopt;
30  const double reducedR = 2 * (r - 0.5 * (maxRadius() + minRadius())) / (maxRadius() - minRadius());
31  const double dt_dr = 2. / (maxRadius() - minRadius());
32  double dtdr{0.};
33  for (unsigned int k = 1; k < nPar() - 2; ++k) {
34  dtdr += par(k+2) * chebyshevPoly1stPrime(k, reducedR) * dt_dr;
35  }
36  return std::make_optional(dtdr);
37 
38  }
39  std::optional<double> TrChebyshev::driftTime2Prime(const double r) const {
40  if (r < minRadius() || r > maxRadius()) return std::nullopt;
41  const double reducedR = 2 * (r - 0.5 * (maxRadius() + minRadius())) / (maxRadius() - minRadius());
42  const double dt_dr = std::pow(2. / (maxRadius() - minRadius()), 2);
43  double d2tdr2{0.};
44  for (unsigned int k = 2; k < nPar() - 2; ++k) {
45  d2tdr2 += par(k+2) * chebyshevPoly1st2Prime(k, reducedR) * dt_dr;
46  }
47  return std::make_optional(d2tdr2);
48  }
49 
50  double TrChebyshev::minRadius() const { return par(0); }
51  double TrChebyshev::maxRadius() const { return par(1); }
52 }
53 
54 
55 
56 
beamspotman.r
def r
Definition: beamspotman.py:676
GeoModel::TransientConstSharedPtr< IRtRelation >
MuonCalib::TrChebyshev::maxRadius
virtual double maxRadius() const override final
Returns the maximum drift-radius.
Definition: TrChebyshev.cxx:51
MuonCalib::TrChebyshev::driftTimePrime
virtual std::optional< double > driftTimePrime(const double r) const override final
Definition: TrChebyshev.cxx:28
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
MuonCalib::TrChebyshev::driftTime
virtual std::optional< double > driftTime(const double r) const override final
Interface method for fetching the drift-time from the radius Returns a nullopt if the time is out of ...
Definition: TrChebyshev.cxx:17
MuonCalib::CalibFunc::par
double par(unsigned int index) const
Definition: CalibFunc.h:41
MuonCalib::chebyshevPoly1st2Prime
constexpr double chebyshevPoly1st2Prime(const unsigned int order, const double x)
Returns the second derivative of the n-th Chebycheb polynomial of the first kind.
Definition: ChebychevPoly.h:81
MuonCalib::TrChebyshev::name
virtual std::string name() const override final
Definition: TrChebyshev.cxx:15
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
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
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition: CalibFunc.h:39
TrChebyshev.h
MuonCalib::chebyshevPoly1stPrime
constexpr double chebyshevPoly1stPrime(const unsigned int order, const double x)
Returns the first derivative of the n-th Chebycheb polynomial of the first kind.
Definition: ChebychevPoly.h:49
MuonCalib::TrChebyshev::TrChebyshev
TrChebyshev(const IRtRelationPtr &rtRelation, const ParVec &vec)
Definition: TrChebyshev.cxx:10
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
MuonCalib::TrChebyshev::driftTime2Prime
virtual std::optional< double > driftTime2Prime(const double r) const override final
Definition: TrChebyshev.cxx:39
fitman.k
k
Definition: fitman.py:528
MuonCalib::ITrRelation
Definition: ITrRelation.h:13
MuonCalib::TrChebyshev::minRadius
virtual double minRadius() const override final
Returns the minimum drift-radius.
Definition: TrChebyshev.cxx:50