ATLAS Offline Software
Public Types | Public Member Functions | Static Protected Attributes | Private Attributes | List of all members
MuonCalib::RtChebyshev Class Reference

#include <RtChebyshev.h>

Inheritance diagram for MuonCalib::RtChebyshev:
Collaboration diagram for MuonCalib::RtChebyshev:

Public Types

using ParVec = std::vector< double >
 

Public Member Functions

 RtChebyshev (const ParVec &vec)
 initialization constructor, More...
 
virtual std::string name () const override final
 get the class name More...
 
virtual double radius (double t) const override final
 get the drift velocity More...
 
virtual double driftVelocity (double t) const override final
 get the drift acceleration More...
 
virtual double driftAcceleration (double t) const override final
 Returns the acceleration of the r-t relation. More...
 
virtual double tLower () const override final
 < get the lower drift-time bound More...
 
virtual double tUpper () const override final
 Returns the upper time covered by the r-t. More...
 
virtual double tBinWidth () const override final
 get the number of parameters used to describe the r(t) relationship More...
 
unsigned int numberOfRtParameters () const
 get the coefficients of the r(t) polynomial More...
 
std::vector< double > rtParameters () const
 get the reduced time which is the argument of the Chebyshev polynomial More...
 
double getReducedTime (const double t) const
 
virtual std::string typeName () const override final
 
double GetTmaxDiff () const
 return the difference in total dirft time between the two multilayers (ML1 - ML2) More...
 
bool hasTmaxDiff () const
 
void SetTmaxDiff (const double d)
 set the difference in total drift time betwene the two multilayers (ML1 - ML2) More...
 
 CalibFunc (const ParVec &vec)
 
unsigned int nPar () const
 
const ParVecparameters () const
 
double par (unsigned int index) const
 

Static Protected Attributes

static constexpr double s_tBinWidth = 1.e-3
 

Private Attributes

std::optional< double > m_tmax_diff {std::nullopt}
 
ParVec m_parameters {}
 

Detailed Description

This class contains the implementation of an r(t) relationship parametrized by a linear combination of Chebyshev polyonomials.

Convention:

