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< TfA
 
const Binning fBinsA
 
const _Var< TfB
 
const Binning fBinsB
 

Detailed Description

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

Helper for Var2D.

Definition at line 163 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 166 of file Var.cxx.

168  : fA(a), fBinsA(binsa),
169  fB(b), fBinsB(binsb)
170  {
171  }
const double a
const _Var< T > fA
Definition: Var.cxx:193
const _Var< T > fB
Definition: Var.cxx:195
const Binning fBinsA
Definition: Var.cxx:194
const hit & b
Definition: hits.cxx:21
const Binning fBinsB
Definition: Var.cxx:196

Member Function Documentation

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

Definition at line 173 of file Var.cxx.

References MECModelEnuComparisons::i, submit_nova_art::va, and APDInfo::vb.

174  {
175  // Calculate current values of the variables in StandardRecord once
176  const double va = fA(sr);
177  const double vb = fB(sr);
178 
179  // Since there are no overflow/underflow bins, check the range
180  if(va < fBinsA.Min() || vb < fBinsB.Min()) return -1;
181  if(va > fBinsA.Max() || vb > fBinsB.Max()) return fBinsA.NBins() * fBinsB.NBins();
182 
183  // FindBin uses root convention, first bin is bin 1, bin 0 is underflow
184  const int ia = fBinsA.FindBin(va) - 1;
185  const int ib = fBinsB.FindBin(vb) - 1;
186 
187  const int i = ia*fBinsB.NBins()+ib;
188 
189  return i+.5;
190  }
int FindBin(double x) const
Definition: Binning.cxx:155
double Min() const
Definition: Binning.h:30
caf::StandardRecord * sr
const _Var< T > fA
Definition: Var.cxx:193
double Max() const
Definition: Binning.h:31
const _Var< T > fB
Definition: Var.cxx:195
const Binning fBinsA
Definition: Var.cxx:194
int NBins() const
Definition: Binning.h:29
const Binning fBinsB
Definition: Var.cxx:196

Member Data Documentation

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

Definition at line 193 of file Var.cxx.

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

Definition at line 195 of file Var.cxx.

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

Definition at line 194 of file Var.cxx.

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

Definition at line 196 of file Var.cxx.


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