Rivet: /Users/chrisg/software/rivet/include/Rivet/Tools/BinnedHistogram.hh Source File

| Rivet 3.1.9

BinnedHistogram.hh
1// -*- C++ -*-
2#ifndef RIVET_BINNEDHISTOGRAM_HH
3#define RIVET_BINNEDHISTOGRAM_HH
4
7
8
9#include "Rivet/Config/RivetCommon.hh"
10#include "Rivet/Tools/RivetYODA.hh"
11
12namespace Rivet {
13
14 class Analysis;
15
16
23 class BinnedHistogram {
24 public:
25
27 BinnedHistogram() = default;
28
30 BinnedHistogram(const vector<double>& edges, const vector<Histo1DPtr>& histos) {
31 assert(edges.size() == histos.size()+1);
32 for (size_t i = 0; i < histos.size(); ++i)
33 add(edges[i], edges[i+1], histos[i]);
34 }
35
37
38
40 const BinnedHistogram & add(double binMin, double binMax, Histo1DPtr histo);
41
42
44 void fill(double binval, double val, double weight = 1.0);
45
46
49 const Histo1DPtr histo(double binval) const;
52 Histo1DPtr histo(double binval);
53
55 const vector<Histo1DPtr>& histos() const { return _histos; }
57 vector<Histo1DPtr>& histos() { return _histos; }
58
59
60
63 void scale(double scale, Analysis* ana);
64
65
66 private:
67
68 map<double, Histo1DPtr> _histosByUpperBound, _histosByLowerBound;
69 vector<Histo1DPtr> _histos;
70 map<Histo1DPtr, double> _binWidths;
71
72 };
73
74
75}
76
77#endif
Rivet::Analysis
This is the base class of all analysis classes in Rivet.
Definition Analysis.hh:65
Rivet::BinnedHistogram
A set of booked Histo1DPtr, each in a bin of a second variable.
Definition BinnedHistogram.hh:23
Rivet::BinnedHistogram::histos
vector< Histo1DPtr > & histos()
Get the contained histograms.
Definition BinnedHistogram.hh:57
Rivet::BinnedHistogram::add
const BinnedHistogram & add(double binMin, double binMax, Histo1DPtr histo)
Add a histogram in the T bin between binMin and binMax.
Rivet::BinnedHistogram::BinnedHistogram
BinnedHistogram()=default
Create a new empty BinnedHistogram.
Rivet::BinnedHistogram::BinnedHistogram
BinnedHistogram(const vector< double > &edges, const vector< Histo1DPtr > &histos)
Create a new BinnedHistogram with the given bin edges and contents.
Definition BinnedHistogram.hh:30
Rivet::BinnedHistogram::histo
const Histo1DPtr histo(double binval) const
Get the histogram in the same bin as binval (const)
Rivet::BinnedHistogram::histos
const vector< Histo1DPtr > & histos() const
Get the contained histograms (const)
Definition BinnedHistogram.hh:55
Rivet::BinnedHistogram::scale
void scale(double scale, Analysis *ana)
Rivet::BinnedHistogram::histo
Histo1DPtr histo(double binval)
Get the histogram in the same bin as binval.
Rivet::BinnedHistogram::fill
void fill(double binval, double val, double weight=1.0)
Fill the histogram in the same bin as binval with value val and weight weight.
Rivet
Definition MC_Cent_pPb.hh:10