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

Collect information describing the x-axis of an analysis histogram. More...

#include <HistAxis.h>

Public Member Functions

 _HistAxis (const std::string &label, const Binning &bins, const T &var)
 
 _HistAxis (const std::vector< std::string > &labels, const std::vector< Binning > &bins, const std::vector< T > &vars)
 
 _HistAxis (const std::string &labelX, const Binning &binsX, const T &varX, const std::string &labelY, const Binning &binsY, const T &varY)
 
 _HistAxis (const std::string &label, int nx, double x0, double x1, const T &var)
 Shortcut for simple binnings. More...
 
 _HistAxis (const std::string &labelX, int nx, double x0, double x1, const T &varX, const std::string &labelY, int ny, double y0, double y1, const T &varY)
 Shortcut for simple binnings. More...
 
unsigned int NDimensions () const
 
std::vector< std::string > GetLabels () const
 
std::vector< BinningGetBinnings () const
 
std::vector< T > GetVars () const
 
GetMultiDVar () const
 

Protected Attributes

std::vector< std::string > fLabels
 
std::vector< BinningfBins
 
std::vector< T > fVars
 

Detailed Description

template<class T>
class ana::_HistAxis< T >

Collect information describing the x-axis of an analysis histogram.

That is, what it should be labelled, what the binning should be, and what variable will be being filled into it.

Definition at line 14 of file HistAxis.h.

Constructor & Destructor Documentation

template<class T>
ana::_HistAxis< T >::_HistAxis ( const std::string &  label,
const Binning bins,
const T &  var 
)

Definition at line 9 of file HistAxis.cxx.

12  : fLabels(1, label),
13  fBins(1, bins),
14  fVars(1, var)
15  {
16  }
std::vector< Binning > fBins
Definition: HistAxis.h:58
std::vector< T > fVars
Definition: HistAxis.h:59
std::vector< std::string > fLabels
Definition: HistAxis.h:57
template<class T>
ana::_HistAxis< T >::_HistAxis ( const std::vector< std::string > &  labels,
const std::vector< Binning > &  bins,
const std::vector< T > &  vars 
)

Definition at line 20 of file HistAxis.cxx.

23  : fLabels(labels), fBins(bins), fVars(vars)
24  {
25  assert(fLabels.size() == fBins.size());
26  assert(fBins.size() == fVars.size());
27  }
std::vector< Binning > fBins
Definition: HistAxis.h:58
std::vector< T > fVars
Definition: HistAxis.h:59
std::vector< std::string > fLabels
Definition: HistAxis.h:57
template<class T>
ana::_HistAxis< T >::_HistAxis ( const std::string &  labelX,
const Binning binsX,
const T &  varX,
const std::string &  labelY,
const Binning binsY,
const T &  varY 
)

Definition at line 31 of file HistAxis.cxx.

37  : fLabels({labelX, labelY}),
std::vector< std::string > fLabels
Definition: HistAxis.h:57
template<class T>
ana::_HistAxis< T >::_HistAxis ( const std::string &  label,
int  nx,
double  x0,
double  x1,
const T &  var 
)

Shortcut for simple binnings.

Definition at line 45 of file HistAxis.cxx.

48  : _HistAxis(label, Binning::Simple(nx, x0, x1), var)
49  {
50  }
_HistAxis(const std::string &label, const Binning &bins, const T &var)
Definition: HistAxis.cxx:9
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:38
template<class T>
ana::_HistAxis< T >::_HistAxis ( const std::string &  labelX,
int  nx,
double  x0,
double  x1,
const T &  varX,
const std::string &  labelY,
int  ny,
double  y0,
double  y1,
const T &  varY 
)

Shortcut for simple binnings.

Definition at line 54 of file HistAxis.cxx.

60  : _HistAxis(labelX, Binning::Simple(nx, x0, x1), varX,
61  labelY, Binning::Simple(ny, y0, y1), varY)
62  {
63  }
_HistAxis(const std::string &label, const Binning &bins, const T &var)
Definition: HistAxis.cxx:9
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:38

Member Function Documentation

template<class T>
std::vector<Binning> ana::_HistAxis< T >::GetBinnings ( ) const
inline

Definition at line 49 of file HistAxis.h.

49 {return fBins;}
std::vector< Binning > fBins
Definition: HistAxis.h:58
template<class T>
std::vector<std::string> ana::_HistAxis< T >::GetLabels ( ) const
inline

Definition at line 48 of file HistAxis.h.

48 {return fLabels;}
std::vector< std::string > fLabels
Definition: HistAxis.h:57
template<class T >
T ana::_HistAxis< T >::GetMultiDVar ( ) const

A variable "flattening" all the dimensions into one 1D value. Use sparingly.

Definition at line 66 of file HistAxis.cxx.

67  {
68  switch(fVars.size()){
69  case 1:
70  return fVars[0];
71  case 2:
72  return Var2D(fVars[0], fBins[0],
73  fVars[1], fBins[1]);
74  case 3:
75  return Var3D(fVars[0], fBins[0],
76  fVars[1], fBins[1],
77  fVars[2], fBins[2]);
78  default:
79  std::cout << "Error: HistAxis::GetMultiDVar() doesn't support "
80  << fVars.size() << "-dimensional axes" << std::endl;
81  abort();
82  }
83  }
std::vector< Binning > fBins
Definition: HistAxis.h:58
_Var< T > Var2D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb)
Variable formed from two input variables.
Definition: Var.cxx:109
std::vector< T > fVars
Definition: HistAxis.h:59
_Var< T > Var3D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb, const _Var< T > &c, const Binning &binsc)
This is just like a Var2D, but useful for 3D Spectra.
Definition: Var.cxx:133
BEGIN_PROLOG could also be cout
template<class T>
std::vector<T> ana::_HistAxis< T >::GetVars ( ) const
inline

Definition at line 50 of file HistAxis.h.

50 {return fVars;}
std::vector< T > fVars
Definition: HistAxis.h:59
template<class T>
unsigned int ana::_HistAxis< T >::NDimensions ( ) const
inline

Definition at line 46 of file HistAxis.h.

46 {return fLabels.size();}
std::vector< std::string > fLabels
Definition: HistAxis.h:57

Member Data Documentation

template<class T>
std::vector<Binning> ana::_HistAxis< T >::fBins
protected

Definition at line 58 of file HistAxis.h.

template<class T>
std::vector<std::string> ana::_HistAxis< T >::fLabels
protected

Definition at line 57 of file HistAxis.h.

template<class T>
std::vector<T> ana::_HistAxis< T >::fVars
protected

Definition at line 59 of file HistAxis.h.


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