ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::PolygonBase Class Reference

This class provides functions which allow the user to express a polygon as a linear combination of these functions. More...

#include <PolygonBase.h>

Inheritance diagram for MuonCalib::PolygonBase:
Collaboration diagram for MuonCalib::PolygonBase:

Public Member Functions

 PolygonBase (const std::vector< double > &x)
 Constructor: the vector x contains the abscissae of the base points of the polygon.
double value (const int k, const double x) const
 get the value of the k-th base function at x

Private Attributes

std::vector< double > m_x {}

Detailed Description

This class provides functions which allow the user to express a polygon as a linear combination of these functions.

Author
Olive.nosp@m.r.Ko.nosp@m.rtner.nosp@m.@CER.nosp@m.N.CH
Date
29.06.2006

Definition at line 42 of file PolygonBase.h.

Constructor & Destructor Documentation

◆ PolygonBase()

PolygonBase::PolygonBase ( const std::vector< double > & x)

Constructor: the vector x contains the abscissae of the base points of the polygon.

x must contain the abscissae in increasing order. get the value of the k-th base function in x

Definition at line 11 of file PolygonBase.cxx.

11 {
12
13 // CHECK FOR CORRECT FILLING
14 for (unsigned int k=0; k<x.size()-1; k++) {
15 if (x[k]>=x[k+1]) {
16 THROW_EXCEPTION("PolygonBase::init - Abscissae not in increasing order!");
17 }
18 }
19 // TRANSFER THE INPUT DATA //
20 m_x = x;
21}
#define x
std::vector< double > m_x
Definition PolygonBase.h:54
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

Member Function Documentation

◆ value()

double PolygonBase::value ( const int k,
const double x ) const
virtual

get the value of the k-th base function at x

Implements MuonCalib::BaseFunction.

Definition at line 22 of file PolygonBase.cxx.

22 {
23
24 // CHECK THE BASE FUNCTION INDEX //
25 if (k<0 || k>static_cast<int>(m_x.size()-1)) {
26 THROW_EXCEPTION("PolygonBase::value - Illegal function index "<<k<<"! Should be >0 and "<<m_x.size());
27 }
28
29 // outside the domain of the polygon //
30 if (x<m_x[0] || x>m_x[m_x.size()-1]) {
31 return 0.0;
32 }
33 // inside the domain of the polygon //
34 if (k==0 && x<m_x[0]) {
35 return 0.0;
36 }
37 if (k==0 && x<=m_x[1]) {
38 return (m_x[1]-x)/(m_x[1]-m_x[0]);
39 }
40 if (k==0 && x>m_x[1]) {
41 return 0.0;
42 }
43 if (static_cast<unsigned int>(k)==m_x.size()-1 &&
44 x<=m_x[m_x.size()-2]) {
45 return 0.0;
46 }
47 if (static_cast<unsigned int>(k)==m_x.size()-1 &&
48 x<=m_x[m_x.size()-1]) {
49 return (x-m_x[k-1])/(m_x[k]-m_x[k-1]);
50 }
51 if (static_cast<unsigned int>(k)==m_x.size()-1 &&
52 x>m_x[m_x.size()-1]) {
53 return 0.0;
54 }
55 if (x<m_x[k-1] || x>m_x[k+1]) {
56 return 0.0;
57 }
58
59 if (x<m_x[k]) {
60 return (x-m_x[k-1])/(m_x[k]-m_x[k-1]);
61 }
62 return (m_x[k+1]-x)/(m_x[k+1]-m_x[k]);
63}

Member Data Documentation

◆ m_x

std::vector<double> MuonCalib::PolygonBase::m_x {}
private

Definition at line 54 of file PolygonBase.h.

54{}; // vector containing the abscissae of the base

The documentation for this class was generated from the following files: