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

Equidistant look up table for rt-relations with the time as key. More...

#include <RtRelationLookUp.h>

Inheritance diagram for MuonCalib::RtRelationLookUp:
Collaboration diagram for MuonCalib::RtRelationLookUp:

Public Types

using ParVec = std::vector<double>

Public Member Functions

 RtRelationLookUp (const ParVec &vec)
virtual std::string name () const override final
virtual double radius (double t) const override final
 returns drift radius for a given time
virtual double driftVelocity (double t) const override final
 returns drift velocity for a given time
virtual double driftAcceleration (double t) const override final
 returns the acceleration for a given time
virtual double tLower () const override final
 return rt range
virtual double tUpper () const override final
 Returns the upper time covered by the r-t.
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 Member Functions

int getBin (double t) const
double getRadius (int bin) const
int binInRtRange (double t) const

Private Attributes

double m_t_min {0.}
double m_bin_size {0.}
std::optional< double > m_tmax_diff {std::nullopt}
ParVec m_parameters {}

Detailed Description

Equidistant look up table for rt-relations with the time as key.

The first parameter should be the time corresponding to the first bin. The second parameter should be the binsize.

The r value is calculated by linear interpolation.

Definition at line 23 of file RtRelationLookUp.h.

Member Typedef Documentation

◆ ParVec

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

Definition at line 35 of file CalibFunc.h.

Constructor & Destructor Documentation

◆ RtRelationLookUp()

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

Definition at line 10 of file RtRelationLookUp.cxx.

10 :
11 IRtRelation(vec) {
12 if (vec.size() < 4) {
13 m_t_min = 9e9;
14 m_bin_size = 1.0; // will be always out of range
15 MsgStream log(Athena::getMessageSvc(), "RtRelationLookUp");
16 log << MSG::WARNING << "<to few parameters>" << endmsg;
17 } else {
18 m_t_min = par(0);
19 m_bin_size = par(1);
20 if (m_bin_size == 0) {
21 MsgStream log(Athena::getMessageSvc(), "RtRelationLookUp");
22 log << MSG::WARNING << "<bin size=0>" << endmsg;
23 }
24 }
25 }
#define endmsg
std::vector< size_t > vec
double par(unsigned int index) const
Definition CalibFunc.h:41
IMessageSvc * getMessageSvc(bool quiet=false)

Member Function Documentation

◆ binInRtRange()

int MuonCalib::RtRelationLookUp::binInRtRange ( double t) const
inlineprivate

Definition at line 76 of file RtRelationLookUp.cxx.

76 {
77 // get bin
78 int bin = getBin(t);
79
80 // if t corresponds to a negativ bin return first
81 if (bin < 0) bin = 0;
82
83 // if t corresponds to a bin outside the range of the lookup table return the last bin
84 if (static_cast<unsigned>(bin) >= nDoF()) bin = nDoF() - 1;
85
86 return bin;
87 }
virtual unsigned nDoF() const override final
Returns the number of degrees of freedom of the relation function.

◆ 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::RtRelationLookUp::driftAcceleration ( double t) const
finaloverridevirtual

returns the acceleration for a given time

Implements MuonCalib::IRtRelation.

Definition at line 72 of file RtRelationLookUp.cxx.

72 {
73 return (driftVelocity(t+1) - driftVelocity(t-1)) / 2.;
74 }
virtual double driftVelocity(double t) const override final
returns drift velocity for a given time

◆ driftVelocity()

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

returns drift velocity for a given time

Implements MuonCalib::IRtRelation.

Definition at line 57 of file RtRelationLookUp.cxx.

57 {
58 // get best matching bin in rt range
59 int bin = binInRtRange(t);
60
61 // shift bin so we are using the last two bins for extrapolation
62 if (static_cast<unsigned>(bin) >= nDoF() - 1) bin = nDoF() - 2;
63
64 double r1 = getRadius(bin); // get bin value
65 double r2 = getRadius(bin + 1); // get value of next bin
66 double dr = r2 - r1;
67
68 double v = dr / m_bin_size;
69
70 return v;
71 }
int binInRtRange(double t) const
double getRadius(int bin) const

◆ getBin()

int MuonCalib::RtRelationLookUp::getBin ( double t) const
inlineprivate

Definition at line 30 of file RtRelationLookUp.cxx.

30 {
31 double t_minus_tmin{t - m_t_min};
32 double rel = t_minus_tmin / m_bin_size;
33 if (rel < static_cast<double>(INT_MIN)) return INT_MIN;
34 if (rel > static_cast<double>(INT_MAX)) return INT_MAX;
35 return static_cast<int>(rel);
36 }
rel
Announce start of JO checkingrelease nimber checking.

◆ getRadius()

double MuonCalib::RtRelationLookUp::getRadius ( int bin) const
inlineprivate

Definition at line 47 of file RtRelationLookUp.h.

47{ return par(bin + 2); }

◆ 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()

virtual std::string MuonCalib::RtRelationLookUp::name ( ) const
inlinefinaloverridevirtual

Implements MuonCalib::CalibFunc.

Definition at line 27 of file RtRelationLookUp.h.

27{ return "RtRelationLookUp"; }

◆ nDoF()

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

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

Implements MuonCalib::IRtRelation.

Definition at line 26 of file RtRelationLookUp.cxx.

26 {
27 return nPar() -2;
28 }
unsigned int nPar() const
Definition CalibFunc.h:39

◆ 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::RtRelationLookUp::radius ( double t) const
finaloverridevirtual

returns drift radius for a given time

Implements MuonCalib::IRtRelation.

Definition at line 38 of file RtRelationLookUp.cxx.

38 {
39 // get best matching bin in rt range
40 int bin = binInRtRange(t);
41
42 // shift bin so we are using the last two bins for extrapolation
43 if (static_cast<unsigned>(bin) >= nDoF() - 1) bin = nDoF() - 2;
44
45 double r1 = getRadius(bin); // get bin value
46 double r2 = getRadius(bin + 1); // get value of next bin
47 double dr = r2 - r1;
48
49 // scale factor for interpolation
50 double scale = (t - m_t_min) / m_bin_size - (double)bin;
51
52 double r = r1 + dr * scale;
53
54 return r >= 0 ? r : 0;
55 }
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::RtRelationLookUp::tBinWidth ( ) const
finaloverridevirtual

Returns the step-size for the sampling.

Implements MuonCalib::IRtRelation.

Definition at line 91 of file RtRelationLookUp.cxx.

91{return m_bin_size; }

◆ tLower()

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

return rt range

Implements MuonCalib::IRtRelation.

Definition at line 89 of file RtRelationLookUp.cxx.

89{ return m_t_min; }

◆ tUpper()

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

Returns the upper time covered by the r-t.

Implements MuonCalib::IRtRelation.

Definition at line 90 of file RtRelationLookUp.cxx.

90{ return m_t_min + m_bin_size * nDoF(); }

◆ 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_bin_size

double MuonCalib::RtRelationLookUp::m_bin_size {0.}
private

Definition at line 52 of file RtRelationLookUp.h.

52{0.};

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 48 of file CalibFunc.h.

48{};

◆ m_t_min

double MuonCalib::RtRelationLookUp::m_t_min {0.}
private

Definition at line 51 of file RtRelationLookUp.h.

51{0.};

◆ 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: