CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
fftjetcms::LookupTable2d Class Reference

#include <LookupTable2d.h>

Public Member Functions

double binValue (const unsigned ix, const unsigned iy) const
 
double closest (double x, double y) const
 
const std::vector< double > & data () const
 
 LookupTable2d (unsigned nx, double xmin, double xmax, unsigned ny, double ymin, double ymax, const std::vector< double > &data)
 
unsigned nx () const
 
unsigned ny () const
 
double xmax () const
 
double xmin () const
 
double xstep () const
 
double ymax () const
 
double ymin () const
 
double ystep () const
 

Private Member Functions

 LookupTable2d ()
 

Private Attributes

double bwx_
 
double bwy_
 
std::vector< double > data_
 
unsigned nx_
 
unsigned ny_
 
double xmax_
 
double xmin_
 
double ymax_
 
double ymin_
 

Detailed Description

Definition at line 7 of file LookupTable2d.h.

Constructor & Destructor Documentation

fftjetcms::LookupTable2d::LookupTable2d ( unsigned  nx,
double  xmin,
double  xmax,
unsigned  ny,
double  ymin,
double  ymax,
const std::vector< double > &  data 
)

Definition at line 7 of file LookupTable2d.cc.

References data_, nx_, ny_, xmax_, xmin_, ymax_, and ymin_.

10  : data_(data),
11  nx_(nx),
12  ny_(ny),
13  xmin_(xmin),
14  xmax_(xmax),
15  ymin_(ymin),
16  ymax_(ymax),
17  bwx_((xmax - xmin)/nx),
18  bwy_((ymax - ymin)/ny)
19  {
20  assert(nx_);
21  assert(ny_);
22  assert(xmin_ < xmax_);
23  assert(ymin_ < ymax_);
24  assert(data_.size() == nx_*ny_);
25  }
double ymax() const
Definition: LookupTable2d.h:20
double xmax() const
Definition: LookupTable2d.h:18
double ymin() const
Definition: LookupTable2d.h:19
const std::vector< double > & data() const
Definition: LookupTable2d.h:14
double xmin() const
Definition: LookupTable2d.h:17
unsigned ny() const
Definition: LookupTable2d.h:16
unsigned nx() const
Definition: LookupTable2d.h:15
std::vector< double > data_
Definition: LookupTable2d.h:31
fftjetcms::LookupTable2d::LookupTable2d ( )
private

Referenced by binValue().

Member Function Documentation

double fftjetcms::LookupTable2d::binValue ( const unsigned  ix,
const unsigned  iy 
) const
inline

Definition at line 23 of file LookupTable2d.h.

References closest(), data_, LookupTable2d(), ny_, and x().

24  {return data_.at(ix*ny_ + iy);}
std::vector< double > data_
Definition: LookupTable2d.h:31
double fftjetcms::LookupTable2d::closest ( double  x,
double  y 
) const

Definition at line 27 of file LookupTable2d.cc.

References bwx_, bwy_, data_, nx_, ny_, mitigatedMETSequence_cff::U, xmax_, xmin_, ymax_, and ymin_.

Referenced by binValue(), and fftjetcms::EtaAndPtLookupPeakSelector::operator()().

28  {
29  const unsigned ix = x <= xmin_ ? 0U : x >= xmax_-bwx_/2.0 ? nx_ - 1U :
30  static_cast<unsigned>((x - xmin_)/bwx_);
31  const unsigned iy = y <= ymin_ ? 0U : y >= ymax_-bwy_/2.0 ? ny_ - 1U :
32  static_cast<unsigned>((y - ymin_)/bwy_);
33  return data_[ix*ny_ + iy];
34  }
T x() const
Cartesian x coordinate.
std::vector< double > data_
Definition: LookupTable2d.h:31
const std::vector<double>& fftjetcms::LookupTable2d::data ( ) const
inline

Definition at line 14 of file LookupTable2d.h.

References data_.

14 {return data_;}
std::vector< double > data_
Definition: LookupTable2d.h:31
unsigned fftjetcms::LookupTable2d::nx ( ) const
inline

Definition at line 15 of file LookupTable2d.h.

References nx_.

15 {return nx_;}
unsigned fftjetcms::LookupTable2d::ny ( ) const
inline

Definition at line 16 of file LookupTable2d.h.

References ny_.

16 {return ny_;}
double fftjetcms::LookupTable2d::xmax ( ) const
inline

Definition at line 18 of file LookupTable2d.h.

References xmax_.

Referenced by svgfig.XAxis::__repr__().

18 {return xmax_;}
double fftjetcms::LookupTable2d::xmin ( ) const
inline
double fftjetcms::LookupTable2d::xstep ( ) const
inline

Definition at line 21 of file LookupTable2d.h.

References bwx_.

21 {return bwx_;}
double fftjetcms::LookupTable2d::ymax ( ) const
inline

Definition at line 20 of file LookupTable2d.h.

References ymax_.

Referenced by svgfig.YAxis::__repr__().

20 {return ymax_;}
double fftjetcms::LookupTable2d::ymin ( ) const
inline
double fftjetcms::LookupTable2d::ystep ( ) const
inline

Definition at line 22 of file LookupTable2d.h.

References bwy_.

22 {return bwy_;}

Member Data Documentation

double fftjetcms::LookupTable2d::bwx_
private

Definition at line 38 of file LookupTable2d.h.

Referenced by closest(), and xstep().

double fftjetcms::LookupTable2d::bwy_
private

Definition at line 39 of file LookupTable2d.h.

Referenced by closest(), and ystep().

std::vector<double> fftjetcms::LookupTable2d::data_
private

Definition at line 31 of file LookupTable2d.h.

Referenced by binValue(), closest(), data(), and LookupTable2d().

unsigned fftjetcms::LookupTable2d::nx_
private

Definition at line 32 of file LookupTable2d.h.

Referenced by closest(), LookupTable2d(), and nx().

unsigned fftjetcms::LookupTable2d::ny_
private

Definition at line 33 of file LookupTable2d.h.

Referenced by binValue(), closest(), LookupTable2d(), and ny().

double fftjetcms::LookupTable2d::xmax_
private

Definition at line 35 of file LookupTable2d.h.

Referenced by closest(), LookupTable2d(), and xmax().

double fftjetcms::LookupTable2d::xmin_
private

Definition at line 34 of file LookupTable2d.h.

Referenced by closest(), LookupTable2d(), and xmin().

double fftjetcms::LookupTable2d::ymax_
private

Definition at line 37 of file LookupTable2d.h.

Referenced by closest(), LookupTable2d(), and ymax().

double fftjetcms::LookupTable2d::ymin_
private

Definition at line 36 of file LookupTable2d.h.

Referenced by closest(), LookupTable2d(), and ymin().