g4tools  5.4.0
Public Types | Public Member Functions | Protected Types | Protected Member Functions | List of all members
tools::histo::b1< TC, TO, TN, TW, TH > Class Template Referenceabstract
Inheritance diagram for tools::histo::b1< TC, TO, TN, TW, TH >:
Inheritance graph
[legend]
Collaboration diagram for tools::histo::b1< TC, TO, TN, TW, TH >:
Collaboration graph
[legend]

Public Types

typedef base_histo< TC, TO, TN, TW, TH > base_histo_t
 
typedef parent::axis_t axis_t
 
typedef parent::bn_t bn_t
 
- Public Types inherited from tools::histo::base_histo< TC, TO, TN, TW, TH >
typedef histo_data< TC, TO, TN, TW > hd_t
 
typedef axis< TC, TO > axis_t
 
typedef axis_t::bn_t bn_t
 
typedef unsigned int dim_t
 
typedef TC coordinate_t
 
typedef TO offset_t
 
typedef TN num_entries_t
 
typedef TW weight_t
 
typedef TH height_t
 
typedef std::map< std::string, std::string > annotations_t
 

Public Member Functions

virtual TH bin_error (int) const =0
 
int coord_to_index (TC aCoord) const
 
TC mean () const
 
TC rms () const
 
TN bin_entries (int aI) const
 
TW bin_Sw (int aI) const
 
TW bin_Sw2 (int aI) const
 
TC bin_Sxw (int aI) const
 
TC bin_Sx2w (int aI) const
 
TH bin_height (int aI) const
 
TC bin_center (int aI) const
 
TC bin_mean (int aI) const
 
TC bin_rms (int aI) const
 
const axis_taxis () const
 
axis_taxis ()
 
void hprint (std::ostream &a_out)
 
bool configure (bn_t aXnumber, TC aXmin, TC aXmax)
 
bool configure (const std::vector< TC > &a_edges)
 
- Public Member Functions inherited from tools::histo::base_histo< TC, TO, TN, TW, TH >
const hd_tdac () const
 
bool equals (const base_histo &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
 
const std::string & title () const
 
bool set_title (const std::string &a_title)
 
dim_t dimension () const
 
dim_t number_of_planes () const
 
TN entries () const
 
TN all_entries () const
 
TN extra_entries () const
 
TW equivalent_bin_entries () const
 
TH sum_bin_heights () const
 
TH sum_all_bin_heights () const
 
TH sum_extra_bin_heights () const
 
TH min_bin_height () const
 
TH max_bin_height () const
 
bool min_bin_height_with_entries (TH &a_value) const
 
bool max_bin_height_with_entries (TH &a_value) const
 
bool has_entries_per_bin () const
 
bool get_ith_axis_Sxw (dim_t a_axis, TC &a_value) const
 
bool get_ith_axis_Sx2w (dim_t a_axis, TC &a_value) const
 
TW get_in_range_Sw () const
 
TW get_in_range_Sw2 () const
 
void get_Sw_Sw2 (TW &a_sw, TW &a_sw2) const
 
void get_all_Sw_Sw2 (TW &a_sw, TW &a_sw2) const
 
const std::vector< TN > & bins_entries () const
 
const std::vector< TW > & bins_sum_w () const
 
const std::vector< TW > & bins_sum_w2 () const
 
const std::vector< std::vector< TC > > & bins_sum_xw () const
 
const std::vector< std::vector< TC > > & bins_sum_x2w () const
 
const std::vector< TC > & in_range_planes_xyw () const
 
const axis_tget_axis (int a_index) const
 
offset_t get_bins () const
 
const std::string & get_title () const
 
dim_t get_dimension () const
 
bool is_valid () const
 
const annotations_tannotations () const
 
annotations_t annotations ()
 
void add_annotation (const std::string &a_key, const std::string &a_value)
 
bool annotation (const std::string &a_key, std::string &a_value) const
 
void set_annotations (const annotations_t &a_annotations)
 
void hprint_annotations (std::ostream &a_out)
 

Protected Types

enum  { AxisX =0 }
 
- Protected Types inherited from tools::histo::base_histo< TC, TO, TN, TW, TH >
enum  { AxisX =0, AxisY =1, AxisZ =2 }
 
- Protected Types inherited from tools::histo::histo_data< TC, TO, TN, TW >
typedef axis< TC, TO > axis_t
 
typedef unsigned int dim_t
 
typedef std::map< std::string, std::string > annotations_t
 

Protected Member Functions

 b1 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax)
 
 b1 (const std::string &a_title, const std::vector< TC > &a_edges)
 
virtual ~b1 ()
 
 b1 (const b1 &a_from)
 
b1operator= (const b1 &a_from)
 
bool _find_offset (int aI, TO &a_offset) const
 
- Protected Member Functions inherited from tools::histo::base_histo< TC, TO, TN, TW, TH >
virtual TH get_bin_height (TO) const =0
 
void base_from_data (const hd_t &a_from)
 
hd_t base_get_data () const
 
 base_histo ()
 
virtual ~base_histo ()
 
 base_histo (const base_histo &a_from)
 
base_histooperator= (const base_histo &a_from)
 
bool configure (dim_t a_dim, const std::vector< bn_t > &aNumbers, const std::vector< TC > &aMins, const std::vector< TC > &aMaxs)
 
bool configure (dim_t a_dim, const std::vector< std::vector< TC > > &a_edges)
 
void base_reset ()
 
void base_allocate ()
 
bool is_compatible (const base_histo &a_histo)
 
void base_add (const base_histo &a_histo)
 
void base_subtract (const base_histo &a_histo)
 
bool base_multiply (const base_histo &a_histo)
 
bool base_divide (const base_histo &a_histo)
 
bool base_multiply (TW a_factor)
 
bool get_ith_axis_mean (dim_t a_axis, TC &a_value) const
 
bool get_ith_axis_rms (dim_t a_axis, TC &a_value) const
 
TN get_bin_entries (const std::vector< int > &aIs) const
 
- Protected Member Functions inherited from tools::histo::histo_data< TC, TO, TN, TW >
void reset_fast_getters ()
 
 histo_data ()
 
 histo_data (const histo_data &a_from)
 
histo_dataoperator= (const histo_data &a_from)
 
virtual ~histo_data ()
 
void update_fast_getters ()
 
bool equals (const histo_data &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
 
bool equals_TH (const histo_data &a_from, const TW &a_prec, TW(*a_fabs)(TW), bool a_cmp_bin_Sw2) const
 

Additional Inherited Members

- Protected Attributes inherited from tools::histo::histo_data< TC, TO, TN, TW >
std::string m_title
 
dim_t m_dimension
 
TO m_bin_number
 
std::vector< TN > m_bin_entries
 
std::vector< TW > m_bin_Sw
 
std::vector< TW > m_bin_Sw2
 
std::vector< std::vector< TC > > m_bin_Sxw
 
std::vector< std::vector< TC > > m_bin_Sx2w
 
std::vector< axis_tm_axes
 
std::vector< TC > m_in_range_plane_Sxyw
 
std::map< std::string, std::string > m_annotations
 
TN m_all_entries
 
TN m_in_range_entries
 
TW m_in_range_Sw
 
TW m_in_range_Sw2
 
std::vector< TC > m_in_range_Sxw
 
std::vector< TC > m_in_range_Sx2w
 

Detailed Description

template<class TC, class TO, class TN, class TW, class TH>
class tools::histo::b1< TC, TO, TN, TW, TH >

Definition at line 15 of file b1.

Member Typedef Documentation

◆ axis_t

template<class TC , class TO , class TN , class TW , class TH >
typedef parent::axis_t tools::histo::b1< TC, TO, TN, TW, TH >::axis_t

Definition at line 21 of file b1.

◆ base_histo_t

template<class TC , class TO , class TN , class TW , class TH >
typedef base_histo<TC,TO,TN,TW,TH> tools::histo::b1< TC, TO, TN, TW, TH >::base_histo_t

Definition at line 20 of file b1.

◆ bn_t

template<class TC , class TO , class TN , class TW , class TH >
typedef parent::bn_t tools::histo::b1< TC, TO, TN, TW, TH >::bn_t

Definition at line 22 of file b1.

Member Enumeration Documentation

◆ anonymous enum

template<class TC , class TO , class TN , class TW , class TH >
anonymous enum
protected
Enumerator
AxisX 

Definition at line 18 of file b1.

18 {AxisX=0};

Constructor & Destructor Documentation

◆ b1() [1/3]

template<class TC , class TO , class TN , class TW , class TH >
tools::histo::b1< TC, TO, TN, TW, TH >::b1 ( const std::string &  a_title,
bn_t  aXnumber,
TC  aXmin,
TC  aXmax 
)
inlineprotected

Definition at line 150 of file b1.

150  {
151  parent::m_title = a_title;
152  std::vector<bn_t> nbins;
153  nbins.push_back(aXnumber);
154  std::vector<TC> mins;
155  mins.push_back(aXmin);
156  std::vector<TC> maxs;
157  maxs.push_back(aXmax);
158  parent::configure(1,nbins,mins,maxs);
159  }

◆ b1() [2/3]

template<class TC , class TO , class TN , class TW , class TH >
tools::histo::b1< TC, TO, TN, TW, TH >::b1 ( const std::string &  a_title,
const std::vector< TC > &  a_edges 
)
inlineprotected

Definition at line 160 of file b1.

160  {
161  parent::m_title = a_title;
162  std::vector< std::vector<TC> > edges(1);
163  edges[0] = a_edges;
164  parent::configure(1,edges);
165  }

◆ ~b1()

template<class TC , class TO , class TN , class TW , class TH >
virtual tools::histo::b1< TC, TO, TN, TW, TH >::~b1 ( )
inlineprotectedvirtual

Definition at line 167 of file b1.

167 {}

◆ b1() [3/3]

template<class TC , class TO , class TN , class TW , class TH >
tools::histo::b1< TC, TO, TN, TW, TH >::b1 ( const b1< TC, TO, TN, TW, TH > &  a_from)
inlineprotected

Definition at line 169 of file b1.

169 :parent(a_from){}

Member Function Documentation

◆ _find_offset()

template<class TC , class TO , class TN , class TW , class TH >
bool tools::histo::b1< TC, TO, TN, TW, TH >::_find_offset ( int  aI,
TO &  a_offset 
) const
inlineprotected

Definition at line 191 of file b1.

191  {
192  if(parent::m_dimension!=1) {a_offset=0;return false;}
193  bn_t ibin;
194  if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) {a_offset=0;return false;}
195  a_offset = ibin;
196  return true;
197  }

◆ axis() [1/2]

template<class TC , class TO , class TN , class TW , class TH >
axis_t& tools::histo::b1< TC, TO, TN, TW, TH >::axis ( )
inline

Definition at line 104 of file b1.

104 {return parent::m_axes[0];} //touchy

◆ axis() [2/2]

template<class TC , class TO , class TN , class TW , class TH >
const axis_t& tools::histo::b1< TC, TO, TN, TW, TH >::axis ( ) const
inline

Definition at line 103 of file b1.

103 {return parent::m_axes[0];}

◆ bin_center()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::bin_center ( int  aI) const
inline

Definition at line 81 of file b1.

81 {return parent::m_axes[0].bin_center(aI);}

◆ bin_entries()

template<class TC , class TO , class TN , class TW , class TH >
TN tools::histo::b1< TC, TO, TN, TW, TH >::bin_entries ( int  aI) const
inline

Definition at line 47 of file b1.

47  {
48  TO offset;
49  if(!_find_offset(aI,offset)) return 0;
50  return parent::m_bin_entries[offset];
51  }

◆ bin_error()

template<class TC , class TO , class TN , class TW , class TH >
virtual TH tools::histo::b1< TC, TO, TN, TW, TH >::bin_error ( int  ) const
pure virtual

◆ bin_height()

template<class TC , class TO , class TN , class TW , class TH >
TH tools::histo::b1< TC, TO, TN, TW, TH >::bin_height ( int  aI) const
inline

Definition at line 75 of file b1.

75  {
76  TO offset;
77  if(!_find_offset(aI,offset)) return 0;
78  return this->get_bin_height(offset);
79  }

◆ bin_mean()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::bin_mean ( int  aI) const
inline

Definition at line 83 of file b1.

83  {
84  TO offset;
85  if(!_find_offset(aI,offset)) return 0;
86  TW sw = parent::m_bin_Sw[offset];
87  if(sw==0) return 0;
88  return parent::m_bin_Sxw[offset][AxisX]/sw;
89  }

◆ bin_rms()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::bin_rms ( int  aI) const
inline

Definition at line 91 of file b1.

91  {
92  TO offset;
93  if(!_find_offset(aI,offset)) return 0;
94  TW sw = parent::m_bin_Sw[offset];
95  if(sw==0) return 0;
96  TC sxw = parent::m_bin_Sxw[offset][AxisX];
97  TC sx2w = parent::m_bin_Sx2w[offset][AxisX];
98  TC _mean = sxw/sw;
99  return ::sqrt(::fabs((sx2w / sw) - _mean * _mean));
100  }

