Cat
Public Member Functions | Private Attributes | List of all members
Histo1D Class Reference

#include <Histo1D.h>

Inheritance diagram for Histo1D:
Object Attrib

Public Member Functions

 Histo1D (TH1D *histo)
 
 ~Histo1D ()
 
void def ()
 
void fill (double x, double value=1.)
 
double minY ()
 
double maxY ()
 
double maxX ()
 
double minX ()
 
std::vector< double > bins ()
 
std::vector< double > centers ()
 
std::vector< double > edges ()
 
unsigned long nBin ()
 
double bin (double x)
 
double binEdgeMin (unsigned int)
 
double binEdgeMax (unsigned int)
 
double binContent (int i)
 
double overflow ()
 
double underflow ()
 
void statistics (double &, double &, double &)
 
- Public Member Functions inherited from Object
 Object ()
 Standard constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string name () const
 
std::string type ()
 
unsigned char id ()
 
std::string title ()
 
void msgSvc (int level, std::string msg, std::string name)
 
void msg (std::string mymsg)
 
void verbose (std::string mymsg)
 
void debug (std::string mymsg)
 
void info (std::string mymsg)
 
void warning (std::string mymsg)
 
void error (std::string mymsg)
 
void fatal (std::string mymsg)
 
void msg (std::string mymsg, std::string name)
 
void verbose (std::string mymsg, std::string name)
 
void debug (std::string mymsg, std::string name)
 
void info (std::string mymsg, std::string name)
 
void warning (std::string mymsg, std::string name)
 
void error (std::string mymsg, std::string name)
 
void fatal (std::string mymsg, std::string name)
 
void setName (std::string name)
 
void setType (std::string type)
 
void setId (unsigned char id)
 
void setTitle (std::string title)
 
void setDllName (std::string dllName)
 
std::string dllName ()
 
- Public Member Functions inherited from Attrib
 Attrib ()
 Standard constructor. More...
 
virtual ~Attrib ()
 Destructor. More...
 
bool is (int attribut)
 
void add (int attribut)
 
void remove (int attribut)
 
std::string attributs ()
 

Private Attributes

double m_zero
 
double m_infini
 
unsigned long m_nbins
 
std::vector< double > m_bins
 
std::vector< double > m_centers
 
std::vector< double > m_edges
 
double m_minX
 
double m_maxX
 
double m_minY
 
double m_maxY
 
double m_delta
 
double m_overflow
 
double m_underflow
 
double m_content
 
double m_mean
 
double m_rms
 

Additional Inherited Members

- Public Types inherited from Attrib
enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 
- Protected Attributes inherited from Attrib
std::string m_attribString [10]
 

Detailed Description

Definition at line 28 of file Histo1D.h.

Constructor & Destructor Documentation

◆ Histo1D()

Histo1D::Histo1D ( TH1D *  histo)

Definition at line 22 of file Histo1D.cpp.

References m_bins, m_centers, m_content, m_delta, m_edges, m_maxX, m_maxY, m_mean, m_minX, m_minY, m_nbins, m_overflow, m_rms, m_underflow, and Object::setTitle().

22  : m_zero ( 1.e-30 ) , m_infini(1.e30) {
23  //m_histo = histo;
24 
25  m_nbins = histo->GetNbinsX();
26 
27  setTitle(std::string(histo -> GetTitle()));
28 
29  m_bins.resize (m_nbins,0.);
30  m_centers.resize (m_nbins,0.);
31  m_edges.resize (m_nbins+1,0.);
32 
33  unsigned long nbin=0;
34  for (nbin=0;nbin<m_nbins; ++nbin){
35  m_bins[nbin]=histo->GetBinContent(nbin+1);
36  m_centers[nbin]=histo->GetBinCenter(nbin+1);
37  }
38 
39  m_delta = histo->GetBinWidth(0);
40 
41  for (nbin=0;nbin<m_nbins+1; ++nbin){
42  m_edges[nbin]=histo->GetBinLowEdge(1)+nbin*m_delta;
43  }
44 
45  m_underflow = histo->GetBinContent(0);
46  m_overflow = histo->GetBinContent(histo->GetNbinsX()+1);
47 
48  m_minX = histo->GetBinLowEdge(1);
49  m_maxX = histo->GetBinLowEdge(histo->GetNbinsX()+1);
50 
51  m_minY = histo->GetMinimum();
52  m_maxY = histo->GetMaximum();
53 
54  m_content = histo->GetEntries();
55  m_mean = histo->GetMean();
56  m_rms = histo->GetRMS();
57 }
double m_rms
Definition: Histo1D.h:104
double m_delta
Definition: Histo1D.h:97
double m_maxX
Definition: Histo1D.h:94
double m_underflow
Definition: Histo1D.h:100
double m_maxY
Definition: Histo1D.h:96
double m_minY
Definition: Histo1D.h:95
double m_overflow
Definition: Histo1D.h:99
double m_mean
Definition: Histo1D.h:103
double m_zero
Definition: Histo1D.h:85
unsigned long m_nbins
Definition: Histo1D.h:88
void setTitle(std::string title)
Definition: Object.h:54
std::vector< double > m_centers
Definition: Histo1D.h:90
double m_infini
Definition: Histo1D.h:86
double m_minX
Definition: Histo1D.h:93
std::vector< double > m_bins
Definition: Histo1D.h:89
std::vector< double > m_edges
Definition: Histo1D.h:91
double m_content
Definition: Histo1D.h:102

◆ ~Histo1D()

Histo1D::~Histo1D ( )
inline

Definition at line 32 of file Histo1D.h.

References def(), fill(), maxY(), and minY().

32 { }

Member Function Documentation

◆ bin()

double Histo1D::bin ( double  x)

Definition at line 59 of file Histo1D.cpp.

References m_bins, m_delta, m_maxX, m_minX, m_nbins, m_overflow, and m_underflow.

Referenced by nBin().

59  {
60  if (x>=m_maxX) {return m_overflow;}
61  else if(x<m_minX) {return m_underflow;}
62  unsigned long bin=(unsigned long)(floor(m_nbins*(x-m_minX)/m_delta));
63  return m_bins[bin];
64 }
double m_delta
Definition: Histo1D.h:97
double m_maxX
Definition: Histo1D.h:94
double m_underflow
Definition: Histo1D.h:100
double m_overflow
Definition: Histo1D.h:99
unsigned long m_nbins
Definition: Histo1D.h:88
double m_minX
Definition: Histo1D.h:93
std::vector< double > m_bins
Definition: Histo1D.h:89
double bin(double x)
Definition: Histo1D.cpp:59

◆ binContent()

double Histo1D::binContent ( int  i)
inline

Definition at line 71 of file Histo1D.h.

References m_bins.

71  {
72  return m_bins[i];
73  }
std::vector< double > m_bins
Definition: Histo1D.h:89

◆ binEdgeMax()

double Histo1D::binEdgeMax ( unsigned int  bin)

Definition at line 78 of file Histo1D.cpp.

References m_delta, and m_minX.

Referenced by nBin().

78  {
79  return m_minX+(bin+1)*(m_delta);
80 }
double m_delta
Definition: Histo1D.h:97
double m_minX
Definition: Histo1D.h:93
double bin(double x)
Definition: Histo1D.cpp:59

◆ binEdgeMin()

double Histo1D::binEdgeMin ( unsigned int  bin)

Definition at line 74 of file Histo1D.cpp.

References m_delta, and m_minX.

Referenced by nBin().

74  {
75  return m_minX+bin*(m_delta);
76 }
double m_delta
Definition: Histo1D.h:97
double m_minX
Definition: Histo1D.h:93
double bin(double x)
Definition: Histo1D.cpp:59

◆ bins()

std::vector<double> Histo1D::bins ( )
inline

Definition at line 49 of file Histo1D.h.

References m_bins.

Referenced by export_proc().

49  {
50  return m_bins;
51  }
std::vector< double > m_bins
Definition: Histo1D.h:89

◆ centers()

std::vector<double> Histo1D::centers ( )
inline

Definition at line 53 of file Histo1D.h.

References m_centers.

Referenced by export_proc().

53  {
54  return m_centers;
55  }
std::vector< double > m_centers
Definition: Histo1D.h:90

◆ def()

void Histo1D::def ( )

Referenced by ~Histo1D().

◆ edges()

std::vector<double> Histo1D::edges ( )
inline

Definition at line 57 of file Histo1D.h.

References m_edges.

Referenced by export_proc().

57  {
58  return m_edges;
59  }
std::vector< double > m_edges
Definition: Histo1D.h:91

◆ fill()

void Histo1D::fill ( double  x,
double  value = 1. 
)

Referenced by ~Histo1D().

◆ maxX()

double Histo1D::maxX ( )
inline

Definition at line 42 of file Histo1D.h.

References m_maxX.

Referenced by export_proc().

42  {
43  return m_maxX;
44  }
double m_maxX
Definition: Histo1D.h:94

◆ maxY()

double Histo1D::maxY ( )

Definition at line 70 of file Histo1D.cpp.

