g4tools  5.4.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::histo::p1< TC, TO, TN, TW, TH, TV > Class Template Reference
Inheritance diagram for tools::histo::p1< TC, TO, TN, TW, TH, TV >:
Inheritance graph
[legend]
Collaboration diagram for tools::histo::p1< 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 parent::axis_t axis_t
 
typedef std::vector< TV > vs_t
 
- Public Types inherited from tools::histo::b1< 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 p1 &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
 
bool equals_TH (const p1 &a_from, const TW &a_prec, TW(*a_fabs)(TW)) const
 
virtual TH bin_error (int aI) const
 
bool multiply (TW a_factor)
 
bool scale (TW a_factor)
 
TV bin_Svw (int aI) const
 
TV bin_Sv2w (int aI) const
 
bool reset ()
 
void copy_from_data (const pd_t &a_from)
 
pd_t get_histo_data () const
 
bool fill (TC aX, TV aV, TW aWeight=1)
 
bool set_bin_content (bn_t a_ibin, TN a_entries, TW a_Sw, TW a_Sw2, TC a_Sxw, TC a_Sx2w, TC a_Svw, TC a_Sv2w)
 
bool get_bin_content (bn_t a_ibin, TN &a_entries, TW &a_Sw, TW &a_Sw2, TC &a_Sxw, TC &a_Sx2w, TC &a_Svw, TC &a_Sv2w)
 
TV bin_rms_value (int aI) const
 
bool add (const p1 &a_histo)
 
bool subtract (const p1 &a_histo)
 
bool gather_bins (unsigned int a_factor)
 
bool cut_v () const
 
TV min_v () const
 
TV max_v () const
 
 p1 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax)
 
 p1 (const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax, TV aVmin, TV aVmax)
 
 p1 (const std::string &a_title, const std::vector< TC > &a_edges)
 
 p1 (const std::string &a_title, const std::vector< TC > &a_edges, TV aVmin, TV aVmax)
 
virtual ~p1 ()
 
 p1 (const p1 &a_from)
 
p1operator= (const p1 &a_from)
 
bool configure (bn_t aXnumber, TC aXmin, TC aXmax)
 
bool configure (const std::vector< TC > &a_edges)
 
bool configure (bn_t aXnumber, TC aXmin, TC aXmax, TV aVmin, TV aVmax)
 
bool configure (const std::vector< TC > &a_edges, 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::b1< TC, TO, TN, TW, TH >
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 Member Functions

virtual TH get_bin_height (TO a_offset) const
 
- Protected Member Functions inherited from tools::histo::b1< TC, TO, TN, TW, TH >
 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 >
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::b1< TC, TO, TN, TW, TH >
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
 

Detailed Description

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

Definition at line 21 of file p1.

Member Typedef Documentation

◆ axis_t

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

Definition at line 26 of file p1.

◆ bn_t

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

Definition at line 25 of file p1.

◆ 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::p1< TC, TO, TN, TW, TH, TV >::pd_t

Definition at line 24 of file p1.

◆ vs_t

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

Definition at line 27 of file p1.

Constructor & Destructor Documentation

◆ p1() [1/5]

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

Definition at line 349 of file p1.

350  :parent(a_title,aXnumber,aXmin,aXmax)
351  ,m_cut_v(false)
352  ,m_min_v(0)
353  ,m_max_v(0)
354  {
357  }

◆ p1() [2/5]

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

Definition at line 359 of file p1.

360  :parent(a_title,aXnumber,aXmin,aXmax)
361  ,m_cut_v(true)
362  ,m_min_v(aVmin)
363  ,m_max_v(aVmax)
364  {
367  }

◆ p1() [3/5]

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

Definition at line 369 of file p1.

370  :parent(a_title,a_edges)
371  ,m_cut_v(false)
372  ,m_min_v(0)
373  ,m_max_v(0)
374  {
377  }

◆ p1() [4/5]

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

Definition at line 379 of file p1.

380  :parent(a_title,a_edges)
381  ,m_cut_v(true)
382  ,m_min_v(aVmin)
383  ,m_max_v(aVmax)
384  {
387  }

◆ ~p1()

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

Definition at line 389 of file p1.

389 {}

◆ p1() [5/5]

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

Definition at line 391 of file p1.

392  :parent(a_from)
393  ,m_cut_v(a_from.m_cut_v)
394  ,m_min_v(a_from.m_min_v)
395  ,m_max_v(a_from.m_max_v)
396  ,m_bin_Svw(a_from.m_bin_Svw)
397  ,m_bin_Sv2w(a_from.m_bin_Sv2w)
398  {}

Member Function Documentation

◆ add()

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

Definition at line 253 of file p1.

253  {
254  parent::base_add(a_histo);
255  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
256  m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
257  m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
258  }
259  return true;
260  }

