ATLAS Offline Software
RtResolutionChebyshev.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <TString.h> // for Form
8 
9 using namespace MuonCalib;
10 
11 //*****************************************************************************
12 
14 // METHOD _init //
17  // check for consistency //
18  if (nPar() < 3) {
19  throw std::runtime_error(Form("File: %s, Line: %d\nRtResolutionChebyshev::_init() - Not enough parameters!", __FILE__, __LINE__));
20  }
21  if (parameters()[0] >= parameters()[1]) {
22  throw std::runtime_error(
23  Form("File: %s, Line: %d\nRtResolutionChebyshev::_init() - Lower time boundary >= upper time boundary!", __FILE__, __LINE__));
24  }
25 
26  // pointer to the chebyshev service //
28 
29  return;
30 }
31 
32 //*****************************************************************************
33 
35 // METHOD name //
37 std::string RtResolutionChebyshev::name(void) const { return std::string("RtResolutionChebyshev"); }
38 
39 //*****************************************************************************
40 
42 // METHOD radius //
44 double RtResolutionChebyshev::resolution(double t, double /*bgRate*/) const {
46  // INITIAL TIME CHECK //
48 
49  if (t != tLower() && t != tUpper()) {
50  // get resolution for tmin and tmax to get reasonable boundary conditrions
51  double res_min(resolution(tLower())), res_max(resolution(tUpper()));
52 
53  // if x is out of bounds, return 99999 //
54  if (t < parameters()[0]) return res_min;
55 
56  if (t > parameters()[1]) return res_max;
57  }
59  // VARIABLES //
61  // argument of the Chebyshev polynomials
62  double x(2 * (t - 0.5 * (parameters()[1] + parameters()[0])) / (parameters()[1] - parameters()[0]));
63  double resol(0.0); // auxiliary resolution
64 
66  // CALCULATE r(t) //
68  for (unsigned int k = 0; k < nPar() - 2; k++) { resol = resol + parameters()[k + 2] * m_Chebyshev->value(k, x); }
69 
70  return resol;
71 }
72 
73 //*****************************************************************************
74 
76 // METHOD tLower //
78 double RtResolutionChebyshev::tLower(void) const { return parameters()[0]; }
79 
80 //*****************************************************************************
81 
83 // METHOD tUpper //
85 double RtResolutionChebyshev::tUpper(void) const { return parameters()[1]; }
86 
87 //*****************************************************************************
88 
90 // METHOD numberOfResParameters //
92 unsigned int RtResolutionChebyshev::numberOfResParameters(void) const { return nPar() - 2; }
93 
94 //*****************************************************************************
95 
97 // METHOD resParameters //
99 std::vector<double> RtResolutionChebyshev::resParameters(void) const {
100  std::vector<double> alpha(nPar() - 2);
101  for (unsigned int k = 0; k < alpha.size(); k++) { alpha[k] = parameters()[k + 2]; }
102 
103  return alpha;
104 }
105 
106 //*****************************************************************************
107 
109 // METHOD get_reduced_time //
111 inline double RtResolutionChebyshev::get_reduced_time(const double& t) const {
112  return 2 * (t - 0.5 * (parameters()[1] + parameters()[0])) / (parameters()[1] - parameters()[0]);
113 }
MuonCalib::RtResolutionChebyshev::m_Chebyshev
const Tschebyscheff_polynomial * m_Chebyshev
pointer to the Chebyshev polynomials
Definition: RtResolutionChebyshev.h:53
MuonCalib::Tschebyscheff_polynomial::value
double value(const unsigned int &order, const double &x) const
get the value of the Tschebyscheff polynomial of order order at x (-1 <= x <= 1)
MuonCalib::RtResolutionChebyshev::resolution
double resolution(double t, double bgRate=0.0) const
returns resolution for a give time and background rate
Definition: RtResolutionChebyshev.cxx:44
MuonCalib::Tschebyscheff_polynomial::get_Tschebyscheff_polynomial
static const Tschebyscheff_polynomial * get_Tschebyscheff_polynomial(void)
get a pointer to the Tschebyscheff polynomial
Definition: Tschebyscheff_polynomial.cxx:28
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonCalib::RtResolutionChebyshev::tLower
double tLower(void) const
< get the lower drift-time bound
Definition: RtResolutionChebyshev.cxx:78
x
#define x
MuonCalib::RtResolutionChebyshev::resParameters
std::vector< double > resParameters(void) const
get the reduced time which is the argument of the Chebyshev polynomial
Definition: RtResolutionChebyshev.cxx:99
MuonCalib::RtResolutionChebyshev::numberOfResParameters
unsigned int numberOfResParameters(void) const
get the coefficients of the r(t) polynomial
Definition: RtResolutionChebyshev.cxx:92
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::RtResolutionChebyshev::tUpper
double tUpper(void) const
get the number of parameters used to describe the resolution
Definition: RtResolutionChebyshev.cxx:85
RtResolutionChebyshev.h
MuonCalib::RtResolutionChebyshev::get_reduced_time
double get_reduced_time(const double &t) const
Definition: RtResolutionChebyshev.cxx:111
MuonCalib::CalibFunc::parameters
const ParVec & parameters() const
Definition: CalibFunc.h:40
MuonCalib::RtResolutionChebyshev::_init
void _init(void)
initialization method
Definition: RtResolutionChebyshev.cxx:16
MuonCalib::CalibFunc::nPar
unsigned int nPar() const
Definition: CalibFunc.h:39
MuonCalib::RtResolutionChebyshev::name
std::string name(void) const
get the class name
Definition: RtResolutionChebyshev.cxx:37
fitman.k
k
Definition: fitman.py:528