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 576 of file YScanner.h.

577 {
578 x0 = 0;
579 step = 0;
580 entries.clear();
581 }

◆ 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 603 of file YScanner.h.

603{return func::lround((x - x0) / step);}

◆ getX()

double getX ( int i) const
inline

Returns x for a given index.

Returns
x

Definition at line 597 of file YScanner.h.

597{return x0 + step * i;}

◆ getXmax()

double getXmax ( ) const
inline

Returns x of the last entry.

Returns
maximal x

Definition at line 601 of file YScanner.h.

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

◆ getXmin()

double getXmin ( ) const
inline

Returns x of the first entry.

Returns
minimal x

Definition at line 599 of file YScanner.h.

599{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 605 of file YScanner.h.

606 {
607 unsigned k = i;
608 if (k >= entries.size()) return 0;
609 return entries[k].y;
610 }

◆ 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 590 of file YScanner.h.

591 {
592 x0 = T.x0;
593 step = T.step;
594 entries.clear();
595 }

◆ 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 583 of file YScanner.h.

584 {
585 x0 = X0;
586 step = Step;
587 entries.clear();
588 }

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: