CMS 3D CMS Logo

List of all members | Public 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)
 
 LookupTable2d ()=delete
 
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 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

◆ LookupTable2d() [1/2]

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 cms::cuda::assert(), data_, nx_, ny_, xmax_, xmin_, ymax_, and ymin_.

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

◆ LookupTable2d() [2/2]

fftjetcms::LookupTable2d::LookupTable2d ( )
delete

Member Function Documentation

◆ binValue()

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

Definition at line 22 of file LookupTable2d.h.

References data_, and ny_.

22 { return data_.at(ix * ny_ + iy); }
std::vector< double > data_
Definition: LookupTable2d.h:27

◆ closest()

double fftjetcms::LookupTable2d::closest ( double  x,
double  y 
) const

Definition at line 25 of file LookupTable2d.cc.

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

Referenced by fftjetcms::EtaAndPtLookupPeakSelector::operator()().

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

◆ data()

const std::vector<double>& fftjetcms::LookupTable2d::data ( ) const
inline

Definition at line 13 of file LookupTable2d.h.

References data_.

13 { return data_; }
std::vector< double > data_
Definition: LookupTable2d.h:27

◆ nx()

unsigned fftjetcms::LookupTable2d::nx ( ) const
inline

Definition at line 14 of file LookupTable2d.h.

References nx_.

14 { return nx_; }

◆ ny()

unsigned fftjetcms::LookupTable2d::ny ( ) const
inline

Definition at line 15 of file LookupTable2d.h.

References ny_.

15 { return ny_; }

◆ xmax()

double fftjetcms::LookupTable2d::xmax ( ) const
inline

Definition at line 17 of file LookupTable2d.h.

References xmax_.

Referenced by svgfig.XAxis::__repr__().

17 { return xmax_; }

◆ xmin()

double fftjetcms::LookupTable2d::xmin ( ) const
inline

◆ xstep()

double fftjetcms::LookupTable2d::xstep ( ) const
inline

Definition at line 20 of file LookupTable2d.h.

References bwx_.

20 { return bwx_; }

◆ ymax()

double fftjetcms::LookupTable2d::ymax ( ) const
inline

Definition at line 19 of file LookupTable2d.h.

References ymax_.

Referenced by svgfig.YAxis::__repr__().

19 { return ymax_; }

◆ ymin()

double fftjetcms::LookupTable2d::ymin ( ) const
inline

◆ ystep()

double fftjetcms::LookupTable2d::ystep ( ) const
inline

Definition at line 21 of file LookupTable2d.h.

References bwy_.

21 { return bwy_; }

Member Data Documentation

◆ bwx_

double fftjetcms::LookupTable2d::bwx_
private

Definition at line 34 of file LookupTable2d.h.

Referenced by closest(), and xstep().

◆ bwy_

double fftjetcms::LookupTable2d::bwy_
private

Definition at line 35 of file LookupTable2d.h.

Referenced by closest(), and ystep().

◆ data_

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

Definition at line 27 of file LookupTable2d.h.

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

◆ nx_

unsigned fftjetcms::LookupTable2d::nx_
private

Definition at line 28 of file LookupTable2d.h.

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

◆ ny_

unsigned fftjetcms::LookupTable2d::ny_
private

Definition at line 29 of file LookupTable2d.h.

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

◆ xmax_

double fftjetcms::LookupTable2d::xmax_
private

Definition at line 31 of file LookupTable2d.h.

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

◆ xmin_

double fftjetcms::LookupTable2d::xmin_
private

Definition at line 30 of file LookupTable2d.h.

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

◆ ymax_

double fftjetcms::LookupTable2d::ymax_
private

Definition at line 33 of file LookupTable2d.h.

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

◆ ymin_

double fftjetcms::LookupTable2d::ymin_
private

Definition at line 32 of file LookupTable2d.h.

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