◆ bin_Sw()

template<class TC , class TO , class TN , class TW , class TH >
TW tools::histo::b1< TC, TO, TN, TW, TH >::bin_Sw ( int  aI) const
inline

Definition at line 53 of file b1.

53  {
54  TO offset;
55  if(!_find_offset(aI,offset)) return 0;
56  return parent::m_bin_Sw[offset];
57  }

◆ bin_Sw2()

template<class TC , class TO , class TN , class TW , class TH >
TW tools::histo::b1< TC, TO, TN, TW, TH >::bin_Sw2 ( int  aI) const
inline

Definition at line 59 of file b1.

59  {
60  TO offset;
61  if(!_find_offset(aI,offset)) return 0;
62  return parent::m_bin_Sw2[offset];
63  }

◆ bin_Sx2w()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::bin_Sx2w ( int  aI) const
inline

Definition at line 69 of file b1.

69  {
70  TO offset;
71  if(!_find_offset(aI,offset)) return 0;
72  return parent::m_bin_Sx2w[offset][AxisX];
73  }

◆ bin_Sxw()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::bin_Sxw ( int  aI) const
inline

Definition at line 64 of file b1.

64  {
65  TO offset;
66  if(!_find_offset(aI,offset)) return 0;
67  return parent::m_bin_Sxw[offset][AxisX];
68  }

◆ configure() [1/2]

template<class TC , class TO , class TN , class TW , class TH >
bool tools::histo::b1< TC, TO, TN, TW, TH >::configure ( bn_t  aXnumber,
TC  aXmin,
TC  aXmax 
)
inline

Definition at line 176 of file b1.

176  {
177  std::vector<bn_t> nbins;
178  nbins.push_back(aXnumber);
179  std::vector<TC> mins;
180  mins.push_back(aXmin);
181  std::vector<TC> maxs;
182  maxs.push_back(aXmax);
183  return parent::configure(1,nbins,mins,maxs);
184  }

◆ configure() [2/2]

template<class TC , class TO , class TN , class TW , class TH >
bool tools::histo::b1< TC, TO, TN, TW, TH >::configure ( const std::vector< TC > &  a_edges)
inline

Definition at line 185 of file b1.

185  {
186  std::vector< std::vector<TC> > edges(1);
187  edges[0] = a_edges;
188  return parent::configure(1,edges);
189  }

◆ coord_to_index()

template<class TC , class TO , class TN , class TW , class TH >
int tools::histo::b1< TC, TO, TN, TW, TH >::coord_to_index ( TC  aCoord) const
inline

Definition at line 27 of file b1.

27  {
28  return axis().coord_to_index(aCoord);
29  }

◆ hprint()

template<class TC , class TO , class TN , class TW , class TH >
void tools::histo::b1< TC, TO, TN, TW, TH >::hprint ( std::ostream &  a_out)
inline

Definition at line 107 of file b1.

107  {
108  // A la HPRINT.
109  a_out << parent::dimension() << parent::title() << std::endl;
110  a_out
111  << " * ENTRIES = " << parent::all_entries()
112  << " * ALL CHANNELS = " << parent::sum_bin_heights()
113  << " * UNDERFLOW = " << bin_height(axis_t::UNDERFLOW_BIN)
114  << " * OVERFLOW = " << bin_height(axis_t::OVERFLOW_BIN)
115  << std::endl;
116  a_out
117  << " * BIN WID = " << axis().bin_width(0)
118  << " * MEAN VALUE = " << mean()
119  << " * R . M . S = " << rms()
120  << std::endl;
121 
122  // Some bins :
123  bn_t bins = axis().bins();
124  a_out
125  << " * ENTRIES[0] = "
126  << bin_entries(0)
127  << " * HEIGHT[0] = "
128  << bin_height(0)
129  << " * ERROR[0] = "
130  << bin_error(0)
131  << std::endl;
132  a_out
133  << " * ENTRIES[N/2] = "
134  << bin_entries(bins/2)
135  << " * HEIGHT[N/2] = "
136  << bin_height(bins/2)
137  << " * ERROR[N/2] = "
138  << bin_error(bins/2)
139  << std::endl;
140  a_out
141  << " * ENTRIES[N-1] = "
142  << bin_entries(bins-1)
143  << " * HEIGHT[N-1] = "
144  << bin_height(bins-1)
145  << " * ERROR[N-1] = "
146  << bin_error(bins-1)
147  << std::endl;
148  }

◆ mean()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::mean ( ) const
inline

Definition at line 30 of file b1.

30  {
31  //TC value;
32  //parent::get_ith_axis_mean(AxisX,value); //can return false.
33  //return value;
34  if(parent::m_in_range_Sw==0) return 0;
36  }

◆ operator=()

template<class TC , class TO , class TN , class TW , class TH >
b1& tools::histo::b1< TC, TO, TN, TW, TH >::operator= ( const b1< TC, TO, TN, TW, TH > &  a_from)
inlineprotected

Definition at line 170 of file b1.

170  {
171  if(&a_from==this) return *this;
172  parent::operator=(a_from);
173  return *this;
174  }

◆ rms()

template<class TC , class TO , class TN , class TW , class TH >
TC tools::histo::b1< TC, TO, TN, TW, TH >::rms ( ) const
inline

Definition at line 37 of file b1.

37  {
38  //TC value;
39  //parent::get_ith_axis_rms(AxisX,value); //can return false.
40  //return value;
41  if(parent::m_in_range_Sw==0) return 0;
43  return ::sqrt(::fabs((parent::m_in_range_Sx2w[0] / parent::m_in_range_Sw) - _mean * _mean));
44  }

The documentation for this class was generated from the following file:
tools::histo::b1::_find_offset
bool _find_offset(int aI, TO &a_offset) const
Definition: b1:191
tools::histo::axis::coord_to_index
int coord_to_index(TC a_value) const
Definition: axis:97
tools::histo::b1::AxisX
@ AxisX
Definition: b1:18
tools::histo::histo_data::m_bin_Sx2w
std::vector< std::vector< TC > > m_bin_Sx2w
Definition: histo_data:179
tools::histo::histo_data::m_in_range_Sxw
std::vector< TC > m_in_range_Sxw
Definition: histo_data:190
tools::histo::b1::bn_t
parent::bn_t bn_t
Definition: b1:22
tools::histo::histo_data::m_bin_entries
std::vector< TN > m_bin_entries
Definition: histo_data:175
tools::histo::histo_data::m_bin_Sw
std::vector< TW > m_bin_Sw
Definition: histo_data:176
tools::histo::base_histo::get_bin_height
virtual TH get_bin_height(TO) const =0
tools::histo::histo_data::m_in_range_Sx2w
std::vector< TC > m_in_range_Sx2w
Definition: histo_data:191
tools::histo::histo_data::m_title
std::string m_title
Definition: histo_data:171
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::b1::rms
TC rms() const
Definition: b1:37
tools::histo::histo_data::m_bin_Sxw
std::vector< std::vector< TC > > m_bin_Sxw
Definition: histo_data:178
tools::histo::axis::UNDERFLOW_BIN
@ UNDERFLOW_BIN
Definition: axis:23
tools::histo::base_histo::all_entries
TN all_entries() const
Definition: base_histo:95
tools::histo::histo_data::m_axes
std::vector< axis_t > m_axes
Definition: histo_data:181
tools::histo::b1::bin_height
TH bin_height(int aI) const
Definition: b1:75
tools::histo::base_histo::title
const std::string & title() const
Definition: base_histo:87
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::histo::histo_data::m_bin_Sw2
std::vector< TW > m_bin_Sw2
Definition: histo_data:177
tools::histo::histo_data::m_in_range_Sw
TW m_in_range_Sw
Definition: histo_data:188
tools::histo::b1::bin_error
virtual TH bin_error(int) const =0
tools::histo::axis::OVERFLOW_BIN
@ OVERFLOW_BIN
Definition: axis:23
tools::histo::base_histo::operator=
base_histo & operator=(const base_histo &a_from)
Definition: base_histo:76
tools::histo::base_histo::sum_bin_heights
TH sum_bin_heights() const
Definition: base_histo:114
tools::histo::histo_data::m_dimension
dim_t m_dimension
Definition: histo_data:172
tools::histo::b1::mean
TC mean() const
Definition: b1:30
tools::histo::base_histo::dimension
dim_t dimension() const
Definition: base_histo:89
tools::histo::axis::bin_width
TC bin_width(int a_bin) const
Definition: axis:31
tools::histo::b1::bin_entries
TN bin_entries(int aI) const
Definition: b1:47