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 ()=delete
 

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.

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  }

References cms::cuda::assert(), data_, nx_, ny_, xmax_, xmin_, ymax_, and ymin_.

◆ LookupTable2d() [2/2]

fftjetcms::LookupTable2d::LookupTable2d ( )
privatedelete

Member Function Documentation

◆ binValue()

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

Definition at line 21 of file LookupTable2d.h.

21 { return data_.at(ix * ny_ + iy); }

References data_, and ny_.

◆ closest()

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

Definition at line 25 of file LookupTable2d.cc.

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

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

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

◆ data()

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

Definition at line 12 of file LookupTable2d.h.

12 { return data_; }

References data_.

◆ nx()

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

Definition at line 13 of file LookupTable2d.h.

13 { return nx_; }

References nx_.

◆ ny()

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

Definition at line 14 of file LookupTable2d.h.

14 { return ny_; }

References ny_.

◆ xmax()

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

Definition at line 16 of file LookupTable2d.h.

16 { return xmax_; }

References xmax_.

Referenced by svgfig.XAxis::__repr__().

◆ xmin()

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

◆ xstep()

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

Definition at line 19 of file LookupTable2d.h.

19 { return bwx_; }

References bwx_.

◆ ymax()

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

Definition at line 18 of file LookupTable2d.h.

18 { return ymax_; }

References ymax_.

Referenced by svgfig.YAxis::__repr__().

◆ ymin()

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

◆ ystep()

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

Definition at line 20 of file LookupTable2d.h.

20 { return bwy_; }

References bwy_.

Member Data Documentation

◆ bwx_

double fftjetcms::LookupTable2d::bwx_
private

Definition at line 35 of file LookupTable2d.h.

Referenced by closest(), and xstep().

◆ bwy_

double fftjetcms::LookupTable2d::bwy_
private

Definition at line 36 of file LookupTable2d.h.

Referenced by closest(), and ystep().

◆ data_

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

Definition at line 28 of file LookupTable2d.h.

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

◆ nx_

unsigned fftjetcms::LookupTable2d::nx_
private

Definition at line 29 of file LookupTable2d.h.

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

◆ ny_

unsigned fftjetcms::LookupTable2d::ny_
private

Definition at line 30 of file LookupTable2d.h.

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

◆ xmax_

double fftjetcms::LookupTable2d::xmax_
private

Definition at line 32 of file LookupTable2d.h.

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

◆ xmin_

double fftjetcms::LookupTable2d::xmin_
private

Definition at line 31 of file LookupTable2d.h.

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

◆ ymax_

double fftjetcms::LookupTable2d::ymax_
private

Definition at line 34 of file LookupTable2d.h.

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

◆ ymin_

double fftjetcms::LookupTable2d::ymin_
private

Definition at line 33 of file LookupTable2d.h.

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

fftjetcms::LookupTable2d::xmax_
double xmax_
Definition: LookupTable2d.h:32
DDAxes::y
fftjetcms::LookupTable2d::data
const std::vector< double > & data() const
Definition: LookupTable2d.h:12
fftjetcms::LookupTable2d::nx_
unsigned nx_
Definition: LookupTable2d.h:29
cms::cuda::assert
assert(be >=bs)
fftjetcms::LookupTable2d::xmin_
double xmin_
Definition: LookupTable2d.h:31
DDAxes::x
fftjetcms::LookupTable2d::ymax_
double ymax_
Definition: LookupTable2d.h:34
fftjetcms::LookupTable2d::ny
unsigned ny() const
Definition: LookupTable2d.h:14
fftjetcms::LookupTable2d::data_
std::vector< double > data_
Definition: LookupTable2d.h:28
fftjetcms::LookupTable2d::ymin
double ymin() const
Definition: LookupTable2d.h:17
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
fftjetcms::LookupTable2d::nx
unsigned nx() const
Definition: LookupTable2d.h:13
fftjetcms::LookupTable2d::ny_
unsigned ny_
Definition: LookupTable2d.h:30
fftjetcms::LookupTable2d::xmin
double xmin() const
Definition: LookupTable2d.h:15
fftjetcms::LookupTable2d::bwx_
double bwx_
Definition: LookupTable2d.h:35
fftjetcms::LookupTable2d::ymax
double ymax() const
Definition: LookupTable2d.h:18
fftjetcms::LookupTable2d::xmax
double xmax() const
Definition: LookupTable2d.h:16
fftjetcms::LookupTable2d::ymin_
double ymin_
Definition: LookupTable2d.h:33
fftjetcms::LookupTable2d::bwy_
double bwy_
Definition: LookupTable2d.h:36