g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::sg::h1d2plot Class Reference
Inheritance diagram for tools::sg::h1d2plot:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::h1d2plot:
Collaboration graph
[legend]

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual plottablecopy () const
 
virtual bool is_valid () const
 
virtual const std::string & name () const
 
virtual void set_name (const std::string &a_s)
 
virtual const std::string & title () const
 
virtual const std::string & legend () const
 
virtual void set_legend (const std::string &a_s)
 
virtual void infos (const std::string &a_opts, std::string &a_sinfos) const
 
virtual void bins_Sw_range (float &a_mn, float &a_mx, bool a_with_entries) const
 
virtual unsigned int bins () const
 
virtual float axis_min () const
 
virtual float axis_max () const
 
virtual float bin_lower_edge (int aI) const
 
virtual float bin_upper_edge (int aI) const
 
virtual bool has_entries_per_bin () const
 
virtual unsigned int bin_entries (int aI) const
 
virtual float bin_Sw (int aI) const
 
virtual float bin_error (int aI) const
 
virtual bool is_profile () const
 
 h1d2plot (const histo::h1d &a_data)
 
virtual ~h1d2plot ()
 
 h1d2plot (const h1d2plot &a_from)
 
h1d2plotoperator= (const h1d2plot &a_from)
 
const histo::h1ddata () const
 
- Public Member Functions inherited from tools::sg::bins1D
virtual ~bins1D ()
 
- Public Member Functions inherited from tools::sg::plottable
virtual ~plottable ()
 

Protected Attributes

const histo::h1dm_data
 
std::string m_name
 
std::string m_legend
 

Detailed Description

Definition at line 27 of file h2plot.

Constructor & Destructor Documentation

◆ h1d2plot() [1/2]

tools::sg::h1d2plot::h1d2plot ( const histo::h1d a_data)
inline

Definition at line 167 of file h2plot.

167  :m_data(a_data) {
168 #ifdef TOOLS_MEM
169  mem::increment(s_class().c_str());
170 #endif
171  }

◆ ~h1d2plot()

virtual tools::sg::h1d2plot::~h1d2plot ( )
inlinevirtual

Definition at line 172 of file h2plot.

172  {
173 #ifdef TOOLS_MEM
174  mem::decrement(s_class().c_str());
175 #endif
176  }

◆ h1d2plot() [2/2]

tools::sg::h1d2plot::h1d2plot ( const h1d2plot a_from)
inline

Definition at line 178 of file h2plot.

179  :plottable(a_from),bins1D(a_from)
180  ,m_data(a_from.m_data)
181  ,m_name(a_from.m_name)
182  ,m_legend(a_from.m_legend)
183  {
184 #ifdef TOOLS_MEM
185  mem::increment(s_class().c_str());
186 #endif
187  }

Member Function Documentation

◆ axis_max()

virtual float tools::sg::h1d2plot::axis_max ( ) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 155 of file h2plot.

155 {return (float)m_data.axis().upper_edge();}

◆ axis_min()

virtual float tools::sg::h1d2plot::axis_min ( ) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 154 of file h2plot.

154 {return (float)m_data.axis().lower_edge();}

◆ bin_entries()

virtual unsigned int tools::sg::h1d2plot::bin_entries ( int  aI) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 160 of file h2plot.

160 {return m_data.bin_entries(aI);}

◆ bin_error()

virtual float tools::sg::h1d2plot::bin_error ( int  aI) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 164 of file h2plot.

164 {return (float)m_data.bin_error(aI);}

◆ bin_lower_edge()

virtual float tools::sg::h1d2plot::bin_lower_edge ( int  aI) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 156 of file h2plot.

156 {return (float)m_data.axis().bin_lower_edge(aI);}

◆ bin_Sw()

virtual float tools::sg::h1d2plot::bin_Sw ( int  aI) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 162 of file h2plot.

162 {return (float)m_data.bin_height(aI);}

◆ bin_upper_edge()

virtual float tools::sg::h1d2plot::bin_upper_edge ( int  aI) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 157 of file h2plot.

157 {return (float)m_data.axis().bin_upper_edge(aI);}

◆ bins()

virtual unsigned int tools::sg::h1d2plot::bins ( ) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 153 of file h2plot.

153 {return m_data.axis().bins();}

◆ bins_Sw_range()

virtual void tools::sg::h1d2plot::bins_Sw_range ( float &  a_mn,
float &  a_mx,
bool  a_with_entries 
) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 141 of file h2plot.

141  {
142  if(a_with_entries && m_data.has_entries_per_bin()) {
143  double mn,mx;
146  a_mn = float(mn);
147  a_mx = float(mx);
148  } else {
149  a_mn = (float)m_data.min_bin_height();
150  a_mx = (float)m_data.max_bin_height();
151  }
152  }

◆ cast()

virtual void* tools::sg::h1d2plot::cast ( const std::string &  a_class) const
inlinevirtual

