Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 More...
 
virtual unsigned int nDoF () const override final
 Returns the number of degrees of freedom of the relation function
More...
 
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  }

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  }

◆ CalibFunc()

MuonCalib::CalibFunc::CalibFunc
inlineexplicitinherited

Definition at line 36 of file CalibFunc.h.

36  :
37  m_parameters{vec} {}

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

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

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

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

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 48 of file CalibFunc.h.

◆ m_t_min

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

Definition at line 58 of file RtResolutionLookUp.h.


The documentation for this class was generated from the following file:
MuonCalib::RtResolutionLookUp::m_t_min
double m_t_min
Definition: RtResolutionLookUp.h:58
index
Definition: index.py:1
bin
Definition: BinsDiffFromStripMedian.h:43
MuonCalib::RtResolutionLookUp::getBin
int getBin(double t) const
Definition: RtResolutionLookUp.h:52
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MCP::ScaleSmearParam::r2
@ r2
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::CalibFunc::par
double par(unsigned int index) const
Definition: CalibFunc.h:41
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib::RtResolutionLookUp::getRadius
double getRadius(int bin) const
Definition: RtResolutionLookUp.h:54
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
MuonCalib::RtResolutionLookUp::binInRtRange
int binInRtRange(double t) const
Definition: RtResolutionLookUp.h:80
DeMoScan.index
string index
Definition: DeMoScan.py:364
MuonCalib::CalibFunc::m_parameters
ParVec m_parameters
Definition: CalibFunc.h:48
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition: CalibFunc.h:39
MCP::ScaleSmearParam::r1
@ r1
MuonCalib::RtResolutionLookUp::m_bin_size
double m_bin_size
Definition: RtResolutionLookUp.h:59
MuonCalib::RtResolutionLookUp::nDoF
virtual unsigned int nDoF() const override final
Returns the number of degrees of freedom of the relation function
Definition: RtResolutionLookUp.h:39