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

Equidistant look up table for resolution tables with the time as key. More...

#include <RtResolutionLookUp.h>

Inheritance diagram for MuonCalib::RtResolutionLookUp:
Collaboration diagram for MuonCalib::RtResolutionLookUp:

Public Types

using ParVec = std::vector<double>

Public Member Functions

 RtResolutionLookUp (const ParVec &vec)
virtual std::string name () const override
double resolution (double t, double) const override final
 returns drift radius for a given time
virtual unsigned int nDoF () const override final
 Returns the number of degrees of freedom of the relation function.
double tLower () const
double tUpper () const
virtual std::string typeName () const override final
 CalibFunc (const ParVec &vec)
unsigned int nPar () const
const ParVecparameters () const
double par (unsigned int index) const

Private Member Functions

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

Private Attributes

double m_t_min {9e9}
double m_bin_size {1.}
ParVec m_parameters {}

Detailed Description

Equidistant look up table for resolution tables 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 RtResolutionLookUp.h.

Member Typedef Documentation

◆ ParVec

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

Definition at line 35 of file CalibFunc.h.

Constructor & Destructor Documentation

◆ RtResolutionLookUp()

MuonCalib::RtResolutionLookUp::RtResolutionLookUp ( const ParVec & vec)
inlineexplicit

Definition at line 25 of file RtResolutionLookUp.h.

25 : IRtResolution(vec) {
26 if (vec.size() < 4) {
27 MsgStream log(Athena::getMessageSvc(), "RtResolutionLookUp");
28 log << MSG::WARNING << "<to few parameters>" << endmsg;
29 } else {
30 m_t_min = par(0);
31 m_bin_size = par(1);
32 }
33 }
#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::RtResolutionLookUp::binInRtRange ( double t) const
inlineprivate

Definition at line 80 of file RtResolutionLookUp.h.

80 {
81 // get bin
82 int bin = getBin(t);
83
84 // if t corresponds to a negative bin return first
85 if (bin < 0) bin = 0;
86
87 // if t corresponds to a bin outside the range of the lookup table return the last bin
88 if (static_cast<unsigned>(bin) >= nDoF()) bin = nDoF() - 1;
89
90 return bin;
91 }
virtual unsigned int 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 :

◆ getBin()

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

Definition at line 52 of file RtResolutionLookUp.h.

52{ return static_cast<int>((t - m_t_min) / m_bin_size); }

◆ getRadius()

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

Definition at line 54 of file RtResolutionLookUp.h.

54{ return par(bin + 2); }

◆ name()

virtual std::string MuonCalib::RtResolutionLookUp::name ( ) const
inlineoverridevirtual

Implements MuonCalib::CalibFunc.

Definition at line 35 of file RtResolutionLookUp.h.

35{ return "RtResolutionLookUp"; }

◆ nDoF()

virtual unsigned int MuonCalib::RtResolutionLookUp::nDoF ( ) const
inlinefinaloverridevirtual

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

Implements MuonCalib::IRtResolution.

Definition at line 39 of file RtResolutionLookUp.h.

39 {
40 return nPar() -2;
41 }
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; }

◆ resolution()

double MuonCalib::RtResolutionLookUp::resolution ( double t,
double  ) const
inlinefinaloverridevirtual

returns drift radius for a given time

Implements MuonCalib::IRtResolution.

Definition at line 62 of file RtResolutionLookUp.h.

62 {
63 // get first bin
64 int bin = binInRtRange(t);
65
66 // shift bin so we are using the last two bins for extrapolation
67 if (static_cast<unsigned>(bin) >= nDoF() - 1) bin = nDoF() - 2;
68
69 double r1 = getRadius(bin); // get bin value
70 double r2 = getRadius(bin + 1); // get value of next bin
71 double dr = r2 - r1;
72
73 // scale factor for interpolation
74 double scale = (t - m_t_min) / m_bin_size - (double)bin;
75
76 double reso = r1 + dr * scale;
77 return reso >= 0 ? reso : 0;
78 }
double getRadius(int bin) const

◆ tLower()

double MuonCalib::RtResolutionLookUp::tLower ( ) const
inline

Definition at line 43 of file RtResolutionLookUp.h.

43 {
44 return m_t_min;
45 }

◆ tUpper()

double MuonCalib::RtResolutionLookUp::tUpper ( ) const
inline

Definition at line 47 of file RtResolutionLookUp.h.

47 {
48 return m_t_min + m_bin_size * nDoF();
49 }

◆ typeName()

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

Implements MuonCalib::CalibFunc.

Definition at line 24 of file IRtResolution.h.

24{ return "IRtResolution"; }

Member Data Documentation

◆ m_bin_size

double MuonCalib::RtResolutionLookUp::m_bin_size {1.}
private

Definition at line 59 of file RtResolutionLookUp.h.

59{1.};

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 48 of file CalibFunc.h.

48{};

◆ m_t_min

double MuonCalib::RtResolutionLookUp::m_t_min {9e9}
private

Definition at line 58 of file RtResolutionLookUp.h.

58{9e9};

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