Reimplemented from tools::sg::bins1D.

Reimplemented in tools::sg::h1d2plot_cp.

Definition at line 31 of file h2plot.

31  {
32  if(void* p = cmp_cast<h1d2plot>(this,a_class)) {return p;}
33  return bins1D::cast(a_class);
34  }

◆ copy()

virtual plottable* tools::sg::h1d2plot::copy ( ) const
inlinevirtual

Implements tools::sg::plottable.

Reimplemented in tools::sg::h1d2plot_cp.

Definition at line 36 of file h2plot.

36 {return new h1d2plot(*this);}

◆ data()

const histo::h1d& tools::sg::h1d2plot::data ( ) const
inline

Definition at line 194 of file h2plot.

194 {return m_data;}

◆ has_entries_per_bin()

virtual bool tools::sg::h1d2plot::has_entries_per_bin ( ) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 159 of file h2plot.

159 {return m_data.has_entries_per_bin();}

◆ infos()

virtual void tools::sg::h1d2plot::infos ( const std::string &  a_opts,
std::string &  a_sinfos 
) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 45 of file h2plot.

45  {
46  a_sinfos.clear();
47  std::string f_lf("\n");
48  std::vector<std::string> ws;
49  words(a_opts," ",false,ws);
50  std::vector<std::string>::const_iterator it;
51 
52  /*bool show_fit_ndf = false;
53  {for(it=ws.begin();it!=ws.end();++it) {
54  if((*it)=="fit_ndf") {show_fit_ndf = true;break;}
55  }}*/
56 
57  for(it=ws.begin();it!=ws.end();++it) {
58  if(((*it)=="name") && m_name.size()) {
59  if(a_sinfos.size()) a_sinfos += f_lf;
60  a_sinfos += "Name";
61  a_sinfos += f_lf;
62  a_sinfos += m_name;
63 
64  } else if((*it)=="entries") {
65  if(a_sinfos.size()) a_sinfos += f_lf;
66  a_sinfos += "Entries";
67  a_sinfos += f_lf;
68  if(!numas<unsigned int>(m_data.all_entries(),a_sinfos)){}
69 
70  } else if((*it)=="mean") {
71  if(a_sinfos.size()) a_sinfos += f_lf;
72  a_sinfos += "Mean";
73  a_sinfos += f_lf;
74  if(!numas<double>(m_data.mean(),a_sinfos)) {}
75 
76  } else if((*it)=="rms") {
77  if(a_sinfos.size()) a_sinfos += f_lf;
78  a_sinfos += "RMS";
79  a_sinfos += f_lf;
80  if(!numas<double>(m_data.rms(),a_sinfos)) {}
81 
82  } else if((*it)=="underflow") {
83  if(a_sinfos.size()) a_sinfos += f_lf;
84  a_sinfos += "UDFLW";
85  a_sinfos += f_lf;
86  if(!numas<double>(m_data.bin_height(histo::axis_UNDERFLOW_BIN),a_sinfos)){}
87 
88  } else if((*it)=="overflow") {
89  if(a_sinfos.size()) a_sinfos += f_lf;
90  a_sinfos += "OVFLW";
91  a_sinfos += f_lf;
92  if(!numas<double>(m_data.bin_height(histo::axis_OVERFLOW_BIN),a_sinfos)){}
93 
94 /*
95  } else if((*it)=="fit_quality") {
96  //look in m_data annotations for "fit.chi2" and "fit.ndf" keys :
97  if(show_fit_ndf) {
98  std::string schi2;
99  std::string sndf;
100  if(m_data.annotation("fit.chi2",schi2) &&
101  m_data.annotation("fit.ndf",sndf) ){
102  if(a_sinfos.size()) a_sinfos += f_lf;
103  a_sinfos += "[h]^2! / ndf";
104  a_sinfos += f_lf;
105  a_sinfos += schi2;
106  a_sinfos += " / ";
107  a_sinfos += sndf;
108  }
109  } else { //show chi2 only.
110  std::string schi2;
111  if(m_data.annotation("fit.chi2",schi2)){
112  if(a_sinfos.size()) a_sinfos += f_lf;
113  a_sinfos += "[h]^2!";
114  a_sinfos += f_lf;
115  a_sinfos += schi2;
116  }
117  }
118 
119  } else if((*it)=="fit_parameters") {
120  //look in m_data annotations for "fit.param.<name>" keys :
121  typedef std::map<std::string,std::string> annots_t;
122  const annots_t& annots = m_data.annotations();
123  annots_t::const_iterator it;
124  for(it=annots.begin();it!=annots.end();++it) {
125  const std::string& key = (*it).first;
126  if(key.substr(0,10)=="fit.param.") {
127  //fit.param.mean 14
128  //01234567890123
129  std::string name = key.substr(10,key.size()-10);
130  if(a_sinfos.size()) a_sinfos += f_lf;
131  a_sinfos += name;
132  a_sinfos += f_lf;
133  a_sinfos += (*it).second;
134  }
135  }
136 */
137  }
138  }
139  }

◆ is_profile()

virtual bool tools::sg::h1d2plot::is_profile ( ) const
inlinevirtual

Implements tools::sg::bins1D.

Definition at line 165 of file h2plot.

165 {return false;}

◆ is_valid()

virtual bool tools::sg::h1d2plot::is_valid ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 37 of file h2plot.

37 {return true;}

◆ legend()

virtual const std::string& tools::sg::h1d2plot::legend ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 42 of file h2plot.

42 {return m_legend;}

◆ name()

virtual const std::string& tools::sg::h1d2plot::name ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 38 of file h2plot.

38 {return m_name;}

◆ operator=()

h1d2plot& tools::sg::h1d2plot::operator= ( const h1d2plot a_from)
inline

Definition at line 188 of file h2plot.

188  {
189  m_name = a_from.m_name;
190  m_legend = a_from.m_legend;
191  return *this;
192  }

◆ set_legend()

virtual void tools::sg::h1d2plot::set_legend ( const std::string &  a_s)
inlinevirtual

Implements tools::sg::plottable.

Definition at line 43 of file h2plot.

43 {m_legend = a_s;}

◆ set_name()

virtual void tools::sg::h1d2plot::set_name ( const std::string &  a_s)
inlinevirtual

Implements tools::sg::plottable.

Definition at line 39 of file h2plot.

39 {m_name = a_s;}

◆ title()

virtual const std::string& tools::sg::h1d2plot::title ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 41 of file h2plot.

41 {return m_data.title();}

Member Data Documentation

◆ m_data

const histo::h1d& tools::sg::h1d2plot::m_data
protected

Definition at line 196 of file h2plot.

◆ m_legend

std::string tools::sg::h1d2plot::m_legend
protected

Definition at line 198 of file h2plot.

◆ m_name

std::string tools::sg::h1d2plot::m_name
protected

Definition at line 197 of file h2plot.


The documentation for this class was generated from the following file:
tools::sg::h1d2plot::m_data
const histo::h1d & m_data
Definition: h2plot:196
tools::sg::bins1D::cast
virtual void * cast(const std::string &a_class) const
Definition: plottables:17
tools::histo::axis_UNDERFLOW_BIN
@ axis_UNDERFLOW_BIN
Definition: axis:13
tools::sg::h1d2plot::h1d2plot
h1d2plot(const histo::h1d &a_data)
Definition: h2plot:167
tools::mn
T mn(const T &a, const T &b)
Definition: mnmx:10
tools::mx
T mx(const T &a, const T &b)
Definition: mnmx:13
tools::histo::base_histo::min_bin_height_with_entries
bool min_bin_height_with_entries(TH &a_value) const
Definition: base_histo:175
tools::histo::axis::upper_edge
TC upper_edge() const
Definition: axis:27
tools::histo::axis_OVERFLOW_BIN
@ axis_OVERFLOW_BIN
Definition: axis:13
tools::histo::axis::bin_lower_edge
TC bin_lower_edge(int a_bin) const
Definition: axis:47
tools::histo::b1::axis
const axis_t & axis() const
Definition: b1:103
tools::histo::axis::bins
bn_t bins() const
Definition: axis:28
tools::histo::h1::bin_error
virtual TH bin_error(int aI) const
Definition: h1:30
tools::histo::b1::rms
TC rms() const
Definition: b1:37
tools::histo::axis::bin_upper_edge
TC bin_upper_edge(int a_bin) const
Definition: axis:63
tools::histo::base_histo::all_entries
TN all_entries() const
Definition: base_histo:95
tools::histo::b1::bin_height
TH bin_height(int aI) const
Definition: b1:75
tools::sg::h1d2plot::m_legend
std::string m_legend
Definition: h2plot:198
tools::histo::base_histo::title
const std::string & title() const
Definition: base_histo:87
tools::words
void words(const std::string &a_string, const std::string &a_sep, bool a_take_empty, std::vector< std::string > &a_words, bool a_clear=true)
Definition: words:12
tools::histo::base_histo::min_bin_height
TH min_bin_height() const
Definition: base_histo:141
tools::histo::base_histo::has_entries_per_bin
bool has_entries_per_bin() const
Definition: base_histo:211
tools::histo::base_histo::max_bin_height
TH max_bin_height() const
Definition: base_histo:158
tools::sg::h1d2plot::m_name
std::string m_name
Definition: h2plot:197
tools::histo::b1::mean
TC mean() const
Definition: b1:30
tools::histo::axis::lower_edge
TC lower_edge() const
Definition: axis:26
tools::histo::base_histo::max_bin_height_with_entries
bool max_bin_height_with_entries(TH &a_value) const
Definition: base_histo:193
tools::histo::b1::bin_entries
TN bin_entries(int aI) const
Definition: b1:47