ATLAS Offline Software
Public Types | Public Member Functions | Public 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

typedef std::vector< double > ParVec
 

Public Member Functions

 RtRelationLookUp (const ParVec &vec)
 
std::string name () const
 
double radius (double t) const
 returns drift radius for a given time More...
 
double driftvelocity (double t) const
 returns drift velocity for a given time More...
 
double tLower (void) const
 return rt range More...
 
double tUpper (void) const
 
virtual std::string typeName () const
 
float GetTmaxDiff () const
 return the difference in total dirft time between the two multilayers (ML1 - ML2) More...
 
bool HasTmaxDiff () const
 
void SetTmaxDiff (const float &d)
 set the difference in total drift time betwene the two multilayers (ML1 - ML2) More...
 
unsigned int nPar () const
 
const ParVecparameters () const
 
double par (unsigned int index) const
 

Public Attributes

float m_tmax_diff
 

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 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 24 of file RtRelationLookUp.h.

Member Typedef Documentation

◆ ParVec

typedef std::vector<double> MuonCalib::CalibFunc::ParVec
inherited

Definition at line 36 of file CalibFunc.h.

Constructor & Destructor Documentation

◆ RtRelationLookUp()

MuonCalib::RtRelationLookUp::RtRelationLookUp ( const ParVec vec)
inlineexplicit

Definition at line 26 of file RtRelationLookUp.h.

26  : IRtRelation(vec) {
27  if (vec.size() < 4) {
28  m_t_min = 9e9;
29  m_bin_size = 1.0; // will be always out of range
30  MsgStream log(Athena::getMessageSvc(), "RtRelationLookUp");
31  log << MSG::WARNING << "<to few parameters>" << endmsg;
32  } else {
33  m_t_min = par(0);
34  m_bin_size = par(1);
35  if (m_bin_size == 0) {
36  MsgStream log(Athena::getMessageSvc(), "RtRelationLookUp");
37  log << MSG::WARNING << "<bin size=0>" << endmsg;
38  }
39  }
40  }

Member Function Documentation

◆ binInRtRange()

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

Definition at line 108 of file RtRelationLookUp.h.

108  {
109  // get bin
110  int bin = getBin(t);
111 
112  // if t corresponds to a negativ bin return first
113  if (bin < 0) bin = 0;
114 
115  // if t corresponds to a bin outside the range of the lookup table return the last bin
116  if (bin >= rtBins()) bin = rtBins() - 1;
117 
118  return bin;
119  }

◆ driftvelocity()

double MuonCalib::RtRelationLookUp::driftvelocity ( double  t) const
inlinevirtual

returns drift velocity for a given time

Implements MuonCalib::IRtRelation.

Definition at line 92 of file RtRelationLookUp.h.

92  {
93  // get best matching bin in rt range
94  int bin = binInRtRange(t);
95 
96  // shift bin so we are using the last two bins for extrapolation
97  if (bin >= rtBins() - 1) bin = rtBins() - 2;
98 
99  double r1 = getRadius(bin); // get bin value
100  double r2 = getRadius(bin + 1); // get value of next bin
101  double dr = r2 - r1;
102 
103  double v = dr / m_bin_size;
104 
105  return v;
106  }

◆ getBin()

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

Definition at line 55 of file RtRelationLookUp.h.

55  {
56  double t_minus_tmin(t - m_t_min);
57  double rel = t_minus_tmin / m_bin_size;
58  if (rel < static_cast<double>(INT_MIN)) return INT_MIN;
59  if (rel > static_cast<double>(INT_MAX)) return INT_MAX;
60  return static_cast<int>(rel);
61  }

◆ getRadius()

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

Definition at line 65 of file RtRelationLookUp.h.

65 { return par(bin + 2); }

◆ GetTmaxDiff()

float MuonCalib::IRtRelation::GetTmaxDiff ( ) const
inlineinherited

return the difference in total dirft time between the two multilayers (ML1 - ML2)

Definition at line 27 of file IRtRelation.h.

27 { return HasTmaxDiff() ? m_tmax_diff : 0.0; }

◆ HasTmaxDiff()

bool MuonCalib::IRtRelation::HasTmaxDiff ( ) const
inlineinherited

Definition at line 29 of file IRtRelation.h.

29 { return (m_tmax_diff < 8e8); }

◆ name()

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

Implements MuonCalib::CalibFunc.

Definition at line 42 of file RtRelationLookUp.h.

42 { return "RtRelationLookUp"; }

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

◆ radius()

double MuonCalib::RtRelationLookUp::radius ( double  t) const
inlinevirtual

returns drift radius for a given time

Implements MuonCalib::IRtRelation.

Definition at line 73 of file RtRelationLookUp.h.

73  {
74  // get best matching bin in rt range
75  int bin = binInRtRange(t);
76 
77  // shift bin so we are using the last two bins for extrapolation
78  if (bin >= rtBins() - 1) bin = rtBins() - 2;
79 
80  double r1 = getRadius(bin); // get bin value
81  double r2 = getRadius(bin + 1); // get value of next bin
82  double dr = r2 - r1;
83 
84  // scale factor for interpolation
85  double scale = (t - m_t_min) / m_bin_size - (double)bin;
86 
87  double r = r1 + dr * scale;
88 
89  return r >= 0 ? r : 0;
90  }

◆ rtBins()

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

Definition at line 64 of file RtRelationLookUp.h.

64 { return nPar() - 2; }

◆ SetTmaxDiff()

void MuonCalib::IRtRelation::SetTmaxDiff ( const float &  d)
inlineinherited

set the difference in total drift time betwene the two multilayers (ML1 - ML2)

Definition at line 32 of file IRtRelation.h.

32 { m_tmax_diff = d; }

◆ tLower()

double MuonCalib::RtRelationLookUp::tLower ( void  ) const
inlinevirtual

return rt range

Implements MuonCalib::IRtRelation.

Definition at line 121 of file RtRelationLookUp.h.

121 { return m_t_min; }

◆ tUpper()

double MuonCalib::RtRelationLookUp::tUpper ( void  ) const
inlinevirtual

Implements MuonCalib::IRtRelation.

Definition at line 123 of file RtRelationLookUp.h.

123 { return m_t_min + m_bin_size * rtBins(); }

◆ typeName()

virtual std::string MuonCalib::IRtRelation::typeName ( ) const
inlinevirtualinherited

Implements MuonCalib::CalibFunc.

Definition at line 18 of file IRtRelation.h.

18 { return "IRtRelation"; }

Member Data Documentation

◆ m_bin_size

double MuonCalib::RtRelationLookUp::m_bin_size
private

Definition at line 70 of file RtRelationLookUp.h.

◆ m_parameters

ParVec MuonCalib::CalibFunc::m_parameters
privateinherited

Definition at line 51 of file CalibFunc.h.

◆ m_t_min

double MuonCalib::RtRelationLookUp::m_t_min
private

Definition at line 69 of file RtRelationLookUp.h.

◆ m_tmax_diff

float MuonCalib::IRtRelation::m_tmax_diff
inherited

Definition at line 34 of file IRtRelation.h.


The documentation for this class was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
MuonCalib::RtRelationLookUp::binInRtRange
int binInRtRange(double t) const
Definition: RtRelationLookUp.h:108
skel.rel
rel
Announce start of JO checkingrelease nimber checking.
Definition: skel.GENtoEVGEN.py:182
MuonCalib::IRtRelation::m_tmax_diff
float m_tmax_diff
Definition: IRtRelation.h:34
index
Definition: index.py:1
hist_file_dump.d
d
Definition: hist_file_dump.py:137
MuonCalib::RtRelationLookUp::getBin
int getBin(double t) const
Definition: RtRelationLookUp.h:55
MuonCalib::IRtRelation::HasTmaxDiff
bool HasTmaxDiff() const
Definition: IRtRelation.h:29
bin
Definition: BinsDiffFromStripMedian.h:43
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
MuonCalib::RtRelationLookUp::getRadius
double getRadius(int bin) const
Definition: RtRelationLookUp.h:65
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:70
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::IRtRelation::IRtRelation
IRtRelation(const CalibFunc::ParVec &vec)
Definition: IRtRelation.h:16
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonCalib::RtRelationLookUp::m_t_min
double m_t_min
Definition: RtRelationLookUp.h:69
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
python.PyAthena.v
v
Definition: PyAthena.py:157
DeMoScan.index
string index
Definition: DeMoScan.py:362
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::RtRelationLookUp::rtBins
int rtBins() const
Definition: RtRelationLookUp.h:64