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

Helper for MultiVar2D. More...

Public Member Functions

 MultiVar2DFunc (const _MultiVar< T > &a, const Binning binsa, const _MultiVar< T > &b, const Binning binsb)
 
std::vector< double > operator() (const T *sr) const
 

Protected Attributes

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

Detailed Description

template<class T>
class ana::MultiVar2DFunc< T >

Helper for MultiVar2D.

Definition at line 19 of file MultiVar.cxx.

Constructor & Destructor Documentation

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

Definition at line 22 of file MultiVar.cxx.

24  : fA(a), fBinsA(binsa),
25  fB(b), fBinsB(binsb)
26  {
27  }
const _MultiVar< T > fB
Definition: MultiVar.cxx:63
const Binning fBinsA
Definition: MultiVar.cxx:62
const _MultiVar< T > fA
Definition: MultiVar.cxx:61
process_name gaushit a
const Binning fBinsB
Definition: MultiVar.cxx:64

Member Function Documentation

template<class T >
std::vector<double> ana::MultiVar2DFunc< T >::operator() ( const T *  sr) const
inline

Definition at line 29 of file MultiVar.cxx.

30  {
31  std::vector<double> returnVec;
32 
33  const std::vector<double> vaVec = fA(sr);
34  const std::vector<double> vbVec = fB(sr);
35 
36  if(vaVec.size() != vbVec.size())
37  {
38  std::cout << "MultiVars need to be same size, these two are size "
39  << vaVec.size() << " " << vbVec.size() << "respectively." << std::endl;
40  std::abort();
41  }
42 
43  for(unsigned n = 0; n < vaVec.size(); ++n){
44  const double va = vaVec.at(n);
45  const double vb = vbVec.at(n);
46  // Since there are no overflow/underflow bins, check the range
47  if(va < fBinsA.Min() || vb < fBinsB.Min()){ returnVec.push_back(-1); continue;}
48  if(va > fBinsA.Max() || vb > fBinsB.Max()){ returnVec.push_back(fBinsA.NBins() * fBinsB.NBins()); continue;}
49 
50  // FindBin uses root convention, first bin is bin 1, bin 0 is underflow
51  const int ia = fBinsA.FindBin(va) - 1;
52  const int ib = fBinsB.FindBin(vb) - 1;
53 
54  const int i = ia*fBinsB.NBins()+ib;
55 
56  returnVec.push_back(i+.5);
57  }
58  return returnVec;
59  }
const _MultiVar< T > fB
Definition: MultiVar.cxx:63
const Binning fBinsA
Definition: MultiVar.cxx:62
const _MultiVar< T > fA
Definition: MultiVar.cxx:61
double Min() const
Definition: Binning.h:28
int FindBin(float x) const
Definition: Binning.cxx:100
double Max() const
Definition: Binning.h:29
int NBins() const
Definition: Binning.h:27
BEGIN_PROLOG could also be cout
const Binning fBinsB
Definition: MultiVar.cxx:64

Member Data Documentation

template<class T >
const _MultiVar<T> ana::MultiVar2DFunc< T >::fA
protected

Definition at line 61 of file MultiVar.cxx.

template<class T >
const _MultiVar<T> ana::MultiVar2DFunc< T >::fB
protected

Definition at line 63 of file MultiVar.cxx.

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

Definition at line 62 of file MultiVar.cxx.

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

Definition at line 64 of file MultiVar.cxx.


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