◆ bin_error()

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

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

Definition at line 52 of file p1.

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

◆ bin_rms_value()

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

Definition at line 242 of file p1.

242  {
243  TO offset;
244  if(!parent::_find_offset(aI,offset)) return 0;
245  TW sw = parent::m_bin_Sw[offset];
246  if(sw==0) return 0;
247  TV svw = m_bin_Svw[offset];
248  TV sv2w = m_bin_Sv2w[offset];
249  TV _mean = (svw / sw);
250  return ::sqrt(::fabs((sv2w / sw) - _mean * _mean));
251  }

◆ bin_Sv2w()

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

Definition at line 94 of file p1.

94  {
95  TO offset;
96  if(!parent::_find_offset(aI,offset)) return 0;
97  return m_bin_Sv2w[offset];
98  }

◆ bin_Svw()

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

Definition at line 89 of file p1.

89  {
90  TO offset;
91  if(!parent::_find_offset(aI,offset)) return 0;
92  return m_bin_Svw[offset];
93  }

◆ bins_sum_v2w()

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

Definition at line 455 of file p1.

455 {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::p1< TC, TO, TN, TW, TH, TV >::bins_sum_vw ( ) const
inline

Definition at line 454 of file p1.

454 {return m_bin_Svw;}

◆ configure() [1/4]

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

Definition at line 409 of file p1.

409  {
410  if(!parent::configure(aXnumber,aXmin,aXmax)) return false;
411  m_bin_Svw.clear();
412  m_bin_Sv2w.clear();
415  m_cut_v = false;
416  m_min_v = 0;
417  m_max_v = 0;
418  return true;
419  }

◆ configure() [2/4]

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

Definition at line 431 of file p1.

431  {
432  if(!parent::configure(aXnumber,aXmin,aXmax)) return false;
433  m_bin_Svw.clear();
434  m_bin_Sv2w.clear();
437  m_cut_v = true;
438  m_min_v = aVmin;
439  m_max_v = aVmax;
440  return true;
441  }

◆ configure() [3/4]

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

Definition at line 420 of file p1.

420  {
421  if(!parent::configure(a_edges)) return false;
422  m_bin_Svw.clear();
423  m_bin_Sv2w.clear();
426  m_cut_v = false;
427  m_min_v = 0;
428  m_max_v = 0;
429  return true;
430  }

◆ configure() [4/4]

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

Definition at line 442 of file p1.

442  {
443  if(!parent::configure(a_edges)) return false;
444  m_bin_Svw.clear();
445  m_bin_Sv2w.clear();
448  m_cut_v = true;
449  m_min_v = aVmin;
450  m_max_v = aVmax;
451  return true;
452  }

◆ copy_from_data()

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

Definition at line 109 of file p1.

109  {
110  parent::base_from_data(a_from);
111  m_bin_Svw = a_from.m_bin_Svw;
112  m_bin_Sv2w = a_from.m_bin_Sv2w;
113  m_cut_v = a_from.m_cut_v;
114  m_min_v = a_from.m_min_v;
115  m_max_v = a_from.m_max_v;
116  }

◆ cut_v()

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

Definition at line 344 of file p1.

344 {return m_cut_v;}

◆ equals()

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

Definition at line 33 of file p1.

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

◆ equals_TH()

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

Definition at line 42 of file p1.

42  {
43  if(!parent::equals_TH(a_from,a_prec,a_fabs,false)) return false;
44  if(m_cut_v!=a_from.m_cut_v) return false;
45  if(!numbers_are_equal(m_min_v,a_from.m_min_v,a_prec,a_fabs)) return false;
46  if(!numbers_are_equal(m_max_v,a_from.m_max_v,a_prec,a_fabs)) return false;
47  if(!vectors_are_equal(m_bin_Svw,a_from.m_bin_Svw,a_prec,a_fabs)) return false;
48  if(!vectors_are_equal(m_bin_Sv2w,a_from.m_bin_Sv2w,a_prec,a_fabs)) return false;
49  return true;
50  }

◆ fill()

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

Definition at line 128 of file p1.

128  {
129  if(parent::m_dimension!=1) return false;
130 
131  if(m_cut_v) {
132  if( (aV<m_min_v) || (aV>=m_max_v) ) {
133  return true;
134  }
135  }
136 
137  bn_t ibin;
138  if(!parent::m_axes[0].coord_to_absolute_index(aX,ibin)) return false;
139  TO offset = ibin;
140 
141  parent::m_bin_entries[offset]++;
142  parent::m_bin_Sw[offset] += aWeight;
143  parent::m_bin_Sw2[offset] += aWeight * aWeight;
144 
145  TC xw = aX * aWeight;
146  TC x2w = aX * xw;
147  parent::m_bin_Sxw[offset][0] += xw;
148  parent::m_bin_Sx2w[offset][0] += x2w;
149 
150  bool inRange = true;
151  if(ibin==0) inRange = false;
152  else if(ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
153 
155  if(inRange) {
156  // fast getters :
158  parent::m_in_range_Sw += aWeight;
159  parent::m_in_range_Sw2 += aWeight*aWeight;
160 
161  parent::m_in_range_Sxw[0] += xw;
162  parent::m_in_range_Sx2w[0] += x2w;
163  }
164 
165  // Profile part :
166  TV vw = aV * aWeight;
167  m_bin_Svw[offset] += vw;
168  m_bin_Sv2w[offset] += aV * vw;
169 
170  return true;
171  }

◆ gather_bins()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p1< TC, TO, TN, TW, TH, TV >::gather_bins ( unsigned int  a_factor)
inline

Definition at line 270 of file p1.

270  { //for exa 2,3.
271  if(!a_factor) return false;
272 
273  // actual bin number must be a multiple of a_factor.
274 
275  const axis_t& _axis = parent::axis();
276 
277  bn_t n = _axis.bins();
278  if(!n) return false;
279 
280  bn_t new_n = n/a_factor;
281  if(a_factor*new_n!=n) return false;
282 
283  p1* new_h = 0;
284  if(_axis.is_fixed_binning()) {
285  new_h = new p1(parent::m_title,new_n,_axis.lower_edge(),_axis.upper_edge());
286  } else {
287  const std::vector<TC>& _edges = _axis.edges();
288  std::vector<TC> new_edges(new_n+1);
289  for(bn_t ibin=0;ibin<new_n;ibin++) {
290  new_edges[ibin] = _edges[ibin*a_factor];
291  }
292  new_edges[new_n] = _edges[n]; //upper edge.
293  new_h = new p1(parent::m_title,new_edges);
294  }
295  if(!new_h) return false;
296 
297  new_h->m_cut_v = m_cut_v;
298  new_h->m_min_v = m_min_v;
299  new_h->m_max_v = m_max_v;
300 
301  bn_t offset,new_offset,offac;
302  for(bn_t ibin=0;ibin<new_n;ibin++) {
303  new_offset = ibin+1;
304  offset = a_factor*ibin+1;
305  for(unsigned int ifac=0;ifac<a_factor;ifac++) {
306  offac = offset+ifac;
307  new_h->m_bin_entries[new_offset] += parent::m_bin_entries[offac];
308  new_h->m_bin_Sw[new_offset] += parent::m_bin_Sw[offac];
309  new_h->m_bin_Sw2[new_offset] += parent::m_bin_Sw2[offac];
310  new_h->m_bin_Sxw[new_offset][0] += parent::m_bin_Sxw[offac][0];
311  new_h->m_bin_Sx2w[new_offset][0] += parent::m_bin_Sx2w[offac][0];
312 
313  new_h->m_bin_Svw[new_offset] += m_bin_Svw[offac];
314  new_h->m_bin_Sv2w[new_offset] += m_bin_Sv2w[offac];
315  }
316  }
317 
318  //underflow :
319  new_offset = 0;
320  offac = 0;
321  new_h->m_bin_entries[new_offset] = parent::m_bin_entries[offac];
322  new_h->m_bin_Sw[new_offset] = parent::m_bin_Sw[offac];
323  new_h->m_bin_Sw2[new_offset] = parent::m_bin_Sw2[offac];
324  new_h->m_bin_Sxw[new_offset][0] = parent::m_bin_Sxw[offac][0];
325  new_h->m_bin_Sx2w[new_offset][0] = parent::m_bin_Sx2w[offac][0];
326  new_h->m_bin_Svw[new_offset] = m_bin_Svw[offac];
327  new_h->m_bin_Sv2w[new_offset] = m_bin_Sv2w[offac];
328 
329  //overflow :
330  new_offset = new_n+1;
331  offac = n+1;
332  new_h->m_bin_entries[new_offset] = parent::m_bin_entries[offac];
333  new_h->m_bin_Sw[new_offset] = parent::m_bin_Sw[offac];
334  new_h->m_bin_Sw2[new_offset] = parent::m_bin_Sw2[offac];
335  new_h->m_bin_Sxw[new_offset][0] = parent::m_bin_Sxw[offac][0];
336  new_h->m_bin_Sx2w[new_offset][0] = parent::m_bin_Sx2w[offac][0];
337  new_h->m_bin_Svw[new_offset] = m_bin_Svw[offac];
338  new_h->m_bin_Sv2w[new_offset] = m_bin_Sv2w[offac];
339 
340  *this = *new_h;
341  return true;
342  }

◆ get_bin_content()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p1< TC, TO, TN, TW, TH, TV >::get_bin_content ( bn_t  a_ibin,
TN &  a_entries,
TW &  a_Sw,
TW &  a_Sw2,
TC &  a_Sxw,
TC &  a_Sx2w,
TC &  a_Svw,
TC &  a_Sv2w 
)
inline

Definition at line 216 of file p1.

216  {
217  if(parent::m_dimension!=1) {
218  a_entries = 0;a_Sw = 0;a_Sw2 = 0;a_Sxw = 0;a_Sx2w = 0;
219  return false;
220  }
221  if(a_ibin>(parent::m_axes[0].m_number_of_bins+1)) {
222  a_entries = 0;a_Sw = 0;a_Sw2 = 0;a_Sxw = 0;a_Sx2w = 0;
223  return false;
224  }
225 
226  TO offset = a_ibin;
227 
228  a_entries = parent::m_bin_entries[offset];
229  a_Sw = parent::m_bin_Sw[offset];
230  a_Sw2 = parent::m_bin_Sw2[offset];
231 
232  a_Sxw = parent::m_bin_Sxw[offset][0];
233  a_Sx2w = parent::m_bin_Sx2w[offset][0];
234 
235  // Profile part :
236  a_Svw = m_bin_Svw[offset];
237  a_Sv2w = m_bin_Sv2w[offset];
238 
239  return true;
240  }

◆ get_bin_height()

template<class TC , class TO , class TN , class TW , class TH , class TV >
virtual TH tools::histo::p1< 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 29 of file p1.

29  {
30  return (parent::m_bin_Sw[a_offset] ? (m_bin_Svw[a_offset]/parent::m_bin_Sw[a_offset]):0);
31  }

◆ get_histo_data()

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

Definition at line 117 of file p1.

117  {
118  pd_t hd(parent::dac());
119  hd.m_is_profile = true;
120  hd.m_bin_Svw = m_bin_Svw;
121  hd.m_bin_Sv2w = m_bin_Sv2w;
122  hd.m_cut_v = m_cut_v;
123  hd.m_min_v = m_min_v;
124  hd.m_max_v = m_max_v;
125  return hd;
126  }

◆ get_Sv2w()

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

Definition at line 466 of file p1.

466  {
467  TW sw = 0;
468  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
469  if(!histo::is_out(parent::m_axes,ibin)) {
470  sw += m_bin_Sv2w[ibin];
471  }
472  }
473  return sw;
474  }

◆ get_Svw()

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

Definition at line 457 of file p1.

457  {
458  TW sw = 0;
459  for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
460  if(!histo::is_out(parent::m_axes,ibin)) {
461  sw += m_bin_Svw[ibin];
462  }
463  }
464  return sw;
465  }

