ATLAS Offline Software
Loading...
Searching...
No Matches
VariableBinwidthHistogram.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// VariableBinwidthHistogram.h
6// Header file for class VariableBinwidthHistogram
8// (c) ATLAS Detector software
10//
12
13#ifndef VARIABLEBINWIDTHHISTOGRAM_H
14#define VARIABLEBINWIDTHHISTOGRAM_H
15
16// c - c++
17#include <algorithm>
18#include <iostream>
19#include <vector>
20
21// ROOT
22//#include "TH1.h"
23//#include "TGraph.h"
24
25class TH1F;
26class TGraph;
27
28// this
30
31namespace MuonCalib {
32
41 public:
42 //----------------------------constructors--------------------------------------
45
48 for (unsigned int i = 0; i < m_bins.size(); i++) { delete m_bins[i]; }
49 }
50
51 //-----------------------------public member functinos--------------------------
52
61 bool Initialize(TH1F *hist, double binc_r, double max_bin_width, double min_x = -9e9, double max_x = 9e9);
62
66 bool Smooth(double width);
67
71 inline const VariableBinwidthHistogramBin &GetBin(unsigned int bin) const { return *(m_bins[bin]); }
72
76 inline const VariableBinwidthHistogramBin &GetSortedBin(unsigned int bin) {
77 if (!m_sorted) {
78 sort(m_sort_bins.begin(), m_sort_bins.end());
79 m_sorted = true;
80 }
81 return m_sort_bins[bin].Bin();
82 }
83
85 inline unsigned int GetNumberOfBins() const { return m_bins.size(); }
86
88 TGraph *DenistyGraph() const;
89
91 TGraph *BinWidthGraph() const;
92
94 TGraph *BinContentGraph() const;
95
97 TGraph *DiffDensityGraph() const;
98
100 TGraph *DiffBinwidthGraph() const;
101
102 private:
103 //----------------------------private data members------------------------------
105 std::vector<VariableBinwidthHistogramBin *> m_bins;
106
108 std::vector<VBHBinPtrSrt> m_sort_bins;
109
111 unsigned int m_binc;
112
115
118
120
121 //--------------------------privite member functions----------------------------
122 inline double sign(double val) const {
123 if (val > 0.0) return 1.0;
124 if (val < 0.0) return -1.0;
125 if (val == 0.0) return 0;
126 return 0;
127 }
128 };
129
130} // namespace MuonCalib
131
132#endif
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
const double width
A bin of a VariableBinwidthHistogram.
std::vector< VariableBinwidthHistogramBin * > m_bins
vector containing histogram bins
std::vector< VBHBinPtrSrt > m_sort_bins
bins sorted by content
bool Smooth(double width)
Removes steps that origin in a binning effekt.
const VariableBinwidthHistogramBin & GetSortedBin(unsigned int bin)
Get a bin sorted by content.
TGraph * DiffDensityGraph() const
Plot graph with differential density.
const VariableBinwidthHistogramBin & GetBin(unsigned int bin) const
Get a bin.
TGraph * DiffBinwidthGraph() const
Plot graph with differential binwidth.
TGraph * BinContentGraph() const
Plot bin content graph - bin content vs bin center.
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 * DenistyGraph() const
create density graph - density vs bin center
TGraph * BinWidthGraph() const
Plot binwidth graph - binwidth versus bin center.
unsigned int m_binc
number of entries per bin
unsigned int GetNumberOfBins() const
Get the number of bins.
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)