All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistAxis.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <string>
7 
8 namespace ana
9 {
10  /// \brief Collect information describing the x-axis of an analysis histogram
11  ///
12  /// That is, what it should be labelled, what the binning should be, and what
13  /// variable will be being filled into it.
14  template<class T> class _HistAxis
15  {
16  public:
17  _HistAxis(const std::string& label,
18  const Binning& bins,
19  const T& var);
20 
21  _HistAxis(const std::vector<std::string>& labels,
22  const std::vector<Binning>& bins,
23  const std::vector<T>& vars);
24 
25  _HistAxis(const std::string& labelX,
26  const Binning& binsX,
27  const T& varX,
28  const std::string& labelY,
29  const Binning& binsY,
30  const T& varY);
31 
32  /// Shortcut for simple binnings
33  _HistAxis(const std::string& label,
34  int nx, double x0, double x1,
35  const T& var);
36 
37  /// Shortcut for simple binnings
38  _HistAxis(const std::string& labelX,
39  int nx, double x0, double x1,
40  const T& varX,
41  const std::string& labelY,
42  int ny, double y0, double y1,
43  const T& varY);
44 
45 
46  unsigned int NDimensions() const{return fLabels.size();}
47 
48  std::vector<std::string> GetLabels() const {return fLabels;}
49  std::vector<Binning> GetBinnings() const {return fBins;}
50  std::vector<T> GetVars() const {return fVars;}
51 
52  /// A variable "flattening" all the dimensions into one 1D value. Use
53  /// sparingly.
54  T GetMultiDVar() const;
55 
56  protected:
57  std::vector<std::string> fLabels;
58  std::vector<Binning> fBins;
59  std::vector<T> fVars;
60  };
61 
64 }
std::vector< Binning > fBins
Definition: HistAxis.h:58
* labels
_HistAxis< Var > HistAxis
Definition: HistAxis.h:62
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:18
_HistAxis< SpillVar > SpillHistAxis
Definition: HistAxis.h:63
std::vector< T > fVars
Definition: HistAxis.h:59
std::vector< T > GetVars() const
Definition: HistAxis.h:50
process_name opflashCryoW ana
std::vector< Binning > GetBinnings() const
Definition: HistAxis.h:49
_HistAxis(const std::string &label, const Binning &bins, const T &var)
Definition: HistAxis.cxx:9
unsigned int NDimensions() const
Definition: HistAxis.h:46
std::vector< std::string > GetLabels() const
Definition: HistAxis.h:48
T GetMultiDVar() const
Definition: HistAxis.cxx:66
Collect information describing the x-axis of an analysis histogram.
Definition: HistAxis.h:14
std::vector< std::string > fLabels
Definition: HistAxis.h:57