◆ max_v()

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

Definition at line 346 of file p1.

346 {return m_max_v;}

◆ min_v()

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

Definition at line 345 of file p1.

345 {return m_min_v;}

◆ multiply()

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

Definition at line 80 of file p1.

80  {
81  if(!parent::base_multiply(a_factor)) return false;
82  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
83  m_bin_Svw[ibin] *= a_factor;
84  }
85  return true;
86  }

◆ operator=()

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

Definition at line 399 of file p1.

399  {
400  parent::operator=(a_from);
401  m_cut_v = a_from.m_cut_v;
402  m_min_v = a_from.m_min_v;
403  m_max_v = a_from.m_max_v;
404  m_bin_Svw = a_from.m_bin_Svw;
405  m_bin_Sv2w = a_from.m_bin_Sv2w;
406  return *this;
407  }

◆ reset()

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

Definition at line 100 of file p1.

100  {
102  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
103  m_bin_Svw[ibin] = 0;
104  m_bin_Sv2w[ibin] = 0;
105  }
106  return true;
107  }

◆ scale()

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

Definition at line 87 of file p1.

87 {return multiply(a_factor);}

◆ set_bin_content()

template<class TC , class TO , class TN , class TW , class TH , class TV >
bool tools::histo::p1< TC, TO, TN, TW, TH, TV >::set_bin_content ( bn_t  a_ibin,
TN  a_entries,
TW  a_Sw,
TW  a_Sw2,
TC  a_Sxw,
TC  a_Sx2w,
TC  a_Svw,
TC  a_Sv2w 
)
inline

