g4tools  5.4.0
base_histo
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_histo_base_histo
5 #define tools_histo_base_histo
6 
7 #ifdef TOOLS_MEM
8 #include "../mem"
9 #endif
10 
11 #include "histo_data"
12 
13 #include <cmath>
14 #include <map> //for annotations
15 #include <ostream>
16 
17 namespace tools {
18 namespace histo {
19 
20 //TC is for a coordinate.
21 //TO is for an offset used to identify a bin.
22 //TN is for a number of entries.
23 //TW is for a weight.
24 //TH is for a height.
25 
26 template <class TC,class TO,class TN,class TW,class TH>
27 class base_histo : protected histo_data<TC,TO,TN,TW> {
29 private:
30  static const std::string& s_class() {
31  static const std::string s_v("tools::histo::base_histo");
32  return s_v;
33  }
34 public:
37  typedef typename axis_t::bn_t bn_t;
38  typedef unsigned int dim_t;
39  typedef TC coordinate_t;
40  typedef TO offset_t;
41  typedef TN num_entries_t;
42  typedef TW weight_t;
43  typedef TH height_t;
44 protected:
45  virtual TH get_bin_height(TO) const = 0; //histo/profile
46 protected:
47  void base_from_data(const hd_t& a_from) {parent::operator=(a_from);}
48 #ifdef tools_histo_base_histo //for backward compatibility with tools
49  hd_t base_get_data() const {
50  hd_t hd;
51  hd = *this;
52  return hd;
53  }
54 #endif
55 public:
56  const hd_t& dac() const {return *this;} //data accessor.
57 protected:
59 #ifdef TOOLS_MEM
60  mem::increment(s_class().c_str());
61 #endif
62  }
63 protected:
64  virtual ~base_histo() {
65 #ifdef TOOLS_MEM
66  mem::decrement(s_class().c_str());
67 #endif
68  }
69 protected:
70  base_histo(const base_histo& a_from):parent(a_from) {
71 #ifdef TOOLS_MEM
72  mem::increment(s_class().c_str());
73 #endif
74  }
75 
76  base_histo& operator=(const base_histo& a_from) {
77  if(&a_from==this) return *this;
78  parent::operator=(a_from);
79  return *this;
80  }
81 
82 public:
83  bool equals(const base_histo& a_from,const TW& a_prec,TW(*a_fabs)(TW)) const {
84  return parent::equals(a_from,a_prec,a_fabs);
85  }
86 
87  const std::string& title() const {return parent::m_title;}
88  bool set_title(const std::string& a_title){parent::m_title = a_title;return true;}
91 
92  TN entries() const {
93  return parent::m_in_range_entries; //not set if reading a TH from a CERN-ROOT file.
94  }
95  TN all_entries() const {
96  return parent::m_all_entries; //works also is reading histo from a CERN-ROOT file.
97  }
98 
99  TN extra_entries() const {
100  return parent::m_all_entries-parent::m_in_range_entries; //works also is reading histo from a CERN-ROOT file.
101  }
103  TW sw = 0;
104  TW sw2 = 0;
105  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
106  if(!histo::is_out(parent::m_axes,ibin)) {
107  sw += parent::m_bin_Sw[ibin];
108  sw2 += parent::m_bin_Sw2[ibin];
109  }
110  }
111  if(sw2==0) return 0;
112  return (sw * sw)/sw2;
113  }
114  TH sum_bin_heights() const {
115  TH sh = 0;
116  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
117  if(!histo::is_out(parent::m_axes,ibin)) {
118  sh += get_bin_height(ibin);
119  }
120  }
121  return sh;
122  }
123  TH sum_all_bin_heights() const {
124  TH sh = 0;
125  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
126  sh += get_bin_height(ibin);
127  }
128  return sh;
129  }
130 
132  TH sh = 0;
133  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
134  if(histo::is_out(parent::m_axes,ibin)) {
135  sh += get_bin_height(ibin);
136  }
137  }
138  return sh;
139  }
140 
141  TH min_bin_height() const {
142  TH value = 0;
143  bool first = true;
144  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
145  if(!histo::is_out(parent::m_axes,ibin)) {
146  TH vbin = get_bin_height(ibin);
147  if(first) {
148  first = false;
149  value = vbin;
150  } else {
151  if(vbin<=value) value = vbin;
152  }
153  }
154  }
155  return value;
156  }
157 
158  TH max_bin_height() const {
159  TH value = 0;
160  bool first = true;
161  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
162  if(!histo::is_out(parent::m_axes,ibin)) {
163  TH vbin = get_bin_height(ibin);
164  if(first) {
165  first = false;
166  value = vbin;
167  } else {
168  if(vbin>=value) value = vbin;
169  }
170  }
171  }
172  return value;
173  }
174 
175  bool min_bin_height_with_entries(TH& a_value) const {
176  TH value = 0;
177  bool first = true;
178  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
179  if(!histo::is_out(parent::m_axes,ibin) && (parent::m_bin_entries[ibin]>0) ) {
180  TH vbin = get_bin_height(ibin);
181  if(first) {
182  first = false;
183  value = vbin;
184  } else {
185  if(vbin<=value) value = vbin;
186  }
187  }
188  }
189  a_value = value;
190  return first?false:true; //return true if at least one bin with entries processed.
191  }
192 
193  bool max_bin_height_with_entries(TH& a_value) const {
194  TH value = 0;
195  bool first = true;
196  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
197  if(!histo::is_out(parent::m_axes,ibin) && (parent::m_bin_entries[ibin]>0) ) {
198  TH vbin = get_bin_height(ibin);
199  if(first) {
200  first = false;
201  value = vbin;
202  } else {
203  if(vbin>=value) value = vbin;
204  }
205  }
206  }
207  a_value = value;
208  return first?false:true; //return true if at least one bin with entries processed.
209  }
210 
211  bool has_entries_per_bin() const { //to detect histos coming from TH streaming out of a root file.
212  // it assumes that update_fast_getters() had been applied.
213  if(parent::m_in_range_entries) return true;
214  // may be a from-root histo :
215  if(parent::m_in_range_Sw) return false;
216  // no in range entries and weight :
217  return true; //for exa not filled = ok.
218  }
219 
220 public: //histo_data
221  bool get_ith_axis_Sxw(dim_t a_axis,TC& a_value) const {
222  a_value = 0;
223  if(a_axis>=parent::m_dimension) return false;
224  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
225  if(!histo::is_out(parent::m_axes,ibin)) {
226  a_value += parent::m_bin_Sxw[ibin][a_axis];
227  }
228  }
229  return true;
230  }
231 
232  bool get_ith_axis_Sx2w(dim_t a_axis,TC& a_value) const {
233  a_value = 0;
234  if(a_axis>=parent::m_dimension) return false;
235  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
236  if(!histo::is_out(parent::m_axes,ibin)) {
237  a_value += parent::m_bin_Sx2w[ibin][a_axis];
238  }
239  }
240  return true;
241  }
242 
243  TW get_in_range_Sw() const {return parent::m_in_range_Sw;} //for CERN-ROOT file writing.
244  TW get_in_range_Sw2() const {return parent::m_in_range_Sw2;} //for CERN-ROOT file writing.
245 
246  void get_Sw_Sw2(TW& a_sw,TW& a_sw2) const {
247  a_sw = 0;
248  a_sw2 = 0;
249  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
250  if(!histo::is_out(parent::m_axes,ibin)) {
251  a_sw += parent::m_bin_Sw[ibin];
252  a_sw2 += parent::m_bin_Sw2[ibin];
253  }
254  }
255  }
256  void get_all_Sw_Sw2(TW& a_sw,TW& a_sw2) const {
257  a_sw = 0;
258  a_sw2 = 0;
259  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
260  a_sw += parent::m_bin_Sw[ibin];
261  a_sw2 += parent::m_bin_Sw2[ibin];
262  }
263  }
264 
265 /*
266  TW get_all_Sw() const {
267  TW sw = 0;
268  for(TO ibin=0;ibin<m_bin_number;ibin++) sw += m_bin_Sw[ibin];
269  return sw;
270  }
271  TN get_all_entries() const {
272  TN number = 0;
273  for(TO ibin=0;ibin<m_bin_number;ibin++) {
274  number += m_bin_entries[ibin];
275  }
276  return number;
277  }
278 
279  // for inlib/wroot/streamers :
280  TN get_entries() const {
281  TN number = 0;
282  for(TO ibin=0;ibin<m_bin_number;ibin++) {
283  if(!histo::is_out(m_axes,ibin)) {
284  number += m_bin_entries[ibin];
285  }
286  }
287  return number;
288  }
289 */
290 protected:
291  enum {AxisX=0,AxisY=1,AxisZ=2};
292 
293  bool configure(dim_t a_dim,
294  const std::vector<bn_t>& aNumbers,
295  const std::vector<TC>& aMins,
296  const std::vector<TC>& aMaxs) {
297  // Clear :
298  parent::m_bin_entries.clear();
299  parent::m_bin_Sw.clear();
300  parent::m_bin_Sw2.clear();
301  parent::m_bin_Sxw.clear();
302  parent::m_bin_Sx2w.clear();
303  parent::m_in_range_Sxw.clear();
304  parent::m_in_range_Sx2w.clear();
305  parent::m_axes.clear();
307  parent::m_annotations.clear();
308 
315  parent::m_in_range_Sxw.resize(a_dim,0);
316  parent::m_in_range_Sx2w.resize(a_dim,0);
317 
318  // Some checks :
319  if(!a_dim) return false;
320  parent::m_axes.resize(a_dim);
321  // Setup axes :
322  for(dim_t iaxis=0;iaxis<a_dim;iaxis++) {
323  if(!parent::m_axes[iaxis].configure(aNumbers[iaxis],aMins[iaxis],aMaxs[iaxis])) {
324  // do not do :
325  // m_axes.clear()
326  // so that :
327  // b1::axis(),b2::axis_[x,y]()
328  // do not crash in case of a bad booking.
329  //m_axes.clear();
330  return false;
331  }
332  }
333 
334  parent::m_dimension = a_dim;
335 
336  base_allocate(); //set m_bin_number.
337 
338  return true;
339  }
340 
341  bool configure(dim_t a_dim,const std::vector< std::vector<TC> >& a_edges) {
342  // Clear :
343  parent::m_bin_entries.clear();
344  parent::m_bin_Sw.clear();
345  parent::m_bin_Sw2.clear();
346  parent::m_bin_Sxw.clear();
347  parent::m_bin_Sx2w.clear();
348  parent::m_in_range_Sxw.clear();
349  parent::m_in_range_Sx2w.clear();
350  parent::m_axes.clear();
352  parent::m_annotations.clear();
353 
360  parent::m_in_range_Sxw.resize(a_dim,0);
361  parent::m_in_range_Sx2w.resize(a_dim,0);
362 
363  // Some checks :
364  if(!a_dim) return false;
365  parent::m_axes.resize(a_dim);
366  // Setup axes :
367  for(dim_t iaxis=0;iaxis<a_dim;iaxis++) {
368  if(!parent::m_axes[iaxis].configure(a_edges[iaxis])) {
369  //m_axes.clear();
370  return false;
371  }
372  }
373 
374  parent::m_dimension = a_dim;
375 
376  base_allocate(); //set m_bin_number.
377 
378  return true;
379  }
380 
381  void base_reset() {
382  // Reset content (different of clear that deallocate all internal things).
383  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
384  parent::m_bin_entries[ibin] = 0;
385  parent::m_bin_Sw[ibin] = 0;
386  parent::m_bin_Sw2[ibin] = 0;
387  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
388  parent::m_bin_Sxw[ibin][iaxis] = 0;
389  parent::m_bin_Sx2w[ibin][iaxis] = 0;
390  }
391  }
393  //profile not done here.
395  }
396 
397 protected:
398  void base_allocate() {
399  dim_t iaxis;
400  // Add two bins for the [under,out]flow data.
401  TO n_bin = 1;
402  for(iaxis=0;iaxis<parent::m_dimension;iaxis++) {
403  n_bin *= (parent::m_axes[iaxis].bins() + 2);
404  }
405 
406  parent::m_bin_entries.resize(n_bin,0);
407  parent::m_bin_Sw.resize(n_bin,0);
408  parent::m_bin_Sw2.resize(n_bin,0);
409 
410  std::vector<TC> empty;
411  empty.resize(parent::m_dimension,0);
412  parent::m_bin_Sxw.resize(n_bin,empty);
413  parent::m_bin_Sx2w.resize(n_bin,empty);
414 
415  parent::m_bin_number = n_bin; // All bins : [in-range, underflow, outflow] bins.
416 
417  parent::m_axes[0].m_offset = 1;
418  for(iaxis=1;iaxis<parent::m_dimension;iaxis++) {
419  parent::m_axes[iaxis].m_offset = parent::m_axes[iaxis-1].m_offset * (parent::m_axes[iaxis-1].bins()+2);
420  }
421 
423  }
424 
425 public:
426  // to access data from methods :
427  const std::vector<TN>& bins_entries() const {return parent::m_bin_entries;}
428  const std::vector<TW>& bins_sum_w() const {return parent::m_bin_Sw;}
429  const std::vector<TW>& bins_sum_w2() const {return parent::m_bin_Sw2;}
430  const std::vector< std::vector<TC> >& bins_sum_xw() const {return parent::m_bin_Sxw;}
431  const std::vector< std::vector<TC> >& bins_sum_x2w() const {return parent::m_bin_Sx2w;}
432  const std::vector<TC>& in_range_planes_xyw() const {return parent::m_in_range_plane_Sxyw;}
433 
434 public:
435  const axis_t& get_axis(int a_index) const {return parent::m_axes[a_index];}
437  const std::string& get_title() const {return parent::m_title;}
439  bool is_valid() const {return (parent::m_dimension?true:false);}
440 
441 public: //annotations :
442  typedef std::map<std::string,std::string> annotations_t;
445 
446  void add_annotation(const std::string& a_key,const std::string& a_value) {
447  parent::m_annotations[a_key] = a_value; //override if a_key already exists.
448  }
449  bool annotation(const std::string& a_key,std::string& a_value) const {
450  annotations_t::const_iterator it = parent::m_annotations.find(a_key);
451  if(it==parent::m_annotations.end()) {a_value.clear();return false;}
452  a_value = (*it).second;
453  return true;
454  }
455 
456  void set_annotations(const annotations_t& a_annotations) {parent::m_annotations = a_annotations;}
457 
458  void hprint_annotations(std::ostream& a_out) {
459  a_out << " * ANNOTATIONS :" << std::endl;
460  annotations_t::const_iterator it;
461  for(it=parent::m_annotations.begin();it!=parent::m_annotations.end();++it) {
462  //out << " * (" << index << ") "
463  a_out << " * " << (*it).first << " = " << (*it).second << std::endl;
464  }
465  }
466 
467 protected:
468  bool is_compatible(const base_histo& a_histo){
469  if(parent::m_dimension!=a_histo.m_dimension) return false;
470  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
471  if(!parent::m_axes[iaxis].is_compatible(a_histo.m_axes[iaxis])) return false;
472  }
473  return true;
474  }
475 
476  void base_add(const base_histo& a_histo){
477  // The only histogram operation that makes sense.
478  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
479  parent::m_bin_entries[ibin] += a_histo.m_bin_entries[ibin];
480  parent::m_bin_Sw[ibin] += a_histo.m_bin_Sw[ibin];
481  parent::m_bin_Sw2[ibin] += a_histo.m_bin_Sw2[ibin];
482  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
483  parent::m_bin_Sxw[ibin][iaxis] += a_histo.m_bin_Sxw[ibin][iaxis];
484  parent::m_bin_Sx2w[ibin][iaxis] += a_histo.m_bin_Sx2w[ibin][iaxis];
485  }
486  }
487  {size_t nplane = parent::m_in_range_plane_Sxyw.size();
488  for(size_t iplane=0;iplane<nplane;iplane++)
489  parent::m_in_range_plane_Sxyw[iplane] += a_histo.m_in_range_plane_Sxyw[iplane];}
491  }
492 
493  void base_subtract(const base_histo& a_histo) {
494  //ill-defined operation. We keep that because of the "ill-defined past".
495  // We build a new histo with one entry in each bin.
496  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
497  parent::m_bin_entries[ibin] = 1;
498 
499  parent::m_bin_Sw[ibin] -= a_histo.m_bin_Sw[ibin];
500  // Yes, it is a += in the below.
501  parent::m_bin_Sw2[ibin] += a_histo.m_bin_Sw2[ibin];
502  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
503  parent::m_bin_Sxw[ibin][iaxis] -= a_histo.m_bin_Sxw[ibin][iaxis];
504  parent::m_bin_Sx2w[ibin][iaxis] -= a_histo.m_bin_Sx2w[ibin][iaxis];
505  }
506  }
507 
508  //{for(dim_t iplane=0;iplane<nplane;iplane++) parent::m_in_range_plane_Sxyw[iplane] ??? a_histo.m_in_range_plane_Sxyw[iplane];}
509 
511  }
512 
513  bool base_multiply(const base_histo& a_histo) {
514  //ill-defined operation. We keep that because of the "ill-defined past".
515 
516  // We build a new histo with one entry in each bin of weight :
517  // this.w * a_histo.w
518  // The current histo is overriden with this new histo.
519  // The m_bin_Sw2 computation is consistent with FreeHEP and CERN-ROOT.
520 
521  if(!is_compatible(a_histo)) return false;
522 
523  std::vector<int> is(parent::m_dimension);
524  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
525  TW swa = parent::m_bin_Sw[ibin];
526  TW sw2a = parent::m_bin_Sw2[ibin];
527  TW swb = a_histo.m_bin_Sw[ibin];
528  TW sw2b = a_histo.m_bin_Sw2[ibin];
529  TW sw = swa * swb;
530  parent::m_bin_entries[ibin] = 1;
531  parent::m_bin_Sw[ibin] = sw;
532  parent::m_bin_Sw2[ibin] = sw2a * swb * swb + sw2b * swa * swa;
534  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
535  TC x = parent::m_axes[iaxis].bin_center(is[iaxis]);
536  parent::m_bin_Sxw[ibin][iaxis] = x * sw;
537  parent::m_bin_Sx2w[ibin][iaxis] = x * x * sw;
538  }
539  }
540 
541  //{for(dim_t iplane=0;iplane<nplane;iplane++) parent::m_in_range_plane_Sxyw[iplane] ??? a_histo.m_in_range_plane_Sxyw[iplane];}
542 
544  return true;
545  }
546 
547  bool base_divide(const base_histo& a_histo) {
548  //ill-defined operation. We keep that because of the "ill-defined past".
549 
550  // We build a new histo with one entry in each bin of weight :
551  // this.w / a_histo.w
552  // The current histo is overriden with this new histo.
553  // The m_bin_Sw2 computation is consistent with FreeHEP and ROOT.
554 
555  if(!is_compatible(a_histo)) return false;
556 
557  std::vector<int> is(parent::m_dimension);
558  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
560  TW swa = parent::m_bin_Sw[ibin];
561  TW swb = a_histo.m_bin_Sw[ibin];
562  TW sw2a = parent::m_bin_Sw2[ibin];
563  TW sw2b = a_histo.m_bin_Sw2[ibin];
564  if(swb!=0) {
565  parent::m_bin_entries[ibin] = 1;
566  TW sw = swa / swb;
567  parent::m_bin_Sw[ibin] = sw;
568  TW swb2 = swb * swb;
569  parent::m_bin_Sw2[ibin] = sw2a / swb2 + sw2b * swa * swa /(swb2*swb2);
570  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
571  TC x = parent::m_axes[iaxis].bin_center(is[iaxis]);
572  parent::m_bin_Sxw[ibin][iaxis] = x * sw;
573  parent::m_bin_Sx2w[ibin][iaxis] = x * x * sw;
574  }
575  } else {
576  parent::m_bin_entries[ibin] = 0;
577  parent::m_bin_Sw[ibin] = 0;
578  parent::m_bin_Sw2[ibin] = 0;
579  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
580  parent::m_bin_Sxw[ibin][iaxis] = 0;
581  parent::m_bin_Sx2w[ibin][iaxis] = 0;
582  }
583  }
584  }
585 
586  //{for(dim_t iplane=0;iplane<nplane;iplane++) parent::m_in_range_plane_Sxyw[iplane] ??? a_histo.m_in_range_plane_Sxyw[iplane];}
587 
589  return true;
590  }
591 
592  bool base_multiply(TW a_factor) {
593  if(a_factor<0) return false;
594  TW factor2 = a_factor * a_factor;
595  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
596  parent::m_bin_Sw[ibin] *= a_factor;
597  parent::m_bin_Sw2[ibin] *= factor2;
598  for(dim_t iaxis=0;iaxis<parent::m_dimension;iaxis++) {
599  parent::m_bin_Sxw[ibin][iaxis] *= a_factor;
600  parent::m_bin_Sx2w[ibin][iaxis] *= a_factor;
601  }
602  }
603  {size_t nplane = parent::m_in_range_plane_Sxyw.size();
604  for(size_t iplane=0;iplane<nplane;iplane++) parent::m_in_range_plane_Sxyw[iplane] *= a_factor;}
606  return true;
607  }
608 
609  bool get_ith_axis_mean(dim_t a_axis,TC& a_value) const {
610  a_value = 0;
611  if(a_axis>=parent::m_dimension) return false;
612  TW sw = 0;
613  TC sxw = 0;
614  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
615  if(!histo::is_out(parent::m_axes,ibin)) {
616  sw += parent::m_bin_Sw[ibin];
617  sxw += parent::m_bin_Sxw[ibin][a_axis];
618  }
619  }
620  if(sw==0) return false;
621  a_value = sxw/sw;
622  return true;
623  }
624 
625  bool get_ith_axis_rms(dim_t a_axis,TC& a_value) const {
626  a_value = 0;
627  if(a_axis>=parent::m_dimension) return false;
628  TW sw = 0;
629  TC sxw = 0;
630  TC sx2w = 0;
631  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
632  if(!histo::is_out(parent::m_axes,ibin)) {
633  sw += parent::m_bin_Sw[ibin];
634  sxw += parent::m_bin_Sxw[ibin][a_axis];
635  sx2w += parent::m_bin_Sx2w[ibin][a_axis];
636  }
637  }
638  if(sw==0) return false;
639  TC mean = sxw/sw;
640  a_value = ::sqrt(::fabs((sx2w / sw) - mean * mean));
641  return true;
642  }
643 
644  TN get_bin_entries(const std::vector<int>& aIs) const {
645  if(parent::m_bin_number==0) return 0;
646  TO offset;
647  if(!histo::get_offset(parent::m_axes,aIs,offset)) return 0;
648  return parent::m_bin_entries[offset];
649  }
650 };
651 
652 // predefined annotation keys :
653 inline const std::string& key_axis_x_title() {
654  static const std::string s_v("axis_x.title");
655  return s_v;
656 }
657 inline const std::string& key_axis_y_title() {
658  static const std::string s_v("axis_y.title");
659  return s_v;
660 }
661 inline const std::string& key_axis_z_title() {
662  static const std::string s_v("axis_z.title");
663  return s_v;
664 }
665 
666 }}
667 
668 #endif
tools::jpeg::is
bool is(const std::string &a_file)
Definition: jpeg:216
tools::histo::histo_data::m_in_range_Sw2
TW m_in_range_Sw2
Definition: histo_data:189
tools::histo::base_histo::AxisX
@ AxisX
Definition: base_histo:291
tools::histo::base_histo::set_annotations
void set_annotations(const annotations_t &a_annotations)
Definition: base_histo:456
tools::histo::base_histo::base_allocate
void base_allocate()
Definition: base_histo:398
tools::value
Definition: value:18
tools::histo::histo_data::m_annotations
std::map< std::string, std::string > m_annotations
Definition: histo_data:184
tools::histo::histo_data::update_fast_getters
void update_fast_getters()
Definition: histo_data:103
tools::histo::base_histo::get_bins
offset_t get_bins() const
Definition: base_histo:436
tools::histo::base_histo::num_entries_t
TN num_entries_t
Definition: base_histo:41
tools::histo::base_histo::get_dimension
dim_t get_dimension() const
Definition: base_histo:438
tools::histo::histo_data::m_bin_Sx2w
std::vector< std::vector< TC > > m_bin_Sx2w
Definition: histo_data:179
tools::histo::get_offset
bool get_offset(const std::vector< axis< TC, TO > > &a_axes, const std::vector< int > &a_is, TO &a_offset)
Definition: axes:50
tools::histo::histo_data::m_in_range_Sxw
std::vector< TC > m_in_range_Sxw
Definition: histo_data:190
tools::histo::base_histo::get_ith_axis_mean
bool get_ith_axis_mean(dim_t a_axis, TC &a_value) const
Definition: base_histo:609
tools::histo::base_histo::annotation
bool annotation(const std::string &a_key, std::string &a_value) const
Definition: base_histo:449
tools::histo::histo_data::equals
bool equals(const histo_data &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
Definition: histo_data:119
tools::histo::base_histo::axis_t
axis< TC, TO > axis_t
Definition: base_histo:36
tools::histo::axis
Definition: axis:19
tools::histo::base_histo::dac
const hd_t & dac() const
Definition: base_histo:56
tools::histo::histo_data::m_bin_entries
std::vector< TN > m_bin_entries
Definition: histo_data:175
tools::histo::base_histo::get_Sw_Sw2
void get_Sw_Sw2(TW &a_sw, TW &a_sw2) const
Definition: base_histo:246
tools::histo::base_histo::base_add
void base_add(const base_histo &a_histo)
Definition: base_histo:476
tools::histo::base_histo::base_histo
base_histo(const base_histo &a_from)
Definition: base_histo:70
tools::histo::base_histo::is_compatible
bool is_compatible(const base_histo &a_histo)
Definition: base_histo:468
tools::histo::base_histo::extra_entries
TN extra_entries() const
Definition: base_histo:99
tools::histo::histo_data::m_bin_Sw
std::vector< TW > m_bin_Sw
Definition: histo_data:176
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::base_histo::configure
bool configure(dim_t a_dim, const std::vector< std::vector< TC > > &a_edges)
Definition: base_histo:341
tools::waxml::begin
void begin(std::ostream &a_writer)
Definition: begend:15
tools::histo::base_histo::get_ith_axis_Sx2w
bool get_ith_axis_Sx2w(dim_t a_axis, TC &a_value) const
Definition: base_histo:232
tools::histo::histo_data::m_in_range_entries
TN m_in_range_entries
Definition: histo_data:187
tools::histo::base_histo::add_annotation
void add_annotation(const std::string &a_key, const std::string &a_value)
Definition: base_histo:446
tools::histo::base_histo::get_bin_height
virtual TH get_bin_height(TO) const =0
tools::histo::base_histo::base_subtract
void base_subtract(const base_histo &a_histo)
Definition: base_histo:493
tools::histo::base_histo::get_all_Sw_Sw2
void get_all_Sw_Sw2(TW &a_sw, TW &a_sw2) const
Definition: base_histo:256
tools::histo::key_axis_z_title
const std::string & key_axis_z_title()
Definition: base_histo:661
tools::histo::histo_data::m_in_range_Sx2w
std::vector< TC > m_in_range_Sx2w
Definition: histo_data:191
tools::histo::base_histo::AxisY
@ AxisY
Definition: base_histo:291
tools::histo::histo_data::m_title
std::string m_title
Definition: histo_data:171
tools::histo::base_histo::annotations_t
std::map< std::string, std::string > annotations_t
Definition: base_histo:442
tools::histo::base_histo::AxisZ
@ AxisZ
Definition: base_histo:291
tools::histo::is_out
bool is_out(const std::vector< axis< TC, TO > > &a_axes, TO a_offset)
Definition: axes:16
tools::histo::dim_planes
unsigned int dim_planes(unsigned int a_dim)
Definition: histo_data:17
tools::histo::histo_data::operator=
histo_data & operator=(const histo_data &a_from)
Definition: histo_data:69
tools::histo::base_histo::is_valid
bool is_valid() const
Definition: base_histo:439
tools::histo::base_histo::get_in_range_Sw
TW get_in_range_Sw() const
Definition: base_histo:243
tools::histo::base_histo::base_from_data
void base_from_data(const hd_t &a_from)
Definition: base_histo:47
tools::histo::base_histo::get_title
const std::string & get_title() const
Definition: base_histo:437
tools::histo::base_histo::get_ith_axis_Sxw
bool get_ith_axis_Sxw(dim_t a_axis, TC &a_value) const
Definition: base_histo:221
tools::histo::get_indices
void get_indices(const std::vector< axis< TC, TO > > &a_axes, TO a_offset, std::vector< int > &a_is)
Definition: axes:30
tools::histo::base_histo::in_range_planes_xyw
const std::vector< TC > & in_range_planes_xyw() const
Definition: base_histo:432
tools::histo::histo_data::m_bin_Sxw
std::vector< std::vector< TC > > m_bin_Sxw
Definition: histo_data:178
tools::histo::base_histo::weight_t
TW weight_t
Definition: base_histo:42
tools::histo::base_histo::bins_sum_xw
const std::vector< std::vector< TC > > & bins_sum_xw() const
Definition: base_histo:430
tools::histo::base_histo::sum_extra_bin_heights
TH sum_extra_bin_heights() const
Definition: base_histo:131
tools::histo::base_histo::bn_t
axis_t::bn_t bn_t
Definition: base_histo:37
tools::histo::histo_data
Definition: histo_data:34
tools::histo::key_axis_y_title
const std::string & key_axis_y_title()
Definition: base_histo:657
tools::histo::histo_data::reset_fast_getters
void reset_fast_getters()
Definition: histo_data:93
tools::histo::base_histo::all_entries
TN all_entries() const
Definition: base_histo:95
tools::histo::base_histo::annotations
const annotations_t & annotations() const
Definition: base_histo:443
tools::histo::histo_data::m_axes
std::vector< axis_t > m_axes
Definition: histo_data:181
tools::histo::base_histo::annotations
annotations_t annotations()
Definition: base_histo:444
tools::histo::base_histo::hprint_annotations
void hprint_annotations(std::ostream &a_out)
Definition: base_histo:458
tools::histo::base_histo::bins_sum_w
const std::vector< TW > & bins_sum_w() const
Definition: base_histo:428
tools::histo::base_histo::set_title
bool set_title(const std::string &a_title)
Definition: base_histo:88
tools::histo::base_histo::title
const std::string & title() const
Definition: base_histo:87
tools::histo::base_histo::equals
bool equals(const base_histo &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
Definition: base_histo:83
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::histo::base_histo::sum_all_bin_heights
TH sum_all_bin_heights() const
Definition: base_histo:123
tools::histo::base_histo::dim_t
unsigned int dim_t
Definition: base_histo:38
tools::histo::axis< double, unsigned int >::bn_t
unsigned int bn_t
Definition: axis:21
tools::histo::base_histo::bins_entries
const std::vector< TN > & bins_entries() const
Definition: base_histo:427
tools::histo::base_histo::configure
bool configure(dim_t a_dim, const std::vector< bn_t > &aNumbers, const std::vector< TC > &aMins, const std::vector< TC > &aMaxs)
Definition: base_histo:293
tools::waxml::end
void end(std::ostream &a_writer)
Definition: begend:31
tools::histo::base_histo::base_reset
void base_reset()
Definition: base_histo:381
tools::histo::histo_data::m_bin_Sw2
std::vector< TW > m_bin_Sw2
Definition: histo_data:177
tools::histo::base_histo::min_bin_height
TH min_bin_height() const
Definition: base_histo:141
tools::histo::histo_data::m_all_entries
TN m_all_entries
Definition: histo_data:186
tools::histo::histo_data::m_in_range_Sw
TW m_in_range_Sw
Definition: histo_data:188
tools::histo::base_histo::~base_histo
virtual ~base_histo()
Definition: base_histo:64
tools::histo::base_histo::hd_t
histo_data< TC, TO, TN, TW > hd_t
Definition: base_histo:35
tools::histo::base_histo::base_multiply
bool base_multiply(TW a_factor)
Definition: base_histo:592
tools::histo::base_histo::height_t
TH height_t
Definition: base_histo:43
tools::histo::base_histo::get_bin_entries
TN get_bin_entries(const std::vector< int > &aIs) const
Definition: base_histo:644
tools::histo::base_histo::number_of_planes
dim_t number_of_planes() const
Definition: base_histo:90
tools::histo::base_histo::operator=
base_histo & operator=(const base_histo &a_from)
Definition: base_histo:76
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::histo::base_histo::coordinate_t
TC coordinate_t
Definition: base_histo:39
tools::histo::key_axis_x_title
const std::string & key_axis_x_title()
Definition: base_histo:653
tools::histo::base_histo::get_ith_axis_rms
bool get_ith_axis_rms(dim_t a_axis, TC &a_value) const
Definition: base_histo:625
tools::histo::base_histo::get_in_range_Sw2
TW get_in_range_Sw2() const
Definition: base_histo:244
tools::histo::base_histo::base_histo
base_histo()
Definition: base_histo:58
tools::histo::base_histo::get_axis
const axis_t & get_axis(int a_index) const
Definition: base_histo:435
tools::histo::histo_data::m_bin_number
TO m_bin_number
Definition: histo_data:174
tools::histo::base_histo::base_get_data
hd_t base_get_data() const
Definition: base_histo:49
tools::histo::base_histo
Definition: base_histo:27
histo_data
tools::histo::base_histo::sum_bin_heights
TH sum_bin_heights() const
Definition: base_histo:114
tools::histo::base_histo::bins_sum_x2w
const std::vector< std::vector< TC > > & bins_sum_x2w() const
Definition: base_histo:431
tools::histo::histo_data::m_in_range_plane_Sxyw
std::vector< TC > m_in_range_plane_Sxyw
Definition: histo_data:183
tools::histo::base_histo::offset_t
TO offset_t
Definition: base_histo:40
tools::histo::base_histo::bins_sum_w2
const std::vector< TW > & bins_sum_w2() const
Definition: base_histo:429
tools::histo::base_histo::entries
TN entries() const
Definition: base_histo:92
tools::histo::histo_data::m_dimension
dim_t m_dimension
Definition: histo_data:172
tools::histo::base_histo::dimension
dim_t dimension() const
Definition: base_histo:89
tools::histo::base_histo::equivalent_bin_entries
TW equivalent_bin_entries() const
Definition: base_histo:102
tools::histo::base_histo::base_multiply
bool base_multiply(const base_histo &a_histo)
Definition: base_histo:513
tools::histo::base_histo::base_divide
bool base_divide(const base_histo &a_histo)
Definition: base_histo:547
tools::histo::base_histo::max_bin_height_with_entries
bool max_bin_height_with_entries(TH &a_value) const
Definition: base_histo:193