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 | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
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 More...
 
virtual double driftVelocity (double t) const override final
 returns drift velocity for a given time More...
 
virtual double driftAcceleration (double t) const override final
 returns the acceleration for a given time More...
 
virtual double tLower () const override final
 return rt range More...
 
virtual double tUpper () const override final
 Returns the upper time covered by the r-t. More...
 
virtual double tBinWidth () const override final
 Returns the step-size for the sampling. More...
 
virtual unsigned nDoF () const override final
 Returns the number of degrees of freedom of the relation function
More...
 
virtual std::string typeName () const override final
 
double GetTmaxDiff () const
 return the difference in total dirft time between the two multilayers (ML1 - ML2) More...
 
bool hasTmaxDiff () const
 
void SetTmaxDiff (const double d)
 set the difference in total drift time betwene the two multilayers (ML1 - ML2) More...
 
double getReducedTime (const double t) const
 map the in the interval [tLower;tUpper] onto the interval [-1. More...
 
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  }

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  }

◆ CalibFunc()

MuonCalib::CalibFunc::CalibFunc
inlineexplicitinherited

Definition at line 36 of file CalibFunc.h.

36  :
37  m_parameters{vec} {}

◆ dReducedTimeDt()

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

Definition at line 53 of file IRtRelation.h.

53  {
54  return unitIntervalPrime(tLower(), tUpper());
55  }

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

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

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

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

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

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

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

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

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

45 { m_tmax_diff = d; }

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

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters {}
privateinherited

Definition at line 48 of file CalibFunc.h.

◆ m_t_min

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

Definition at line 51 of file RtRelationLookUp.h.

◆ m_tmax_diff

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

Definition at line 58 of file IRtRelation.h.

◆ s_tBinWidth

constexpr 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:
beamspotman.r
def r
Definition: beamspotman.py:676
MuonCalib::RtRelationLookUp::binInRtRange
int binInRtRange(double t) const
Definition: RtRelationLookUp.cxx:76
skel.rel
rel
Announce start of JO checkingrelease nimber checking.
Definition: skel.GENtoEVGEN.py:182
index
Definition: index.py:1
hist_file_dump.d
d
Definition: hist_file_dump.py:143
MuonCalib::RtRelationLookUp::getBin
int getBin(double t) const
Definition: RtRelationLookUp.cxx:30
bin
Definition: BinsDiffFromStripMedian.h:43
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
MuonCalib::RtRelationLookUp::getRadius
double getRadius(int bin) const
Definition: RtRelationLookUp.h:47
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
MuonCalib::RtRelationLookUp::m_bin_size
double m_bin_size
Definition: RtRelationLookUp.h:52
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::CalibFunc::par
double par(unsigned int index) const
Definition: CalibFunc.h:41
MuonCalib::RtRelationLookUp::nDoF
virtual unsigned nDoF() const override final
Returns the number of degrees of freedom of the relation function
Definition: RtRelationLookUp.cxx:26
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib::unitIntervalPrime
double unitIntervalPrime(const double lowerEdge, const double upperEdge)
Definition: UtilFunc.h:15
MuonCalib::RtRelationLookUp::driftVelocity
virtual double driftVelocity(double t) const override final
returns drift velocity for a given time
Definition: RtRelationLookUp.cxx:57
MuonCalib::IRtRelation::tUpper
virtual double tUpper() const =0
Returns the upper time covered by the r-t.
MuonCalib::RtRelationLookUp::m_t_min
double m_t_min
Definition: RtRelationLookUp.h:51
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
MuonCalib::IRtRelation::m_tmax_diff
std::optional< double > m_tmax_diff
Definition: IRtRelation.h:58
python.PyAthena.v
v
Definition: PyAthena.py:154
MuonCalib::IRtRelation::tLower
virtual double tLower() const =0
Returns the lower time covered by the r-t.
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
MuonCalib::mapToUnitInterval
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
MCP::ScaleSmearParam::r1
@ r1