Definition at line 173 of file p1.

173  {
174  if(parent::m_dimension!=1) return false;
175  if(a_ibin>(parent::m_axes[0].m_number_of_bins+1)) return false;
176 
177  bool inRange = true;
178  if(a_ibin==0) inRange = false;
179  else if(a_ibin==(parent::m_axes[0].m_number_of_bins+1)) inRange = false;
180 
181  TO offset = a_ibin;
182 
184  if(inRange) {
188  parent::m_in_range_Sxw[0] -= parent::m_bin_Sxw[offset][0];
190  }
191 
192  parent::m_bin_entries[offset] = a_entries;
193  parent::m_bin_Sw[offset] = a_Sw;
194  parent::m_bin_Sw2[offset] = a_Sw2;
195 
196  parent::m_bin_Sxw[offset][0] = a_Sxw;
197  parent::m_bin_Sx2w[offset][0] = a_Sx2w;
198 
199  parent::m_all_entries += a_entries;
200  if(inRange) {
201  parent::m_in_range_entries += a_entries;
202  parent::m_in_range_Sw += a_Sw;
203  parent::m_in_range_Sw2 += a_Sw2;
204 
205  parent::m_in_range_Sxw[0] += a_Sxw;
206  parent::m_in_range_Sx2w[0] += a_Sx2w;
207  }
208 
209  // Profile part :
210  m_bin_Svw[offset] = a_Svw;
211  m_bin_Sv2w[offset] = a_Sv2w;
212 
213  return true;
214  }

◆ subtract()

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

Definition at line 261 of file p1.

261  {
262  parent::base_subtract(a_histo);
263  for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
264  m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
265  m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
266  }
267  return true;
268  }

Member Data Documentation

◆ m_bin_Sv2w

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

Definition at line 480 of file p1.

◆ m_bin_Svw

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

Definition at line 479 of file p1.

◆ m_cut_v

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

Definition at line 476 of file p1.

◆ m_max_v

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

Definition at line 478 of file p1.

◆ m_min_v

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

Definition at line 477 of file p1.


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::histo_data::m_in_range_Sw2
TW m_in_range_Sw2
Definition: histo_data:189
tools::histo::p1::multiply
bool multiply(TW a_factor)
Definition: p1:80
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::base_histo::dac
const hd_t & dac() const
Definition: base_histo:56
tools::histo::p1::m_min_v
TV m_min_v
Definition: p1:477
tools::histo::histo_data::m_bin_entries
std::vector< TN > m_bin_entries
Definition: histo_data:175
tools::histo::base_histo::base_add
void base_add(const base_histo &a_histo)
Definition: base_histo:476
tools::histo::p1::m_bin_Svw
vs_t m_bin_Svw
Definition: p1:479
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::p1::p1
p1(const std::string &a_title, bn_t aXnumber, TC aXmin, TC aXmax)
Definition: p1:349
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::b1::axis
const axis_t & axis() const
Definition: b1:103
tools::histo::base_histo::base_from_data
void base_from_data(const hd_t &a_from)
Definition: base_histo:47
tools::histo::p1::m_max_v
TV m_max_v
Definition: p1:478
tools::histo::p1::pd_t
profile_data< TC, TO, TN, TW, TV > pd_t
Definition: p1:24
tools::histo::histo_data::m_bin_Sxw
std::vector< std::vector< TC > > m_bin_Sxw
Definition: histo_data:178
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::p1::m_bin_Sv2w
vs_t m_bin_Sv2w
Definition: p1:480
tools::histo::histo_data::m_bin_number
TO m_bin_number
Definition: histo_data:174
tools::histo::b1::operator=
b1 & operator=(const b1 &a_from)
Definition: b1:170
tools::histo::p1::bn_t
parent::bn_t bn_t
Definition: p1:25
tools::histo::p1::axis_t
parent::axis_t axis_t
Definition: p1:26
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
tools::histo::b1::configure
bool configure(bn_t aXnumber, TC aXmin, TC aXmax)
Definition: b1:176
tools::histo::p1::m_cut_v
bool m_cut_v
Definition: p1:476