ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::RtSpline Class Reference

This class contains the implementation of an r(t) relationship parameterized as support points to a cubic spline. More...

#include <RtSpline.h>

Inheritance diagram for MuonCalib::RtSpline:
Collaboration diagram for MuonCalib::RtSpline:

Public Types

using ParVec = std::vector<double>

Public Member Functions

 RtSpline (const ParVec &vec)
 initialization constructor,
virtual ~RtSpline ()
std::string name () const override final
 get the class name
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
virtual double driftVelocity (double t) const override final
 get the drift velocity
virtual double driftAcceleration (double t) const override final
 Returns the acceleration of the r-t relation.
virtual double tLower () const override final
 get the lower drift-time bound
virtual double tUpper () const override final
 get the upper drift-time bound
virtual double tBinWidth () const override final
 Returns the step-size for the sampling.
virtual unsigned nDoF () const override final
 Returns the number of degrees of freedom of the relation function.
virtual std::string typeName () const override final
double GetTmaxDiff () const
 return the difference in total dirft time between the two multilayers (ML1 - ML2)
bool hasTmaxDiff () const
void SetTmaxDiff (const double d)
 set the difference in total drift time betwene the two multilayers (ML1 - ML2)
double getReducedTime (const double t) const
 map the in the interval [tLower;tUpper] onto the interval [-1.;1.
double dReducedTimeDt () const
 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::unique_ptr< TSpline3 > m_sp3 {}
std::optional< double > m_tmax_diff {std::nullopt}
ParVec m_parameters {}

Detailed Description

This class contains the implementation of an r(t) relationship parameterized as support points to a cubic spline.

Author
Felix.nosp@m..Rau.nosp@m.scher.nosp@m.@cer.nosp@m.n.ch
Date
07.08.2007

Definition at line 34 of file RtSpline.h.

Member Typedef Documentation

◆ ParVec

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

Definition at line 35 of file CalibFunc.h.

Constructor & Destructor Documentation

◆ RtSpline()

MuonCalib::RtSpline::RtSpline ( const ParVec & vec)
explicit

initialization constructor,

2 * (size of ParVec) = number of points

ParVec[ 2n] = x coordinate of n_th support point ParVec[1 + 2n] = y coordinate of n_th support point

Definition at line 20 of file RtSpline.cxx.

20 :
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
std::vector< size_t > vec
#define y
#define x
double par(unsigned int index) const
Definition CalibFunc.h:41
unsigned int nPar() const
Definition CalibFunc.h:39
std::unique_ptr< TSpline3 > m_sp3
Definition RtSpline.h:37
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ ~RtSpline()

MuonCalib::RtSpline::~RtSpline ( )
virtualdefault

Member Function Documentation

◆ CalibFunc()

MuonCalib::CalibFunc::CalibFunc ( const ParVec & vec)
inlineexplicitinherited

Definition at line 36 of file CalibFunc.h.

36 :

◆ dReducedTimeDt()

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

Definition at line 53 of file IRtRelation.h.

53 {
54 return unitIntervalPrime(tLower(), tUpper());
55 }
virtual double tLower() const =0
Returns the lower time covered by the r-t.
virtual double tUpper() const =0
Returns the upper time covered by the r-t.
double unitIntervalPrime(const double lowerEdge, const double upperEdge)
Definition UtilFunc.h:15

◆ driftAcceleration()

double MuonCalib::RtSpline::driftAcceleration ( double t) const
finaloverridevirtual

Returns the acceleration of the r-t relation.

Implements MuonCalib::IRtRelation.

Definition at line 54 of file RtSpline.cxx.

54 {
55 constexpr double h = 1.e-7;
56 return (driftVelocity(t + h) - driftVelocity(t-h))/ (2.*h);
57 }
virtual double driftVelocity(double t) const override final
get the drift velocity
Definition RtSpline.cxx:53

◆ driftVelocity()

double MuonCalib::RtSpline::driftVelocity ( double t) const
finaloverridevirtual

get the drift velocity

Implements MuonCalib::IRtRelation.

Definition at line 53 of file RtSpline.cxx.

53{ return m_sp3->Derivative(t); }

◆ getReducedTime()

double MuonCalib::IRtRelation::getReducedTime ( const double t) const
inlineinherited

map the in the interval [tLower;tUpper] onto the interval [-1.;1.

] where tLower is mapped to -1. & tUpper to 1.;

Definition at line 49 of file IRtRelation.h.

49 {
50 return mapToUnitInterval(t, tLower(), tUpper());
51 }
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

◆ GetTmaxDiff()

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

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

Definition at line 40 of file IRtRelation.h.

40{ return m_tmax_diff.value_or(0.); }
std::optional< double > m_tmax_diff
Definition IRtRelation.h:58

◆ hasTmaxDiff()

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

Definition at line 42 of file IRtRelation.h.

42{ return m_tmax_diff.has_value(); }

◆ name()

std::string MuonCalib::RtSpline::name ( ) const
inlinefinaloverridevirtual

get the class name

Implements MuonCalib::CalibFunc.

Definition at line 55 of file RtSpline.h.

◆ nDoF()

unsigned MuonCalib::RtSpline::nDoF ( ) const
finaloverridevirtual

Returns the number of degrees of freedom of the relation function.

Implements MuonCalib::IRtRelation.

Definition at line 42 of file RtSpline.cxx.

42 {
43 return m_sp3->GetNp();
44 }

◆ nPar()

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

Definition at line 39 of file CalibFunc.h.

39{ return m_parameters.size(); }

◆ par()

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

Definition at line 41 of file CalibFunc.h.

41 {
42 return index < nPar() ? m_parameters[index] : 0.;
43 }
str index
Definition DeMoScan.py:362

◆ parameters()

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

Definition at line 40 of file CalibFunc.h.

40{ return m_parameters; }

◆ radius()

double MuonCalib::RtSpline::radius ( double t) const
finaloverridevirtual

get the radius corresponding to the drift time t; 0 or 14.6 is returned if t is outside the range

Implements MuonCalib::IRtRelation.

Definition at line 45 of file RtSpline.cxx.

45 {
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 }
int r
Definition globals.cxx:22

◆ 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 45 of file IRtRelation.h.

◆ tBinWidth()

double MuonCalib::RtSpline::tBinWidth ( ) const
finaloverridevirtual

Returns the step-size for the sampling.

Implements MuonCalib::IRtRelation.

Definition at line 39 of file RtSpline.cxx.

39 {
40 return m_sp3->GetDelta();
41 }

◆ tLower()

double MuonCalib::RtSpline::tLower ( ) const
finaloverridevirtual

get the lower drift-time bound

Implements MuonCalib::IRtRelation.

Definition at line 58 of file RtSpline.cxx.

58{ return par(0); }

◆ tUpper()

double MuonCalib::RtSpline::tUpper ( ) const
finaloverridevirtual

get the upper drift-time bound

Implements MuonCalib::IRtRelation.

Definition at line 60 of file RtSpline.cxx.

60{ return par(nPar() - 2); }

◆ typeName()

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

Implements MuonCalib::CalibFunc.

Definition at line 23 of file IRtRelation.h.

23{ return "IRtRelation"; }

Member Data Documentation

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 48 of file CalibFunc.h.

48{};

◆ m_sp3

std::unique_ptr<TSpline3> MuonCalib::RtSpline::m_sp3 {}
private

Definition at line 37 of file RtSpline.h.

37{};

◆ m_tmax_diff

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

Definition at line 58 of file IRtRelation.h.

58{std::nullopt};

◆ s_tBinWidth

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

Definition at line 60 of file IRtRelation.h.


The documentation for this class was generated from the following files: