ATLAS Offline Software
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)
 
std::string name () const
 
double resolution (double t, double) const
 returns drift radius for a given time More...
 
virtual std::string typeName () const override
 
 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
 
int rtBins () const
 
double getRadius (int bin) const
 
int binInRtRange (double t) const
 

Private Attributes

double m_t_min
 
double m_bin_size
 
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  m_t_min = 9e9;
30  m_bin_size = 1.0; // will be always out of range
31  } else {
32  m_t_min = par(0);
33  m_bin_size = par(1);
34  }
35  }

Member Function Documentation

◆ binInRtRange()

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

Definition at line 73 of file RtResolutionLookUp.h.

73  {
74  // get bin
75  int bin = getBin(t);
76 
77  // if t corresponds to a negative bin return first
78  if (bin < 0) bin = 0;
79 
80  // if t corresponds to a bin outside the range of the lookup table return the last bin
81  if (bin >= rtBins()) bin = rtBins() - 1;
82 
83  return bin;
84  }

◆ 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 43 of file RtResolutionLookUp.h.

43 { return (int)((t - m_t_min) / m_bin_size); }

◆ getRadius()

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

Definition at line 47 of file RtResolutionLookUp.h.

47 { return par(bin + 2); }

◆ name()

std::string MuonCalib::RtResolutionLookUp::name ( ) const
inlinevirtual

Implements MuonCalib::CalibFunc.

Definition at line 37 of file RtResolutionLookUp.h.

37 { return "RtResolutionLookUp"; }

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

◆ resolution()

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

returns drift radius for a given time

Implements MuonCalib::IRtResolution.

Definition at line 55 of file RtResolutionLookUp.h.

55  {
56  // get first bin
57  int bin = binInRtRange(t);
58 
59  // shift bin so we are using the last two bins for extrapolation
60  if (bin >= rtBins() - 1) bin = rtBins() - 2;
61 
62  double r1 = getRadius(bin); // get bin value
63  double r2 = getRadius(bin + 1); // get value of next bin
64  double dr = r2 - r1;
65 
66  // scale factor for interpolation
67  double scale = (t - m_t_min) / m_bin_size - (double)bin;
68 
69  double reso = r1 + dr * scale;
70  return reso >= 0 ? reso : 0;
71  }

◆ rtBins()

int MuonCalib::RtResolutionLookUp::rtBins ( ) const
inlineprivate

Definition at line 46 of file RtResolutionLookUp.h.

46 { return nPar() - 2; }

◆ typeName()

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

Implements MuonCalib::CalibFunc.

Definition at line 17 of file IRtResolution.h.

17 { return "IRtResolution"; }

Member Data Documentation

◆ m_bin_size

double MuonCalib::RtResolutionLookUp::m_bin_size
private

Definition at line 52 of file RtResolutionLookUp.h.

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 51 of file CalibFunc.h.

◆ m_t_min

double MuonCalib::RtResolutionLookUp::m_t_min
private

Definition at line 51 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:51
index
Definition: index.py:1
bin
Definition: BinsDiffFromStripMedian.h:43
MuonCalib::RtResolutionLookUp::getBin
int getBin(double t) const
Definition: RtResolutionLookUp.h:43
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
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::rtBins
int rtBins() const
Definition: RtResolutionLookUp.h:46
MuonCalib::RtResolutionLookUp::getRadius
double getRadius(int bin) const
Definition: RtResolutionLookUp.h:47
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
MuonCalib::RtResolutionLookUp::binInRtRange
int binInRtRange(double t) const
Definition: RtResolutionLookUp.h:73
DeMoScan.index
string index
Definition: DeMoScan.py:364
MuonCalib::CalibFunc::m_parameters
ParVec m_parameters
Definition: CalibFunc.h:51
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:52