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

Public Types

typedef axis< TC, TO > axis_t
 
typedef unsigned int dim_t
 
typedef std::map< std::string, std::string > annotations_t
 

Public Member Functions

 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
 

Public Attributes

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
 

Protected Member Functions

void reset_fast_getters ()
 

Detailed Description

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

Definition at line 34 of file histo_data.

Member Typedef Documentation

◆ annotations_t

template<class TC , class TO , class TN , class TW >
typedef std::map<std::string,std::string> tools::histo::histo_data< TC, TO, TN, TW >::annotations_t

Definition at line 38 of file histo_data.

◆ axis_t

template<class TC , class TO , class TN , class TW >
typedef axis<TC,TO> tools::histo::histo_data< TC, TO, TN, TW >::axis_t

Definition at line 36 of file histo_data.

◆ dim_t

template<class TC , class TO , class TN , class TW >
typedef unsigned int tools::histo::histo_data< TC, TO, TN, TW >::dim_t

Definition at line 37 of file histo_data.

Constructor & Destructor Documentation

◆ histo_data() [1/2]

template<class TC , class TO , class TN , class TW >
tools::histo::histo_data< TC, TO, TN, TW >::histo_data ( )
inline

Definition at line 40 of file histo_data.

41  :m_dimension(0)
42  ,m_bin_number(0)
43  ,m_all_entries(0)
45  ,m_in_range_Sw(0)
46  ,m_in_range_Sw2(0)
47  {}

◆ histo_data() [2/2]

template<class TC , class TO , class TN , class TW >
tools::histo::histo_data< TC, TO, TN, TW >::histo_data ( const histo_data< TC, TO, TN, TW > &  a_from)
inline

Definition at line 49 of file histo_data.

50  :m_title(a_from.m_title)
51  ,m_dimension(a_from.m_dimension)
52  ,m_bin_number(a_from.m_bin_number)
53  ,m_bin_entries(a_from.m_bin_entries)
54  ,m_bin_Sw(a_from.m_bin_Sw)
55  ,m_bin_Sw2(a_from.m_bin_Sw2)
56  ,m_bin_Sxw(a_from.m_bin_Sxw)
57  ,m_bin_Sx2w(a_from.m_bin_Sx2w)
58  ,m_axes(a_from.m_axes)
59  ,m_in_range_plane_Sxyw(a_from.m_in_range_plane_Sxyw)
60  ,m_annotations(a_from.m_annotations)
61  ,m_all_entries(a_from.m_all_entries)
62  ,m_in_range_entries(a_from.m_in_range_entries)
63  ,m_in_range_Sw(a_from.m_in_range_Sw)
64  ,m_in_range_Sw2(a_from.m_in_range_Sw2)
65  ,m_in_range_Sxw(a_from.m_in_range_Sxw)
66  ,m_in_range_Sx2w(a_from.m_in_range_Sx2w)
67  {}

◆ ~histo_data()

template<class TC , class TO , class TN , class TW >
virtual tools::histo::histo_data< TC, TO, TN, TW >::~histo_data ( )
inlinevirtual

Definition at line 91 of file histo_data.

91 {}

Member Function Documentation

◆ equals()

template<class TC , class TO , class TN , class TW >
bool tools::histo::histo_data< TC, TO, TN, TW >::equals ( const histo_data< TC, TO, TN, TW > &  a_from,
const TW &  a_prec,
TW(*)(TW)  a_fabs 
) const
inline

Definition at line 119 of file histo_data.