References m_maxY.

Referenced by export_proc(), and ~Histo1D().

70  {
71  return m_maxY;
72 }
double m_maxY
Definition: Histo1D.h:96

◆ minX()

double Histo1D::minX ( )
inline

Definition at line 45 of file Histo1D.h.

References m_minX.

Referenced by export_proc().

45  {
46  return m_minX;
47  }
double m_minX
Definition: Histo1D.h:93

◆ minY()

double Histo1D::minY ( )

Definition at line 66 of file Histo1D.cpp.

References m_minY.

Referenced by export_proc(), and ~Histo1D().

66  {
67  return m_minY;
68 }
double m_minY
Definition: Histo1D.h:95

◆ nBin()

unsigned long Histo1D::nBin ( )
inline

Definition at line 61 of file Histo1D.h.

References bin(), binEdgeMax(), binEdgeMin(), and m_nbins.

Referenced by export_proc().

61  {
62  return m_nbins;
63  }
unsigned long m_nbins
Definition: Histo1D.h:88

◆ overflow()

double Histo1D::overflow ( )
inline

Definition at line 75 of file Histo1D.h.

References m_overflow.

Referenced by export_proc().

75  {
76  return m_overflow;
77  }
double m_overflow
Definition: Histo1D.h:99

◆ statistics()

void Histo1D::statistics ( double &  content,
double &  mean,
double &  rms 
)

Definition at line 82 of file Histo1D.cpp.

References m_content, m_mean, and m_rms.

Referenced by underflow().

84  {
85  content=m_content;
86  mean =m_mean;
87  rms =m_rms;
88 }
double m_rms
Definition: Histo1D.h:104
double m_mean
Definition: Histo1D.h:103
double m_content
Definition: Histo1D.h:102

◆ underflow()

double Histo1D::underflow ( )
inline

Definition at line 78 of file Histo1D.h.

References m_underflow, and statistics().

Referenced by export_proc().

78  {
79  return m_underflow;
80  }
double m_underflow
Definition: Histo1D.h:100

Member Data Documentation

◆ m_bins

std::vector<double> Histo1D::m_bins
private

Definition at line 89 of file Histo1D.h.

Referenced by bin(), binContent(), bins(), and Histo1D().

◆ m_centers

std::vector<double> Histo1D::m_centers
private

Definition at line 90 of file Histo1D.h.

Referenced by centers(), and Histo1D().

◆ m_content

double Histo1D::m_content
private

Definition at line 102 of file Histo1D.h.

Referenced by Histo1D(), and statistics().

◆ m_delta

double Histo1D::m_delta
private

Definition at line 97 of file Histo1D.h.

Referenced by bin(), binEdgeMax(), binEdgeMin(), and Histo1D().

◆ m_edges

std::vector<double> Histo1D::m_edges
private

Definition at line 91 of file Histo1D.h.

Referenced by edges(), and Histo1D().

◆ m_infini

double Histo1D::m_infini
private

Definition at line 86 of file Histo1D.h.

◆ m_maxX

double Histo1D::m_maxX
private

Definition at line 94 of file Histo1D.h.

Referenced by bin(), Histo1D(), and maxX().

◆ m_maxY

double Histo1D::m_maxY
private

Definition at line 96 of file Histo1D.h.

Referenced by Histo1D(), and maxY().

◆ m_mean

double Histo1D::m_mean
private

Definition at line 103 of file Histo1D.h.

Referenced by Histo1D(), and statistics().

◆ m_minX

double Histo1D::m_minX
private

Definition at line 93 of file Histo1D.h.

Referenced by bin(), binEdgeMax(), binEdgeMin(), Histo1D(), and minX().

◆ m_minY

double Histo1D::m_minY
private

Definition at line 95 of file Histo1D.h.

Referenced by Histo1D(), and minY().

◆ m_nbins

unsigned long Histo1D::m_nbins
private

Definition at line 88 of file Histo1D.h.

Referenced by bin(), Histo1D(), and nBin().

◆ m_overflow

double Histo1D::m_overflow
private

Definition at line 99 of file Histo1D.h.

Referenced by bin(), Histo1D(), and overflow().

◆ m_rms

double Histo1D::m_rms
private

Definition at line 104 of file Histo1D.h.

Referenced by Histo1D(), and statistics().

◆ m_underflow

double Histo1D::m_underflow
private

Definition at line 100 of file Histo1D.h.

Referenced by bin(), Histo1D(), and underflow().

◆ m_zero

double Histo1D::m_zero
private

Definition at line 85 of file Histo1D.h.


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