Belle II Software development
YScanner::Table Struct Reference

A table of equidistant entries. More...

#include <YScanner.h>

Public Member Functions

 Table ()
 Default constructor.
 
void clear ()
 Clear the content entirely.
 
void set (double X0, double Step)
 Sets the first x and the step, and clears the entries.
 
void set (const Table &T)
 Sets the first x and the step, and clears the entries.
 
double getX (int i) const
 Returns x for a given index.
 
double getXmin () const
 Returns x of the first entry.
 
double getXmax () const
 Returns x of the last entry.
 
int getIndex (double x) const
 Returns index.
 
double getY (int i) const
 Returns y for a given index.
 

Public Attributes

double x0 = 0
 x of first entry
 
double step = 0
 step size
 
std::vector< TableEntryentries
 table entries
 

Detailed Description

A table of equidistant entries.

Definition at line 118 of file YScanner.h.

Constructor & Destructor Documentation

◆ Table()

Table ( )
inline

Default constructor.

Definition at line 126 of file YScanner.h.

127 {}

Member Function Documentation

◆ clear()

void clear ( )
inline

Clear the content entirely.

Definition at line 511 of file YScanner.h.

512 {
513 x0 = 0;
514 step = 0;
515 entries.clear();
516 }
double step
step size
Definition: YScanner.h:120
std::vector< TableEntry > entries
table entries
Definition: YScanner.h:121
double x0
x of first entry
Definition: YScanner.h:119

◆ getIndex()

int getIndex ( double  x) const
inline

Returns index.

Returns
index (note: the range is not limited to the range of entries)

Definition at line 538 of file YScanner.h.

538{return lround((x - x0) / step);}

◆ getX()

double getX ( int  i) const
inline

Returns x for a given index.

Returns
x

Definition at line 532 of file YScanner.h.

532{return x0 + step * i;}

◆ getXmax()

double getXmax ( ) const
inline

Returns x of the last entry.

Returns
maximal x

Definition at line 536 of file YScanner.h.

536{return x0 + step * (entries.size() - 1);}

◆ getXmin()

double getXmin ( ) const
inline

Returns x of the first entry.

Returns
minimal x

Definition at line 534 of file YScanner.h.

534{return x0;}

◆ getY()

double getY ( int  i) const
inline

Returns y for a given index.

Returns
y or 0 if index is out of range

Definition at line 540 of file YScanner.h.

541 {
542 unsigned k = i;
543 if (k >= entries.size()) return 0;
544 return entries[k].y;
545 }

◆ set() [1/2]

void set ( const Table T)
inline

Sets the first x and the step, and clears the entries.

Parameters
Tthe table

Definition at line 525 of file YScanner.h.

526 {
527 x0 = T.x0;
528 step = T.step;
529 entries.clear();
530 }

◆ set() [2/2]

void set ( double  X0,
double  Step 
)
inline

Sets the first x and the step, and clears the entries.

Parameters
X0x of the first entry
Stepstep size

Definition at line 518 of file YScanner.h.

519 {
520 x0 = X0;
521 step = Step;
522 entries.clear();
523 }

Member Data Documentation

◆ entries

std::vector<TableEntry> entries

table entries

Definition at line 121 of file YScanner.h.

◆ step

double step = 0

step size

Definition at line 120 of file YScanner.h.

◆ x0

double x0 = 0

x of first entry

Definition at line 119 of file YScanner.h.


The documentation for this struct was generated from the following file: