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

Public Types

typedef profile_data< TC, TO, TN, TW, TV > pd_t
 
typedef parent::bn_t bn_t
 
typedef std::vector< TV > vs_t
 
- Public Types inherited from tools::histo::b2< TC, TO, TN, TW, TH >
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

bool equals (const p2 &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
 
bool equals_TH (const p2 &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
 
virtual TH bin_error (int aI, int aJ) const
 
bool multiply (TW a_factor)
 
bool scale (TW a_factor)
 
TV bin_Svw (int aI, int aJ) const
 
TV bin_Sv2w (int aI, int aJ) const
 
bool reset ()
 
void copy_from_data (const pd_t &a_from)
 
pd_t get_histo_data () const
 
bool fill (TC aX, TC aY, TV aV, TW aWeight=1)
 
TV bin_rms_value (int aI, int aJ) const
 
bool add (const p2 &a_histo)
 
bool subtract (const p2 &a_histo)
 
bool cut_v () const
 
TV min_v () const
 
TV max_v () const
 
 p2 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax)
 
 p2 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax, TV aVmin, TV aVmax)
 
 p2 (const std::string &a_title, const std::vector< TC > &a_edges_x, const std::vector< TC > &a_edges_y)
 
 p2 (const std::string &a_title, const std::vector< TC > &a_edges_x, const std::vector< TC > &a_edges_y, TV aVmin, TV aVmax)
 
virtual ~p2 ()
 
 p2 (const p2 &a_from)
 
p2operator= (const p2 &a_from)
 
bool configure (bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax)
 
bool configure (const std::vector< TC > &a_edges_x, const std::vector< TC > &a_edges_y)
 
bool configure (bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax, TV aVmin, TV aVmax)
 
bool configure (const std::vector< TC > &a_edges_x, const std::vector< TC > &a_edges_y, TV aVmin, TV aVmax)
 
const vs_tbins_sum_vw () const
 
const vs_tbins_sum_v2w () const
 
TW get_Svw () const
 
TW get_Sv2w () const
 
- Public Member Functions inherited from tools::histo::b2< TC, TO, TN, TW, TH >
TC mean_x () const
 
TC mean_y () const
 
TC rms_x () const
 
TC rms_y () const
 
int coord_to_index_x (TC aCoord) const
 
int coord_to_index_y (TC aCoord) const
 
TN bin_entries (int aI, int aJ) const
 
TW bin_Sw (int aI, int aJ) const
 
TW bin_Sw2 (int aI, int aJ) const
 
TC bin_Sxw (int aI, int aJ) const
 
TC bin_Sx2w (int aI, int aJ) const
 
TC bin_Syw (int aI, int aJ) const
 
TC bin_Sy2w (int aI, int aJ) const
 
TH bin_height (int aI, int aJ) const
 
TC bin_center_x (int aI) const
 
TC bin_center_y (int aJ) const
 
TC bin_mean_x (int aI, int aJ) const
 
TC bin_mean_y (int aI, int aJ) const
 
TC bin_rms_x (int aI, int aJ) const
 
TC bin_rms_y (int aI, int aJ) const
 
const axis_taxis_x () const
 
const axis_taxis_y () const
 
axis_taxis_x ()
 
axis_taxis_y ()
 
TN bin_entries_x (int aI) const
 
TW bin_height_x (int aI) const
 
TN bin_entries_y (int aJ) const
 
TW bin_height_y (int aJ) const
 
TC Sxyw () const
 
void hprint (std::ostream &a_out)
 
bool configure (bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax)
 
bool configure (const std::vector< TC > &a_edges_x, const std::vector< TC > &a_edges_y)
 
- 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 Member Functions

virtual TH get_bin_height (TO a_offset) const
 
- Protected Member Functions inherited from tools::histo::b2< TC, TO, TN, TW, TH >
 b2 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax)
 
 b2 (const std::string &a_title, const std::vector< TC > &a_edges_x, const std::vector< TC > &a_edges_y)
 
virtual ~b2 ()
 
 b2 (const b2 &a_from)
 
b2operator= (const b2 &a_from)
 
bool _find_offset (int aI, int aJ, TO &a_offset) const
 
- Protected Member Functions inherited from tools::histo::base_histo< TC, TO, TN, TW, TH >
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
 

Protected Attributes

bool m_cut_v
 
TV m_min_v
 
TV m_max_v
 
vs_t m_bin_Svw
 
vs_t m_bin_Sv2w
 
- 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
 

Additional Inherited Members

- Protected Types inherited from tools::histo::b2< TC, TO, TN, TW, TH >
enum  { AxisX =0, AxisY =1 }
 
- 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
 

Detailed Description

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

Definition at line 14 of file p2.

Member Typedef Documentation

◆ bn_t

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

Definition at line 18 of file p2.

◆ pd_t

template<class TC , class TO , class TN , class TW , class TH , class TV >
typedef profile_data<TC,TO,TN,TW,TV> tools::histo::p2< TC, TO, TN, TW, TH, TV >::pd_t

Definition at line 17 of file p2.

◆ vs_t

template<class TC , class TO , class TN , class TW , class TH , class TV >
typedef std::vector<TV> tools::histo::p2< TC, TO, TN, TW, TH, TV >::vs_t

Definition at line 19 of file p2.

Constructor & Destructor Documentation

◆ p2() [1/5]

template<class TC , class TO , class TN , class TW , class TH , class TV >
tools::histo::p2< TC, TO, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
bn_t  aXnumber,
TC  aXmin,
TC  aXmax,
bn_t  aYnumber,
TC  aYmin,
TC  aYmax 
)
inline

Definition at line 212 of file p2.

215  :parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
216  ,m_cut_v(false)
217  ,m_min_v(0)
218  ,m_max_v(0)
219  {
222  }

◆ p2() [2/5]

template<class TC , class TO , class TN , class TW , class TH , class TV >
tools::histo::p2< TC, TO, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
bn_t  aXnumber,
TC  aXmin,
TC  aXmax,
bn_t  aYnumber,
TC  aYmin,
TC  aYmax,
TV  aVmin,
TV  aVmax 
)
inline

Definition at line 224 of file p2.

228  :parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
229  ,m_cut_v(true)
230  ,m_min_v(aVmin)
231  ,m_max_v(aVmax)
232  {
235  }

◆ p2() [3/5]

template<class TC , class TO , class TN , class TW , class TH , class TV >
tools::histo::p2< TC, TO, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
const std::vector< TC > &  a_edges_x,
const std::vector< TC > &  a_edges_y 
)
inline

Definition at line 237 of file p2.

240  :parent(a_title,a_edges_x,a_edges_y)
241  ,m_cut_v(false)
242  ,m_min_v(0)
243  ,m_max_v(0)
244  {
247  }

◆ p2() [4/5]

template<class TC , class TO , class TN , class TW , class TH , class TV >
tools::histo::p2< TC, TO, TN, TW, TH, TV >::p2 ( const std::string &  a_title,
const std::vector< TC > &  a_edges_x,
const std::vector< TC > &  a_edges_y,
TV  aVmin,
TV  aVmax 
)
inline

Definition at line 249 of file p2.

253  :parent(a_title,a_edges_x,a_edges_y)
254  ,m_cut_v(true)
255  ,m_min_v(aVmin)
256  ,m_max_v(aVmax)
257  {
260  }

◆ ~p2()

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

Definition at line 262 of file p2.

262 {}

◆ p2() [5/5]

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

Definition at line 264 of file p2.

265  :parent(a_from)
266  ,m_cut_v(a_from.m_cut_v)
267  ,m_min_v(a_from.m_min_v)
268  ,m_max_v(a_from.m_max_v)
269  ,m_bin_Svw(a_from.m_bin_Svw)
270  ,m_bin_Sv2w(a_from.m_bin_Sv2w)
271  {}

Member Function Documentation

◆ add()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::add ( const p2< TC, TO, TN, TW, TH, TV > &  a_histo)
inline

Definition at line 191 of file p2.

191  {
192  parent::base_add(a_histo);
193  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
194  m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
195  m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
196  }
197  return true;
198  }

◆ bin_error()

template<class TC , class TO , class TN , class TW , class TH , class TV >
virtual TH tools::histo::p2< TC, TO, TN, TW, TH, TV >::bin_error ( int  aI,
int  aJ 
) const
inlinevirtual

Implements tools::histo::b2< TC, TO, TN, TW, TH >.

Definition at line 44 of file p2.

44  { //TH should be the same as TV
45  TO offset;
46  if(!parent::_find_offset(aI,aJ,offset)) return 0;
47 
48  //FIXME Is it correct ?
49  // TProfile::GetBinError with kERRORMEAN mode does :
50  // Stat_t cont = fArray[bin]; //Svw (see TProfile::Fill)
51  // Stat_t sum = parent::m_bin_entries.fArray[bin]; //Sw
52  // Stat_t err2 = fSumw2.fArray[bin]; //Sv2w
53  // if (sum == 0) return 0;
54  // Stat_t eprim;
55  // Stat_t contsum = cont/sum;
56  // Stat_t eprim2 = TMath::Abs(err2/sum - contsum*contsum);
57  // eprim = TMath::Sqrt(eprim2);
58  // ... ???
59  // if (fErrorMode == kERRORMEAN) return eprim/TMath::Sqrt(sum);
60 
61  TW sw = parent::m_bin_Sw[offset]; //ROOT sum
62  if(sw==0) return 0;
63  TV svw = m_bin_Svw[offset]; //ROOT cont
64  TV sv2w = m_bin_Sv2w[offset]; //ROOT err2
65  TV mean = (svw / sw); //ROOT contsum
66  TV rms = ::sqrt(::fabs((sv2w/sw) - mean * mean)); //ROOT eprim
67  // rms = get_bin_rms_value.
68  return rms/::sqrt(sw); //ROOT kERRORMEAN mode returned value
69  }

◆ bin_rms_value()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::bin_rms_value ( int  aI,
int  aJ 
) const
inline

Definition at line 179 of file p2.

179  {
180  TO offset;
181  if(!parent::_find_offset(aI,aJ,offset)) return 0;
182 
183  TW sw = parent::m_bin_Sw[offset];
184  if(sw==0) return 0;
185  TV svw = m_bin_Svw[offset];
186  TV sv2w = m_bin_Sv2w[offset];
187  TV mean = (svw / sw);
188  return ::sqrt(::fabs((sv2w / sw) - mean * mean));
189  }

◆ bin_Sv2w()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::bin_Sv2w ( int  aI,
int  aJ 
) const
inline

Definition at line 86 of file p2.

86  {
87  TO offset;
88  if(!parent::_find_offset(aI,aJ,offset)) return 0;
89  return m_bin_Sv2w[offset];
90  }

◆ bin_Svw()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::bin_Svw ( int  aI,
int  aJ 
) const
inline

Definition at line 81 of file p2.

81  {
82  TO offset;
83  if(!parent::_find_offset(aI,aJ,offset)) return 0;
84  return m_bin_Svw[offset];
85  }

◆ bins_sum_v2w()

template<class TC , class TO , class TN , class TW , class TH , class TV >
const vs_t& tools::histo::p2< TC, TO, TN, TW, TH, TV >::bins_sum_v2w ( ) const
inline

Definition at line 328 of file p2.

328 {return m_bin_Sv2w;}

◆ bins_sum_vw()

template<class TC , class TO , class TN , class TW , class TH , class TV >
const vs_t& tools::histo::p2< TC, TO, TN, TW, TH, TV >::bins_sum_vw ( ) const
inline

Definition at line 327 of file p2.

327 {return m_bin_Svw;}

◆ configure() [1/4]

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::configure ( bn_t  aXnumber,
TC  aXmin,
TC  aXmax,
bn_t  aYnumber,
TC  aYmin,
TC  aYmax 
)
inline

Definition at line 282 of file p2.

282  {
283  if(!parent::configure(aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)) return false;
284  m_bin_Svw.clear();
285  m_bin_Sv2w.clear();
288  m_cut_v = false;
289  m_min_v = 0;
290  m_max_v = 0;
291  return true;
292  }

◆ configure() [2/4]

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::configure ( bn_t  aXnumber,
TC  aXmin,
TC  aXmax,
bn_t  aYnumber,
TC  aYmin,
TC  aYmax,
TV  aVmin,
TV  aVmax 
)
inline

Definition at line 304 of file p2.

304  {
305  if(!parent::configure(aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)) return false;
306  m_bin_Svw.clear();
307  m_bin_Sv2w.clear();
310  m_cut_v = true;
311  m_min_v = aVmin;
312  m_max_v = aVmax;
313  return true;
314  }

◆ configure() [3/4]

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::configure ( const std::vector< TC > &  a_edges_x,
const std::vector< TC > &  a_edges_y 
)
inline

Definition at line 293 of file p2.

293  {
294  if(!parent::configure(a_edges_x,a_edges_y)) return false;
295  m_bin_Svw.clear();
296  m_bin_Sv2w.clear();
299  m_cut_v = false;
300  m_min_v = 0;
301  m_max_v = 0;
302  return true;
303  }

◆ configure() [4/4]

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::configure ( const std::vector< TC > &  a_edges_x,
const std::vector< TC > &  a_edges_y,
TV  aVmin,
TV  aVmax 
)
inline

Definition at line 315 of file p2.

315  {
316  if(!parent::configure(a_edges_x,a_edges_y)) return false;
317  m_bin_Svw.clear();
318  m_bin_Sv2w.clear();
321  m_cut_v = true;
322  m_min_v = aVmin;
323  m_max_v = aVmax;
324  return true;
325  }

◆ copy_from_data()

template<class TC , class TO , class TN , class TW , class TH , class TV >
void tools::histo::p2< TC, TO, TN, TW, TH, TV >::copy_from_data ( const pd_t a_from)
inline

Definition at line 101 of file p2.

101  {
102  parent::base_from_data(a_from);
103  m_bin_Svw = a_from.m_bin_Svw;
104  m_bin_Sv2w = a_from.m_bin_Sv2w;
105  m_cut_v = a_from.m_cut_v;
106  m_min_v = a_from.m_min_v;
107  m_max_v = a_from.m_max_v;
108  }

◆ cut_v()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::cut_v ( ) const
inline

Definition at line 208 of file p2.

208 {return m_cut_v;}

◆ equals()

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

Definition at line 25 of file p2.

25  {
26  if(!parent::equals(a_from,a_prec,a_fabs)) return false;
27  if(m_cut_v!=a_from.m_cut_v) return false;
28  if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
29  if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
30  if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
31  if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
32  return true;
33  }

◆ equals_TH()

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

Definition at line 34 of file p2.

34  {
35  if(!parent::equals_TH(a_from,a_prec,a_fabs,false)) return false;
36  if(m_cut_v!=a_from.m_cut_v) return false;
37  if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
38  if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
39  if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
40  if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
41  return true;
42  }

◆ fill()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::fill ( TC  aX,
TC  aY,
TV  aV,
TW  aWeight = 1 
)
inline

Definition at line 120 of file p2.

120  {
121  if(parent::m_dimension!=2) return false;
122 
123  if(m_cut_v) {
124  if( (aV<m_min_v) || (aV>=m_max_v) ) {
125  return true;
126  }
127  }
128 
129  bn_t ibin,jbin;
130  if(!parent::m_axes[0].coord_to_absolute_index(aX,ibin)) return false;
131  if(!parent::m_axes[1].coord_to_absolute_index(aY,jbin)) return false;
132  bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
133 
134  parent::m_bin_entries[offset]++;
135  parent::m_bin_Sw[offset] += aWeight;
136  parent::m_bin_Sw2[offset] += aWeight * aWeight;
137 
138  TC xw = aX * aWeight;
139  TC x2w = aX * xw;
140  parent::m_bin_Sxw[offset][0] += xw;
141  parent::m_bin_Sx2w[offset][0] += x2w;
142 
143  TC yw = aY * aWeight;
144  TC y2w = aY * yw;
145  parent::m_bin_Sxw[offset][1] += yw;
146  parent::m_bin_Sx2w[offset][1] += y2w;
147 
148  bool inRange = true;
149  if(ibin==0) inRange = false;
150  else if(ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
151 
152  if(jbin==0) inRange = false;
153  else if(jbin==(parent::m_axes[1].m_number_of_bins+1)) inRange = false;
154 
156  if(inRange) {
157  parent::m_in_range_plane_Sxyw[0] += aX * aY * aWeight;
158 
159  // fast getters :
161  parent::m_in_range_Sw += aWeight;
162  parent::m_in_range_Sw2 += aWeight*aWeight;
163 
164  parent::m_in_range_Sxw[0] += xw;
165  parent::m_in_range_Sx2w[0] += x2w;
166 
167  parent::m_in_range_Sxw[1] += yw;
168  parent::m_in_range_Sx2w[1] += y2w;
169  }
170 
171  // Profile part :
172  TV vw = aV * aWeight;
173  m_bin_Svw[offset] += vw;
174  m_bin_Sv2w[offset] += aV * vw;
175 
176  return true;
177  }

◆ get_bin_height()

template<class TC , class TO , class TN , class TW , class TH , class TV >
virtual TH tools::histo::p2< TC, TO, TN, TW, TH, TV >::get_bin_height ( TO  a_offset) const
inlineprotectedvirtual

Implements tools::histo::base_histo< TC, TO, TN, TW, TH >.

Definition at line 21 of file p2.

21  {
22  return (parent::m_bin_Sw[a_offset] ? (m_bin_Svw[a_offset]/parent::m_bin_Sw[a_offset]):0);
23  }

◆ get_histo_data()

template<class TC , class TO , class TN , class TW , class TH , class TV >
pd_t tools::histo::p2< TC, TO, TN, TW, TH, TV >::get_histo_data ( ) const
inline

Definition at line 109 of file p2.

109  {
110  pd_t hd(parent::dac());
111  hd.m_is_profile = true;
112  hd.m_bin_Svw = m_bin_Svw;
113  hd.m_bin_Sv2w = m_bin_Sv2w;
114  hd.m_cut_v = m_cut_v;
115  hd.m_min_v = m_min_v;
116  hd.m_max_v = m_max_v;
117  return hd;
118  }

◆ get_Sv2w()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TW tools::histo::p2< TC, TO, TN, TW, TH, TV >::get_Sv2w ( ) const
inline

Definition at line 339 of file p2.

339  {
340  TW sw = 0;
341  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
342  if(!histo::is_out(parent::m_axes,ibin)) {
343  sw += m_bin_Sv2w[ibin];
344  }
345  }
346  return sw;
347  }

◆ get_Svw()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TW tools::histo::p2< TC, TO, TN, TW, TH, TV >::get_Svw ( ) const
inline

Definition at line 330 of file p2.

330  {
331  TW sw = 0;
332  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
333  if(!histo::is_out(parent::m_axes,ibin)) {
334  sw += m_bin_Svw[ibin];
335  }
336  }
337  return sw;
338  }

◆ max_v()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::max_v ( ) const
inline

Definition at line 210 of file p2.

210 {return m_max_v;}

◆ min_v()

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::min_v ( ) const
inline

Definition at line 209 of file p2.

209 {return m_min_v;}

◆ multiply()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::multiply ( TW  a_factor)
inline

Definition at line 72 of file p2.

72  {
73  if(!parent::base_multiply(a_factor)) return false;
74  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
75  m_bin_Svw[ibin] *= a_factor;
76  }
77  return true;
78  }

◆ operator=()

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

Definition at line 272 of file p2.

272  {
273  parent::operator=(a_from);
274  m_cut_v = a_from.m_cut_v;
275  m_min_v = a_from.m_min_v;
276  m_max_v = a_from.m_max_v;
277  m_bin_Svw = a_from.m_bin_Svw;
278  m_bin_Sv2w = a_from.m_bin_Sv2w;
279  return *this;
280  }

◆ reset()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::reset ( )
inline

Definition at line 92 of file p2.

92  {
94  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
95  m_bin_Svw[ibin] = 0;
96  m_bin_Sv2w[ibin] = 0;
97  }
98  return true;
99  }

◆ scale()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::scale ( TW  a_factor)
inline

Definition at line 79 of file p2.

79 {return multiply(a_factor);}

◆ subtract()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::subtract ( const p2< TC, TO, TN, TW, TH, TV > &  a_histo)
inline

Definition at line 199 of file p2.

199  {
200  parent::base_subtract(a_histo);
201  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
202  m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
203  m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
204  }
205  return true;
206  }

Member Data Documentation

◆ m_bin_Sv2w

template<class TC , class TO , class TN , class TW , class TH , class TV >
vs_t tools::histo::p2< TC, TO, TN, TW, TH, TV >::m_bin_Sv2w
protected

Definition at line 353 of file p2.

◆ m_bin_Svw

template<class TC , class TO , class TN , class TW , class TH , class TV >
vs_t tools::histo::p2< TC, TO, TN, TW, TH, TV >::m_bin_Svw
protected

Definition at line 352 of file p2.

◆ m_cut_v

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p2< TC, TO, TN, TW, TH, TV >::m_cut_v
protected

Definition at line 349 of file p2.

◆ m_max_v

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::m_max_v
protected

Definition at line 351 of file p2.

◆ m_min_v

template<class TC , class TO , class TN , class TW , class TH , class TV >
TV tools::histo::p2< TC, TO, TN, TW, TH, TV >::m_min_v
protected

Definition at line 350 of file p2.


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::p2::m_min_v
TV m_min_v
Definition: p2:350
tools::histo::p2::m_bin_Svw
vs_t m_bin_Svw
Definition: p2:352
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::p2::m_max_v
TV m_max_v
Definition: p2:351
tools::histo::base_histo::dac
const hd_t & dac() const
Definition: base_histo:56
tools::histo::p2::m_cut_v
bool m_cut_v
Definition: p2:349
tools::histo::b2::operator=
b2 & operator=(const b2 &a_from)
Definition: b2:317
tools::histo::histo_data::m_bin_entries
std::vector< TN > m_bin_entries
Definition: histo_data:175
tools::histo::p2::m_bin_Sv2w
vs_t m_bin_Sv2w
Definition: p2:353
tools::histo::base_histo::base_add
void base_add(const base_histo &a_histo)
Definition: base_histo:476
tools::histo::histo_data::m_bin_Sw
std::vector< TW > m_bin_Sw
Definition: histo_data:176
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::base_histo::base_subtract
void base_subtract(const base_histo &a_histo)
Definition: base_histo:493
tools::histo::histo_data::m_in_range_Sx2w
std::vector< TC > m_in_range_Sx2w
Definition: histo_data:191
tools::histo::is_out
bool is_out(const std::vector< axis< TC, TO > > &a_axes, TO a_offset)
Definition: axes:16
tools::histo::p2::multiply
bool multiply(TW a_factor)
Definition: p2:72
tools::histo::base_histo::base_from_data
void base_from_data(const hd_t &a_from)
Definition: base_histo:47
tools::histo::histo_data::m_bin_Sxw
std::vector< std::vector< TC > > m_bin_Sxw
Definition: histo_data:178
tools::histo::b2::configure
bool configure(bn_t aXnumber, TC aXmin, TC aXmax, bn_t aYnumber, TC aYmin, TC aYmax)
Definition: b2:319
tools::histo::histo_data::m_axes
std::vector< axis_t > m_axes
Definition: histo_data:181
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::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::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::p2::bn_t
parent::bn_t bn_t
Definition: p2:18
tools::histo::b2::_find_offset
bool _find_offset(int aI, int aJ, TO &a_offset) const
Definition: b2:340
tools::histo::histo_data::m_bin_number
TO m_bin_number
Definition: histo_data:174
tools::histo::p2::pd_t
profile_data< TC, TO, TN, TW, TV > pd_t
Definition: p2:17
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
tools::histo::histo_data::equals_TH
bool equals_TH(const histo_data &a_from, const TW &a_prec, TW(*a_fabs)(TW), bool a_cmp_bin_Sw2) const
Definition: histo_data:144
tools::histo::base_histo::base_multiply
bool base_multiply(const base_histo &a_histo)
Definition: base_histo:513