|
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include "GaudiKernel/MsgStream.h"
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));
55 for (
int i = first_bin;
i <= last_bin;
i++) {
57 if (
hist->GetBinCenter(
i) > current_bin->
Right()) {
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;
74 (*current_bin) +=
static_cast<unsigned int>(
hist->GetBinContent(
i));
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;
114 Double_t *
x =
new Double_t[
m_bins.size()], *
y =
new Double_t[
m_bins.size()];
115 for (
unsigned int i = 0;
i <
m_bins.size();
i++) {
128 Double_t *
x =
new Double_t[
m_bins.size()], *
y =
new Double_t[
m_bins.size()];
129 for (
unsigned int i = 0;
i <
m_bins.size();
i++) {
142 Double_t *
x =
new Double_t[
m_bins.size()], *
y =
new Double_t[
m_bins.size()];
143 for (
unsigned int i = 0;
i <
m_bins.size();
i++) {
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);
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);
void SetContent(unsigned int n)
set content
void MoveRight(double new_right)
move right bin boarder
singleton-like access to IMessageSvc via open function and helper
std::vector< VBHBinPtrSrt > m_sort_bins
bins sorted by content
TGraph * DiffDensityGraph() const
Plot graph with differential density.
TGraph * DenistyGraph() const
create density graph - density vs bin center
std::vector< VariableBinwidthHistogramBin * > m_bins
vector containing histogram bins
IMessageSvc * getMessageSvc(bool quiet=false)
TGraph * DiffBinwidthGraph() const
Plot graph with differential binwidth.
double m_max_bin_width
maximum bin width
TGraph * BinContentGraph() const
Plot bin content graph - bin content vs bin center.
bool Smooth(double width)
Removes steps that origin in a binning effekt.
double sign(double val) const
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
unsigned int Entries() const
Get number of entries in the bin.
unsigned int m_binc
number of entries per bin
bool 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.
TGraph * BinWidthGraph() const
Plot binwidth graph - binwidth versus bin center.
double Right() const
Get right (upper) bin border.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)