119  {
120  if(&a_from==this) return true;
121  if(m_title!=a_from.m_title) return false;
122  if(m_dimension!=a_from.m_dimension) return false;
123  if(m_bin_number!=a_from.m_bin_number) return false;
124  if(m_bin_entries!=a_from.m_bin_entries) return false;
125  //if(!vequ(m_bin_entries,a_from.m_bin_entries)) return false;
126  if(!vectors_are_equal(m_bin_Sw,a_from.m_bin_Sw,a_prec,a_fabs)) return false;
127  if(!vectors_are_equal(m_bin_Sw2,a_from.m_bin_Sw2,a_prec,a_fabs)) return false;
128  if(!vecvecs_are_equal(m_bin_Sxw,a_from.m_bin_Sxw,a_prec,a_fabs)) return false;
129  if(!vecvecs_are_equal(m_bin_Sx2w,a_from.m_bin_Sx2w,a_prec,a_fabs)) return false;
130  if(m_axes!=a_from.m_axes) return false;
131  if(!vectors_are_equal(m_in_range_plane_Sxyw,a_from.m_in_range_plane_Sxyw,a_prec,a_fabs)) return false;
132  if(m_annotations!=a_from.m_annotations) return false;
133 
134  if(m_all_entries!=a_from.m_all_entries) return false;
135  if(m_in_range_entries!=a_from.m_in_range_entries) return false;
136 
137  if(!numbers_are_equal(m_in_range_Sw,a_from.m_in_range_Sw,a_prec,a_fabs)) return false;
138  if(!numbers_are_equal(m_in_range_Sw2,a_from.m_in_range_Sw2,a_prec,a_fabs)) return false;
139  if(!vectors_are_equal(m_in_range_Sxw,a_from.m_in_range_Sxw,a_prec,a_fabs)) return false;
140  if(!vectors_are_equal(m_in_range_Sx2w,a_from.m_in_range_Sx2w,a_prec,a_fabs)) return false;
141 
142  return true;
143  }

◆ equals_TH()

template<class TC , class TO , class TN , class TW >
bool tools::histo::histo_data< TC, TO, TN, TW >::equals_TH ( const histo_data< TC, TO, TN, TW > &  a_from,
const TW &  a_prec,
TW(*)(TW)  a_fabs,
bool  a_cmp_bin_Sw2 
) const
inline

Definition at line 144 of file histo_data.

144  {
145  // used to compare with an histo built from a TH stream out from a CERN-ROOT file.
146  if(&a_from==this) return true;
147  if(m_title!=a_from.m_title) return false;
148  if(m_dimension!=a_from.m_dimension) return false;
149  if(m_bin_number!=a_from.m_bin_number) return false;
150  //if(m_bin_entries!=a_from.m_bin_entries) return false;
151  if(!vectors_are_equal(m_bin_Sw,a_from.m_bin_Sw,a_prec,a_fabs)) return false;
152  if(a_cmp_bin_Sw2) if(!vectors_are_equal(m_bin_Sw2,a_from.m_bin_Sw2,a_prec,a_fabs)) return false;
153  //if(!vecvecs_are_equal(m_bin_Sxw,a_from.m_bin_Sxw,a_prec,a_fabs)) return false;
154  //if(!vecvecs_are_equal(m_bin_Sx2w,a_from.m_bin_Sx2w,a_prec,a_fabs)) return false;
155  if(m_axes!=a_from.m_axes) return false;
156  if(!vectors_are_equal(m_in_range_plane_Sxyw,a_from.m_in_range_plane_Sxyw,a_prec,a_fabs)) return false;
157  //if(m_annotations!=a_from.m_annotations) return false;
158 
159  if(m_all_entries!=a_from.m_all_entries) return false;
160  //if(m_in_range_entries!=a_from.m_in_range_entries) return false;
161 
162  if(!numbers_are_equal(m_in_range_Sw,a_from.m_in_range_Sw,a_prec,a_fabs)) return false;
163  if(!numbers_are_equal(m_in_range_Sw2,a_from.m_in_range_Sw2,a_prec,a_fabs)) return false;
164  //if(!vectors_are_equal(m_in_range_Sxw,a_from.m_in_range_Sxw,a_prec,a_fabs)) return false;
165  //if(!vectors_are_equal(m_in_range_Sx2w,a_from.m_in_range_Sx2w,a_prec,a_fabs)) return false;
166 
167  return true;
168  }

◆ operator=()

template<class TC , class TO , class TN , class TW >
histo_data& tools::histo::histo_data< TC, TO, TN, TW >::operator= ( const histo_data< TC, TO, TN, TW > &  a_from)
inline

Definition at line 69 of file histo_data.

