#include <VariableBinwidthHistogram.h>
A histogram where every bin has the same number of entries. The density is represented by the bin width.
- Author
- Felix.nosp@m..Rau.nosp@m.scher.nosp@m.@Phy.nosp@m.sik.U.nosp@m.ni-M.nosp@m.uench.nosp@m.en.D.nosp@m.e
- Date
- February 2006
Definition at line 40 of file VariableBinwidthHistogram.h.
◆ VariableBinwidthHistogram()
MuonCalib::VariableBinwidthHistogram::VariableBinwidthHistogram |
( |
| ) |
|
|
inline |
◆ ~VariableBinwidthHistogram()
MuonCalib::VariableBinwidthHistogram::~VariableBinwidthHistogram |
( |
| ) |
|
|
inline |
◆ BinContentGraph()
TGraph * MuonCalib::VariableBinwidthHistogram::BinContentGraph |
( |
| ) |
const |
◆ BinWidthGraph()
TGraph * MuonCalib::VariableBinwidthHistogram::BinWidthGraph |
( |
| ) |
const |
◆ DenistyGraph()
TGraph * MuonCalib::VariableBinwidthHistogram::DenistyGraph |
( |
| ) |
const |
◆ DiffBinwidthGraph()
TGraph * MuonCalib::VariableBinwidthHistogram::DiffBinwidthGraph |
( |
| ) |
const |
Plot graph with differential binwidth.
Definition at line 166 of file VariableBinwidthHistogram.cxx.
169 log << MSG::WARNING <<
"DiffBinwidthGraph() - Need at alst 2 bins for differential density!" <<
endmsg;
172 Double_t *
x =
new Double_t[
m_bins.size() - 1], *
y =
new Double_t[
m_bins.size() - 1];
173 for (
unsigned int i = 0;
i <
m_bins.size() - 1;
i++) {
177 TGraph *
gr =
new TGraph(
m_bins.size() - 1,
x,
y);
◆ DiffDensityGraph()
TGraph * MuonCalib::VariableBinwidthHistogram::DiffDensityGraph |
( |
| ) |
const |
Plot graph with differential density.
Definition at line 151 of file VariableBinwidthHistogram.cxx.
154 log << MSG::WARNING <<
"DiffDensityGraph() - Need at alst 2 bins for differential density!" <<
endmsg;
157 Double_t *
x =
new Double_t[
m_bins.size() - 1], *
y =
new Double_t[
m_bins.size() - 1];
158 for (
unsigned int i = 0;
i <
m_bins.size() - 1;
i++) {
162 TGraph *
gr =
new TGraph(
m_bins.size() - 1,
x,
y);
◆ GetBin()
◆ GetNumberOfBins()
unsigned int MuonCalib::VariableBinwidthHistogram::GetNumberOfBins |
( |
| ) |
const |
|
inline |
◆ GetSortedBin()
◆ Initialize()
bool MuonCalib::VariableBinwidthHistogram::Initialize |
( |
TH1F * |
hist, |
|
|
double |
binc_r, |
|
|
double |
max_bin_width, |
|
|
double |
min_x = -9e9 , |
|
|
double |
max_x = 9e9 |
|
) |
| |
Initialize with new input histogram Returns on error false.
- Parameters
-
hist | the input histogram |
binc_r | number of entries per bin / max number of entries in hist |
max_bin_width | The binwidth will not exceed the maximum_bin_width |
min_x | only the range between min_x and max_x will be used |
max_x | only the range between min_x and max_x will be used |
Definition at line 22 of file VariableBinwidthHistogram.cxx.
24 throw std::runtime_error(
25 Form(
"File: %s, Line: %d\nVariableBinwidthHistogram::Initialize - binc_rate must be greater than 1!", __FILE__, __LINE__));
29 int first_bin(
hist->FindBin(min_x)), last_bin(
hist->FindBin(max_x));
35 if (last_bin >
hist->GetNbinsX())
36 last_bin =
hist->GetNbinsX();
43 for (
int i = first_bin;
i <= last_bin;
i++) {
44 if (max < hist->GetBinContent(
i))
max =
hist->GetBinContent(
i);
48 m_binc =
static_cast<unsigned int>(ceil(
max * binc_rate));
52 m_bins.push_back(
new VariableBinwidthHistogramBin(
hist->GetBinLowEdge(first_bin) + 0.5 * max_bin_width, max_bin_width, 0));
53 VariableBinwidthHistogramBin *current_bin(
m_bins[0]);
55 for (
int i = first_bin;
i <= last_bin;
i++) {
57 if (
hist->GetBinCenter(
i) > current_bin->Right()) {
58 m_bins.push_back(
new VariableBinwidthHistogramBin(current_bin->Right() + 0.5 *
m_max_bin_width, max_bin_width, 0));
62 if (current_bin->Entries() +
static_cast<unsigned int>(
hist->GetBinContent(
i)) >
m_binc) {
64 unsigned int overflow = current_bin->Entries() +
static_cast<unsigned int>(
hist->GetBinContent(
i)) -
m_binc;
66 current_bin->MoveRight(
hist->GetBinLowEdge(
i));
67 current_bin->SetContent(
m_binc);
74 (*current_bin) +=
static_cast<unsigned int>(
hist->GetBinContent(
i));
◆ sign()
double MuonCalib::VariableBinwidthHistogram::sign |
( |
double |
val | ) |
const |
|
inlineprivate |
◆ Smooth()
bool MuonCalib::VariableBinwidthHistogram::Smooth |
( |
double |
width | ) |
|
Removes steps that origin in a binning effekt.
- Parameters
-
width | smoothin parameter (typically the binwidth of the input-hisatogram) |
Definition at line 87 of file VariableBinwidthHistogram.cxx.
91 log << MSG::WARNING <<
"Smooth() - VBH has less than 3 bins" <<
endmsg;
94 for (
unsigned int i = 0;
i <
m_bins.size() - 3;
i++) {
98 if (
sign(sl1) ==
sign(sl2))
continue;
100 if (std::abs(sl1) <
width / 2 || std::abs(sl2) <
width / 2)
continue;
◆ m_binc
unsigned int MuonCalib::VariableBinwidthHistogram::m_binc |
|
private |
◆ m_bins
◆ m_error
bool MuonCalib::VariableBinwidthHistogram::m_error |
|
private |
◆ m_max_bin_width
double MuonCalib::VariableBinwidthHistogram::m_max_bin_width |
|
private |
◆ m_sort_bins
std::vector<VBHBinPtrSrt> MuonCalib::VariableBinwidthHistogram::m_sort_bins |
|
private |
◆ m_sorted
bool MuonCalib::VariableBinwidthHistogram::m_sorted |
|
private |
The documentation for this class was generated from the following files: