All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
ana::Var2DFunc< T > Class Template Reference

Helper for Var2D. More...

Public Member Functions

 Var2DFunc (const _Var< T > &a, const Binning binsa, const _Var< T > &b, const Binning binsb)
 
double operator() (const T *sr) const
 

Protected Attributes

const _Var< T > fA
 
const Binning fBinsA
 
const _Var< T > fB
 
const Binning fBinsB
 

Detailed Description

template<class T>
class ana::Var2DFunc< T >

Helper for Var2D.

Definition at line 25 of file Var.cxx.

Constructor & Destructor Documentation

template<class T >
ana::Var2DFunc< T >::Var2DFunc ( const _Var< T > &  a,
const Binning  binsa,
const _Var< T > &  b,
const Binning  binsb 
)
inline

Definition at line 28 of file Var.cxx.

30  : fA(a), fBinsA(binsa),
31  fB(b), fBinsB(binsb)
32  {
33  }
process_name gaushit a
const _Var< T > fA
Definition: Var.cxx:55
const _Var< T > fB
Definition: Var.cxx:57
const Binning fBinsA
Definition: Var.cxx:56
const Binning fBinsB
Definition: Var.cxx:58

Member Function Documentation

template<class T >
double ana::Var2DFunc< T >::operator() ( const T *  sr) const
inline

Definition at line 35 of file Var.cxx.

36  {
37  // Calculate current values of the variables in StandardRecord once
38  const double va = fA(sr);
39  const double vb = fB(sr);
40 
41  // Since there are no overflow/underflow bins, check the range
42  if(va < fBinsA.Min() || vb < fBinsB.Min()) return -1;
43  if(va > fBinsA.Max() || vb > fBinsB.Max()) return fBinsA.NBins() * fBinsB.NBins();
44 
45  // FindBin uses root convention, first bin is bin 1, bin 0 is underflow
46  const int ia = fBinsA.FindBin(va) - 1;
47  const int ib = fBinsB.FindBin(vb) - 1;
48 
49  const int i = ia*fBinsB.NBins()+ib;
50 
51  return i+.5;
52  }
double Min() const
Definition: Binning.h:28
int FindBin(float x) const
Definition: Binning.cxx:100
const _Var< T > fA
Definition: Var.cxx:55
double Max() const
Definition: Binning.h:29
const _Var< T > fB
Definition: Var.cxx:57
const Binning fBinsA
Definition: Var.cxx:56
int NBins() const
Definition: Binning.h:27
const Binning fBinsB
Definition: Var.cxx:58

Member Data Documentation

template<class T >
const _Var<T> ana::Var2DFunc< T >::fA
protected

Definition at line 55 of file Var.cxx.

template<class T >
const _Var<T> ana::Var2DFunc< T >::fB
protected

Definition at line 57 of file Var.cxx.

template<class T >
const Binning ana::Var2DFunc< T >::fBinsA
protected

Definition at line 56 of file Var.cxx.

template<class T >
const Binning ana::Var2DFunc< T >::fBinsB
protected

Definition at line 58 of file Var.cxx.


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