ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::VariableBinwidthHistogramBin Class Reference

A bin of a VariableBinwidthHistogram. More...

#include <VariableBinwidthHistogramBin.h>

Collaboration diagram for MuonCalib::VariableBinwidthHistogramBin:

Public Member Functions

 VariableBinwidthHistogramBin ()
 Default constructor.
 VariableBinwidthHistogramBin (double center, double width, unsigned int content)
 Initializing constructor.
void Set (double center, double width, unsigned int content)
 Set bin.
void SetContent (unsigned int n)
 set content
VariableBinwidthHistogramBin operator+= (unsigned int n)
 add to bin content
VariableBinwidthHistogramBin operator+ (unsigned int n)
 add to bin content
void MoveRight (double new_right)
 move right bin boarder
void MoveLeft (double new_left)
 move left bin boarder
double Center () const
 Get bin center.
double Width () const
 Get width of the bin.
double Left () const
 Get left (lower) bin border.
double Right () const
 Get right (upper) bin border.
unsigned int Entries () const
 Get number of entries in the bin.
double Density () const
 Get density=Entries()/Width()

Private Attributes

double m_center
double m_width
unsigned int m_content

Detailed Description

Constructor & Destructor Documentation

◆ VariableBinwidthHistogramBin() [1/2]

MuonCalib::VariableBinwidthHistogramBin::VariableBinwidthHistogramBin ( )
inline

◆ VariableBinwidthHistogramBin() [2/2]

MuonCalib::VariableBinwidthHistogramBin::VariableBinwidthHistogramBin ( double center,
double width,
unsigned int content )
inline

Initializing constructor.

Parameters
centerthe center of the bin
widththe width of the bin
contentthe number of entries in the bin

Definition at line 35 of file VariableBinwidthHistogramBin.h.

35 :
36 m_center(center), m_width(width), m_content(content) {}
const double width

Member Function Documentation

◆ Center()

double MuonCalib::VariableBinwidthHistogramBin::Center ( ) const
inline

Get bin center.

Definition at line 105 of file VariableBinwidthHistogramBin.h.

105{ return m_center; }

◆ Density()

double MuonCalib::VariableBinwidthHistogramBin::Density ( ) const
inline

Get density=Entries()/Width()

Definition at line 120 of file VariableBinwidthHistogramBin.h.

120{ return static_cast<double>(m_content) / m_width; }

◆ Entries()

unsigned int MuonCalib::VariableBinwidthHistogramBin::Entries ( ) const
inline

Get number of entries in the bin.

Definition at line 117 of file VariableBinwidthHistogramBin.h.

117{ return m_content; }

◆ Left()

double MuonCalib::VariableBinwidthHistogramBin::Left ( ) const
inline

Get left (lower) bin border.

Definition at line 111 of file VariableBinwidthHistogramBin.h.

111{ return m_center - 0.5 * m_width; }

◆ MoveLeft()

void MuonCalib::VariableBinwidthHistogramBin::MoveLeft ( double new_left)
inline

move left bin boarder

Parameters
new_leftleft bin boarder

Definition at line 94 of file VariableBinwidthHistogramBin.h.

94 {
95 double right = Right();
96 if (new_left > right) {
97 throw std::runtime_error(
98 Form("File: %s, Line: %d\nVariableBinwidthHistogramBin::MoveRight() - new left is too small!", __FILE__, __LINE__));
99 }
100 m_width = right - new_left;
101 m_center = 0.5 * (new_left + right);
102 }
double Right() const
Get right (upper) bin border.

◆ MoveRight()

void MuonCalib::VariableBinwidthHistogramBin::MoveRight ( double new_right)
inline

move right bin boarder

Parameters
new_rightright bin boarder

Definition at line 80 of file VariableBinwidthHistogramBin.h.

80 {
81 double left = Left();
82 if (new_right < left) {
83 throw std::runtime_error(
84 Form("File: %s, Line: %d\nVariableBinwidthHistogramBin::MoveRight() - new right is too small!", __FILE__, __LINE__));
85 }
86 m_width = new_right - left;
87 m_center = 0.5 * (left + new_right);
88 }
double Left() const
Get left (lower) bin border.

◆ operator+()

VariableBinwidthHistogramBin MuonCalib::VariableBinwidthHistogramBin::operator+ ( unsigned int n)
inline

add to bin content

Parameters
nis added

Definition at line 70 of file VariableBinwidthHistogramBin.h.

70 {
72 ret += n;
73 return ret;
74 }

◆ operator+=()

VariableBinwidthHistogramBin MuonCalib::VariableBinwidthHistogramBin::operator+= ( unsigned int n)
inline

add to bin content

Parameters
nis added

Definition at line 62 of file VariableBinwidthHistogramBin.h.

62 {
63 m_content += n;
64 return *this;
65 }

◆ Right()

double MuonCalib::VariableBinwidthHistogramBin::Right ( ) const
inline

Get right (upper) bin border.

Definition at line 114 of file VariableBinwidthHistogramBin.h.

114{ return m_center + 0.5 * m_width; }

◆ Set()

void MuonCalib::VariableBinwidthHistogramBin::Set ( double center,
double width,
unsigned int content )
inline

Set bin.

Parameters
centerthe center of the bin
widththe width of the bin
contentthe number of entries in the bin

Definition at line 46 of file VariableBinwidthHistogramBin.h.

46 {
47 m_center = center;
48 m_width = width;
50 }
str content
Definition grepfile.py:56

◆ SetContent()

void MuonCalib::VariableBinwidthHistogramBin::SetContent ( unsigned int n)
inline

set content

Parameters
nnew bin content

Definition at line 56 of file VariableBinwidthHistogramBin.h.

56{ m_content = n; }

◆ Width()

double MuonCalib::VariableBinwidthHistogramBin::Width ( ) const
inline

Get width of the bin.

Definition at line 108 of file VariableBinwidthHistogramBin.h.

108{ return m_width; }

Member Data Documentation

◆ m_center

double MuonCalib::VariableBinwidthHistogramBin::m_center
private

Definition at line 125 of file VariableBinwidthHistogramBin.h.

◆ m_content

unsigned int MuonCalib::VariableBinwidthHistogramBin::m_content
private

Definition at line 126 of file VariableBinwidthHistogramBin.h.

◆ m_width

double MuonCalib::VariableBinwidthHistogramBin::m_width
private

Definition at line 125 of file VariableBinwidthHistogramBin.h.


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