69  {
70  if(&a_from==this) return *this;
71  m_title = a_from.m_title;
72  m_dimension = a_from.m_dimension;
73  m_bin_number = a_from.m_bin_number;
74  m_bin_entries = a_from.m_bin_entries;
75  m_bin_Sw = a_from.m_bin_Sw;
76  m_bin_Sw2 = a_from.m_bin_Sw2;
77  m_bin_Sxw = a_from.m_bin_Sxw;
78  m_bin_Sx2w = a_from.m_bin_Sx2w;
79  m_axes = a_from.m_axes;
80  m_in_range_plane_Sxyw = a_from.m_in_range_plane_Sxyw;
81  m_annotations = a_from.m_annotations;
82  m_all_entries = a_from.m_all_entries;
83  m_in_range_entries = a_from.m_in_range_entries;
84  m_in_range_Sw = a_from.m_in_range_Sw;
85  m_in_range_Sw2 = a_from.m_in_range_Sw2;
86  m_in_range_Sxw = a_from.m_in_range_Sxw;
87  m_in_range_Sx2w = a_from.m_in_range_Sx2w;
88  return *this;
89  }

◆ reset_fast_getters()

template<class TC , class TO , class TN , class TW >
void tools::histo::histo_data< TC, TO, TN, TW >::reset_fast_getters ( )
inlineprotected

Definition at line 93 of file histo_data.

93  {
94  //m_in_range_plane_Sxyw is not a fast getter.
95  m_all_entries = 0;
97  m_in_range_Sw = 0;
98  m_in_range_Sw2 = 0;
99  m_in_range_Sxw.assign(m_dimension,0);
100  m_in_range_Sx2w.assign(m_dimension,0);
101  }

◆ update_fast_getters()

template<class TC , class TO , class TN , class TW >
void tools::histo::histo_data< TC, TO, TN, TW >::update_fast_getters ( )
inline

Definition at line 103 of file histo_data.

103  {
105  {for(TO ibin=0;ibin<m_bin_number;ibin++) {
106  if(!histo::is_out(m_axes,ibin)) {
108  m_in_range_Sw += m_bin_Sw[ibin];
109  m_in_range_Sw2 += m_bin_Sw2[ibin];
110  for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
111  m_in_range_Sxw[iaxis] += m_bin_Sxw[ibin][iaxis];
112  m_in_range_Sx2w[iaxis] += m_bin_Sx2w[ibin][iaxis];
113  }
114  }
115  m_all_entries += m_bin_entries[ibin];
116  }}
117  }

Member Data Documentation

◆ m_all_entries

template<class TC , class TO , class TN , class TW >
TN tools::histo::histo_data< TC, TO, TN, TW >::m_all_entries

Definition at line 186 of file histo_data.

◆ m_annotations

template<class TC , class TO , class TN , class TW >
std::map<std::string,std::string> tools::histo::histo_data< TC, TO, TN, TW >::m_annotations

Definition at line 184 of file histo_data.

◆ m_axes

template<class TC , class TO , class TN , class TW >
std::vector<axis_t> tools::histo::histo_data< TC, TO, TN, TW >::m_axes

Definition at line 181 of file histo_data.

◆ m_bin_entries

template<class TC , class TO , class TN , class TW >
std::vector<TN> tools::histo::histo_data< TC, TO, TN, TW >::m_bin_entries

Definition at line 175 of file histo_data.

◆ m_bin_number

template<class TC , class TO , class TN , class TW >
TO tools::histo::histo_data< TC, TO, TN, TW >::m_bin_number

Definition at line 174 of file histo_data.

◆ m_bin_Sw

template<class TC , class TO , class TN , class TW >
std::vector<TW> tools::histo::histo_data< TC, TO, TN, TW >::m_bin_Sw

Definition at line 176 of file histo_data.

◆ m_bin_Sw2

template<class TC , class TO , class TN , class TW >
std::vector<TW> tools::histo::histo_data< TC, TO, TN, TW >::m_bin_Sw2

Definition at line 177 of file histo_data.

◆ m_bin_Sx2w

template<class TC , class TO , class TN , class TW >
std::vector< std::vector<TC> > tools::histo::histo_data< TC, TO, TN, TW >::m_bin_Sx2w

Definition at line 179 of file histo_data.

◆ m_bin_Sxw

template<class TC , class TO , class TN , class TW >
std::vector< std::vector<TC> > tools::histo::histo_data< TC, TO, TN, TW >::m_bin_Sxw

Definition at line 178 of file histo_data.

◆ m_dimension

template<class TC , class TO , class TN , class TW >
dim_t tools::histo::histo_data< TC, TO, TN, TW >::m_dimension

Definition at line 172 of file histo_data.

◆ m_in_range_entries

template<class TC , class TO , class TN , class TW >
TN tools::histo::histo_data< TC, TO, TN, TW >::m_in_range_entries

Definition at line 187 of file histo_data.

◆ m_in_range_plane_Sxyw

template<class TC , class TO , class TN , class TW >
std::vector<TC> tools::histo::histo_data< TC, TO, TN, TW >::m_in_range_plane_Sxyw

Definition at line 183 of file histo_data.

◆ m_in_range_Sw

template<class TC , class TO , class TN , class TW >
TW tools::histo::histo_data< TC, TO, TN, TW >::m_in_range_Sw

Definition at line 188 of file histo_data.

◆ m_in_range_Sw2

template<class TC , class TO , class TN , class TW >
TW tools::histo::histo_data< TC, TO, TN, TW >::m_in_range_Sw2

Definition at line 189 of file histo_data.

◆ m_in_range_Sx2w

template<class TC , class TO , class TN , class TW >
std::vector<TC> tools::histo::histo_data< TC, TO, TN, TW >::m_in_range_Sx2w

Definition at line 191 of file histo_data.

◆ m_in_range_Sxw

template<class TC , class TO , class TN , class TW >
std::vector<TC> tools::histo::histo_data< TC, TO, TN, TW >::m_in_range_Sxw

Definition at line 190 of file histo_data.

◆ m_title

template<class TC , class TO , class TN , class TW >
std::string tools::histo::histo_data< TC, TO, TN, TW >::m_title

Definition at line 171 of file histo_data.


The documentation for this class was generated from the following file:
tools::histo::histo_data::m_in_range_Sw2
TW m_in_range_Sw2
Definition: histo_data:189
tools::histo::histo_data::m_annotations
std::map< std::string, std::string > m_annotations
Definition: histo_data:184
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::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::vecvecs_are_equal
bool vecvecs_are_equal(const VECVEC &a_1, const VECVEC &a_2, const PREC &a_prec, PREC(*a_fabs)(const PREC &))
Definition: eqT:40
tools::histo::histo_data::m_in_range_entries
TN m_in_range_entries
Definition: histo_data:187
tools::vectors_are_equal
bool vectors_are_equal(const VEC &a_1, const VEC &a_2, const PREC &a_prec, PREC(*a_fabs)(const PREC &))
Definition: eqT:23
tools::histo::histo_data::dim_t
unsigned int dim_t
Definition: histo_data:37
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::is_out
bool is_out(const std::vector< axis< TC, TO > > &a_axes, TO a_offset)
Definition: axes:16
tools::histo::histo_data::m_bin_Sxw
std::vector< std::vector< TC > > m_bin_Sxw
Definition: histo_data:178
tools::histo::histo_data::reset_fast_getters
void reset_fast_getters()
Definition: histo_data:93
tools::histo::histo_data::m_axes
std::vector< axis_t > m_axes
Definition: histo_data:181
tools::histo::histo_data::m_bin_Sw2
std::vector< TW > m_bin_Sw2
Definition: histo_data:177
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::numbers_are_equal
bool numbers_are_equal(const NUMBER &a_left, const NUMBER &a_right, const PREC &a_prec, PREC(*a_fabs)(const NUMBER &))
Definition: eqT:10
tools::histo::histo_data::m_bin_number
TO m_bin_number
Definition: histo_data:174
tools::histo::histo_data::m_in_range_plane_Sxyw
std::vector< TC > m_in_range_plane_Sxyw
Definition: histo_data:183
tools::histo::histo_data::m_dimension
dim_t m_dimension
Definition: histo_data:172