\[ r(t) = \sum_{k=0}^{K} p_k*T_k(2*(t-0.5*(tupper+tlower))/(tupper-tlower) \]

where T_k is the Chebyshev polynomial of k-th order, tupper and tlower are upper and lower drift-time bounds.

Units: [t] = ns, [r] = mm, [v] = mm/ns.

Definition at line 29 of file RtChebyshev.h.

Member Typedef Documentation

◆ ParVec

using MuonCalib::CalibFunc::ParVec = std::vector<double>
inherited

Definition at line 35 of file CalibFunc.h.

Constructor & Destructor Documentation

◆ RtChebyshev()

RtChebyshev::RtChebyshev ( const ParVec vec)
explicit

initialization constructor,

size of ParVec - 2 = order of the r(t) polynomial,

ParVec[0] = t_low (smallest allowed drift time), ParVec[1] = t_up (largest allowed drift time). ParVec[2...] = parameters of the Chebyshev polynomial

Definition at line 9 of file RtChebyshev.cxx.

9  :
10  IRtRelation(vec) {
11  // check for consistency //
12  if (nPar() < 3) {
13  THROW_EXCEPTION("RtChebyshev::_init() - Not enough parameters!");
14  }
15  if (tLower() >= tUpper()) {
16  THROW_EXCEPTION("Lower time boundary >= upper time boundary!");
17  }
18 } // end RtChebyshev::_init

Member Function Documentation

◆ CalibFunc()

MuonCalib::CalibFunc::CalibFunc
inlineexplicitinherited

Definition at line 36 of file CalibFunc.h.

36  :
37  m_parameters{vec} {}

◆ driftAcceleration()

double RtChebyshev::driftAcceleration ( double  t) const
finaloverridevirtual

Returns the acceleration of the r-t relation.

Implements MuonCalib::IRtRelation.

Definition at line 63 of file RtChebyshev.cxx.

63  {
64  double acc{0.};
65  // Argument of the Chebyshev polynomials
66  const double x = getReducedTime(t);
67  const double dx_dt = std::pow(2. / (tUpper() - tLower()), 2);
68  for (unsigned int k = 2; k < nPar() - 2; ++k) {
69  acc += par(k+2) * chebyshevPoly1st2Prime(k, x) * dx_dt;
70  }
71  return acc * t;
72 }

◆ driftVelocity()

double RtChebyshev::driftVelocity ( double  t) const
finaloverridevirtual

get the drift acceleration

Implements MuonCalib::IRtRelation.

Definition at line 47 of file RtChebyshev.cxx.

47  {
48  return (radius(t + 1.0) - radius(t));
49  // Set derivative to 0 outside of the bounds
50  if (t < tLower() || t > tUpper()) return 0.0;
51 
52  // Argument of the Chebyshev polynomials
53  const double x = getReducedTime(t);
54  // Chain rule
55  const double dx_dt = 2. / (tUpper() - tLower());
56  double drdt{0.};
57  for (unsigned int k = 1; k < nPar() - 2; ++k) {
58  // Calculate the contribution to dr/dt using k * U_{k-1}(x) * dx/dt
59  drdt += par(k+2) * chebyshevPoly1stPrime(k, x) * dx_dt;
60  }
61  return drdt;
62 }

◆ getReducedTime()

double RtChebyshev::getReducedTime ( const double  t) const

Definition at line 80 of file RtChebyshev.cxx.

80  {
81  return 2. * (t - 0.5 * (tUpper() + tLower())) / (tUpper() - tLower());
82 }

◆ GetTmaxDiff()

double MuonCalib::IRtRelation::GetTmaxDiff ( ) const
inlineinherited

return the difference in total dirft time between the two multilayers (ML1 - ML2)

Definition at line 34 of file IRtRelation.h.

34 { return m_tmax_diff.value_or(0.); }

◆ hasTmaxDiff()

bool MuonCalib::IRtRelation::hasTmaxDiff ( ) const
inlineinherited

Definition at line 36 of file IRtRelation.h.

36 { return m_tmax_diff.has_value(); }

◆ name()

std::string RtChebyshev::name ( ) const
finaloverridevirtual

get the class name

get the radius corresponding to the drift time t; if t is not within [t_low, t_up] an unphysical radius of 99999 is returned

Implements MuonCalib::CalibFunc.

Definition at line 20 of file RtChebyshev.cxx.

20 { return "RtChebyshev"; }

◆ nPar()

unsigned int MuonCalib::CalibFunc::nPar ( ) const
inlineinherited

Definition at line 39 of file CalibFunc.h.

39 { return m_parameters.size(); }

◆ numberOfRtParameters()

unsigned int RtChebyshev::numberOfRtParameters ( ) const

get the coefficients of the r(t) polynomial

Definition at line 75 of file RtChebyshev.cxx.

75 { return nPar() - 2; }

◆ par()

double MuonCalib::CalibFunc::par ( unsigned int  index) const
inlineinherited

Definition at line 41 of file CalibFunc.h.

41  {
42  if (index < nPar())
43  return m_parameters[index];
44  else
45  return 0.;
46  }

◆ parameters()

const ParVec& MuonCalib::CalibFunc::parameters ( ) const
inlineinherited

Definition at line 40 of file CalibFunc.h.

40 { return m_parameters; }

◆ radius()

double RtChebyshev::radius ( double  t) const
finaloverridevirtual

get the drift velocity

Implements MuonCalib::IRtRelation.

Definition at line 23 of file RtChebyshev.cxx.

23  {
25  // INITIAL TIME CHECK //
27  if (t < tLower()) return 0.0;
28  if (t > tUpper()) return 14.6;
29 
31  // VARIABLES //
33  // argument of the Chebyshev polynomials
34  double x = getReducedTime(t);
35  double rad{0.0}; // auxiliary radius
36 
38  // CALCULATE r(t) //
40  for (unsigned int k = 0; k < nPar() - 2; k++) {
41  rad += par(k+2) * chebyshevPoly1st(k, x);
42  }
43  return std::max(rad, 0.);
44 }

◆ rtParameters()

std::vector< double > RtChebyshev::rtParameters ( ) const

get the reduced time which is the argument of the Chebyshev polynomial

Definition at line 77 of file RtChebyshev.cxx.

77  {
78  return std::vector<double>{parameters().begin() +2, parameters().end()};
79 }

◆ SetTmaxDiff()

void MuonCalib::IRtRelation::SetTmaxDiff ( const double  d)
inlineinherited

set the difference in total drift time betwene the two multilayers (ML1 - ML2)

Definition at line 39 of file IRtRelation.h.

39 { m_tmax_diff = d; }

◆ tBinWidth()

double RtChebyshev::tBinWidth ( ) const
finaloverridevirtual

get the number of parameters used to describe the r(t) relationship

Implements MuonCalib::IRtRelation.

Definition at line 21 of file RtChebyshev.cxx.

21 { return s_tBinWidth; }

◆ tLower()

double RtChebyshev::tLower ( ) const
finaloverridevirtual

< get the lower drift-time bound

get the upper drift-time bound

Implements MuonCalib::IRtRelation.

Definition at line 73 of file RtChebyshev.cxx.

73 { return par(0); }

◆ tUpper()

double RtChebyshev::tUpper ( ) const
finaloverridevirtual

Returns the upper time covered by the r-t.

Implements MuonCalib::IRtRelation.

Definition at line 74 of file RtChebyshev.cxx.

74 { return par(1); }

◆ typeName()

virtual std::string MuonCalib::IRtRelation::typeName ( ) const
inlinefinaloverridevirtualinherited

Implements MuonCalib::CalibFunc.

Definition at line 19 of file IRtRelation.h.

19 { return "IRtRelation"; }

Member Data Documentation

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 51 of file CalibFunc.h.

◆ m_tmax_diff

std::optional<double> MuonCalib::IRtRelation::m_tmax_diff {std::nullopt}
privateinherited

Definition at line 41 of file IRtRelation.h.

◆ s_tBinWidth

constexpr double MuonCalib::IRtRelation::s_tBinWidth = 1.e-3
staticconstexprprotectedinherited

Definition at line 43 of file IRtRelation.h.


The documentation for this class was generated from the following files:
index
Definition: index.py:1
hist_file_dump.d
d
Definition: hist_file_dump.py:137
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
x
#define x
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::RtChebyshev::tUpper
virtual double tUpper() const override final
Returns the upper time covered by the r-t.
Definition: RtChebyshev.cxx:74
MuonCalib::RtChebyshev::radius
virtual double radius(double t) const override final
get the drift velocity
Definition: RtChebyshev.cxx:23
MuonCalib::RtChebyshev::getReducedTime
double getReducedTime(const double t) const
Definition: RtChebyshev.cxx:80
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
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::IRtRelation::s_tBinWidth
static constexpr double s_tBinWidth
Definition: IRtRelation.h:43
MuonCalib::IRtRelation::m_tmax_diff
std::optional< double > m_tmax_diff
Definition: IRtRelation.h:41
DeMoScan.index
string index
Definition: DeMoScan.py:364
MuonCalib::CalibFunc::parameters
const ParVec & parameters() const
Definition: CalibFunc.h:40
MuonCalib::CalibFunc::m_parameters
ParVec m_parameters
Definition: CalibFunc.h:51
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition: CalibFunc.h:39
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
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
MuonCalib::IRtRelation
generic interface for a rt-relation
Definition: IRtRelation.h:15
python.SystemOfUnits.rad
int rad
Definition: SystemOfUnits.py:111
fitman.k
k
Definition: fitman.py:528
MuonCalib::RtChebyshev::tLower
virtual double tLower() const override final
< get the lower drift-time bound
Definition: RtChebyshev.cxx:73