ATLAS Offline Software
Loading...
Searching...
No Matches
TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom > Class Template Reference

#include <TFCS1DFunctionTemplateHelpers.h>

Collaboration diagram for TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >:

Public Types

typedef TFCS1DFunction_size_t size_t
typedef T value_type
typedef Trandom random_type
typedef Tint internal_storage_type

Public Member Functions

 TFCS1DFunction_HistogramCompactBinEdges (size_t nbins=0)
 ~TFCS1DFunction_HistogramCompactBinEdges ()
std::size_t MemorySizeArray () const
std::size_t MemorySize () const
void set_nbins (size_t nbins)
 set number of bins
size_t get_nbins () const
 return number of bins
void SetBinLowEdge (size_t pos, const T &value)
 set position of lower edge of bins.
const T GetBinLowEdge (size_t pos) const
 get position of lower edge of bins.
const T GetBinLength (size_t pos) const
 get the length of a bin
void SetMin (const T &value)
 set and get minimum
const T & GetMin () const
void SetMax (const T &value)
 set and get maximum
const T & GetMax () const
void SetMinMax (const T &valuemin, const T &valuemax)
 set minimum and maximum
const T Length () const
 Get length of interval of all bins.
position (size_t pos, const Trandom &drnd) const
 return linear interpolated position for bin pos.
position_lin (size_t pos, Trandom m, const Trandom &drnd) const
 return interpolated position for bin pos, such that histograming the position gives a linear slope m, where m is in units of the bin width for bin pos.
position_exp (size_t pos, Trandom beta, const Trandom &drnd) const
 return exponentially interpolated position for bin pos, such that histograming the position gives a linear slope m, where m is in units of the bin width for bin pos.

Private Member Functions

size_t size () const

Private Attributes

TFCS1DFunction_Array< Tint > m_array
m_Min {0}
m_Max {0}

Detailed Description

template<typename T, typename Tint, typename Trandom = float>
class TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >

Definition at line 376 of file TFCS1DFunctionTemplateHelpers.h.

Member Typedef Documentation

◆ internal_storage_type

template<typename T, typename Tint, typename Trandom = float>
typedef Tint TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::internal_storage_type

Definition at line 381 of file TFCS1DFunctionTemplateHelpers.h.

◆ random_type

template<typename T, typename Tint, typename Trandom = float>
typedef Trandom TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::random_type

Definition at line 380 of file TFCS1DFunctionTemplateHelpers.h.

◆ size_t

template<typename T, typename Tint, typename Trandom = float>
typedef TFCS1DFunction_size_t TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::size_t

Definition at line 378 of file TFCS1DFunctionTemplateHelpers.h.

◆ value_type

template<typename T, typename Tint, typename Trandom = float>
typedef T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::value_type

Definition at line 379 of file TFCS1DFunctionTemplateHelpers.h.

Constructor & Destructor Documentation

◆ TFCS1DFunction_HistogramCompactBinEdges()

template<typename T, typename Tint, typename Trandom = float>
TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::TFCS1DFunction_HistogramCompactBinEdges ( size_t nbins = 0)
inline

◆ ~TFCS1DFunction_HistogramCompactBinEdges()

template<typename T, typename Tint, typename Trandom = float>
TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::~TFCS1DFunction_HistogramCompactBinEdges ( )
inline

Definition at line 385 of file TFCS1DFunctionTemplateHelpers.h.

385{};

Member Function Documentation

◆ get_nbins()

template<typename T, typename Tint, typename Trandom = float>
size_t TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::get_nbins ( ) const
inline

return number of bins

Definition at line 394 of file TFCS1DFunctionTemplateHelpers.h.

◆ GetBinLength()

template<typename T, typename Tint, typename Trandom = float>
const T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::GetBinLength ( size_t pos) const
inline

get the length of a bin

Definition at line 424 of file TFCS1DFunctionTemplateHelpers.h.

424 {
425 return GetBinLowEdge(pos + 1) - GetBinLowEdge(pos);
426 };
const T GetBinLowEdge(size_t pos) const
get position of lower edge of bins.

◆ GetBinLowEdge()

template<typename T, typename Tint, typename Trandom = float>
const T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::GetBinLowEdge ( size_t pos) const
inline

get position of lower edge of bins.

Requires GetMin() and GetMax() to be set and may not be changed!

Definition at line 413 of file TFCS1DFunctionTemplateHelpers.h.

413 {
414 if (pos == 0)
415 return GetMin();
416 if (pos >= get_nbins())
417 return GetMax();
418 return GetMin() +
420 m_array[pos - 1]);
421 };
const T Length() const
Get length of interval of all bins.
static Tfloat ToNormalizedRange(const T value)

◆ GetMax()

template<typename T, typename Tint, typename Trandom = float>
const T & TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::GetMax ( ) const
inline

◆ GetMin()

template<typename T, typename Tint, typename Trandom = float>
const T & TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::GetMin ( ) const
inline

◆ Length()

template<typename T, typename Tint, typename Trandom = float>
const T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::Length ( ) const
inline

Get length of interval of all bins.

Definition at line 443 of file TFCS1DFunctionTemplateHelpers.h.

443{ return GetMax() - GetMin(); };

◆ MemorySize()

template<typename T, typename Tint, typename Trandom = float>
std::size_t TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::MemorySize ( ) const
inline

Definition at line 388 of file TFCS1DFunctionTemplateHelpers.h.

388{ return sizeof(*this) + MemorySizeArray(); };

◆ MemorySizeArray()

template<typename T, typename Tint, typename Trandom = float>
std::size_t TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::MemorySizeArray ( ) const
inline

Definition at line 387 of file TFCS1DFunctionTemplateHelpers.h.

387{ return m_array.MemorySizeArray(); };

◆ position()

template<typename T, typename Tint, typename Trandom = float>
T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::position ( size_t pos,
const Trandom & drnd ) const
inline

return linear interpolated position for bin pos.

Interpolation is done with a random value in the range [0,1]

Definition at line 447 of file TFCS1DFunctionTemplateHelpers.h.

447 {
449 T pos2 = GetBinLowEdge(pos + 1);
450 return (1 - drnd) * pos1 + drnd * pos2;
451 };

◆ position_exp()

template<typename T, typename Tint, typename Trandom = float>
T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::position_exp ( size_t pos,
Trandom beta,
const Trandom & drnd ) const
inline

return exponentially interpolated position for bin pos, such that histograming the position gives a linear slope m, where m is in units of the bin width for bin pos.

Interpolation is done with a random value in the range [0,1]

(m_array[pos+1] - m_array[pos]);

Definition at line 478 of file TFCS1DFunctionTemplateHelpers.h.

478 {
479 Trandom z = drnd;
481 T pos2 = GetBinLowEdge(pos + 1);
482 if (fabs(beta) < 1.0e-8)
483 return (1 - z) * pos1 + z * pos2;
484 else {
485 T deltax = m_array[pos + 1] - m_array[pos];
486 if (deltax == 0)
487 return m_array[pos];
488 else {
489 z = 1 / beta * log(1.0 + drnd * (exp(beta * deltax) - 1.0)) / deltax;
490 }
491 }
492
493 return (1 - z) * pos1 + z * pos2;
494 };

◆ position_lin()

template<typename T, typename Tint, typename Trandom = float>
T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::position_lin ( size_t pos,
Trandom m,
const Trandom & drnd ) const
inline

return interpolated position for bin pos, such that histograming the position gives a linear slope m, where m is in units of the bin width for bin pos.

Interpolation is done with a random value in the range [0,1] return linearly interpolated position for bin pos, such that histograming the position gives a linear slope m, where m is in units of the bin width for bin pos. Interpolation is done with a random value in the range [0,1]

Definition at line 460 of file TFCS1DFunctionTemplateHelpers.h.

460 {
461 if (m > 2)
462 m = 2;
463 if (m < -2)
464 m = -2;
465 Trandom x =
466 fabs(m) > 0.001
467 ? (0.5 * std::sqrt(m * (m + 8 * drnd - 4) + 4) - 1) / m + 0.5
468 : drnd;
470 T pos2 = GetBinLowEdge(pos + 1);
471 return (1 - x) * pos1 + x * pos2;
472 };

◆ set_nbins()

template<typename T, typename Tint, typename Trandom = float>
void TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::set_nbins ( size_t nbins)
inline

set number of bins

Definition at line 391 of file TFCS1DFunctionTemplateHelpers.h.

391{ m_array.resize(nbins >= 1 ? nbins - 1 : 0); };

◆ SetBinLowEdge()

template<typename T, typename Tint, typename Trandom = float>
void TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::SetBinLowEdge ( size_t pos,
const T & value )
inline

set position of lower edge of bins.

Requires GetMin() and GetMax() to be set and may not be changed!

Definition at line 398 of file TFCS1DFunctionTemplateHelpers.h.

398 {
399 if (pos == 0) {
400 SetMin(value);
401 return;
402 }
403 if (pos >= get_nbins()) {
404 SetMax(value);
405 return;
406 }
408 (value - GetMin()) / Length());
409 };
void SetMin(const T &value)
set and get minimum
void SetMax(const T &value)
set and get maximum
static T ExpandToMaxRange(const Tfloat value)

◆ SetMax()

template<typename T, typename Tint, typename Trandom = float>
void TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::SetMax ( const T & value)
inline

set and get maximum

Definition at line 433 of file TFCS1DFunctionTemplateHelpers.h.

433{ m_Max = value; };

◆ SetMin()

template<typename T, typename Tint, typename Trandom = float>
void TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::SetMin ( const T & value)
inline

set and get minimum

Definition at line 429 of file TFCS1DFunctionTemplateHelpers.h.

429{ m_Min = value; };

◆ SetMinMax()

template<typename T, typename Tint, typename Trandom = float>
void TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::SetMinMax ( const T & valuemin,
const T & valuemax )
inline

set minimum and maximum

Definition at line 437 of file TFCS1DFunctionTemplateHelpers.h.

437 {
440 };

◆ size()

template<typename T, typename Tint, typename Trandom = float>
size_t TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::size ( ) const
inlineprivate

Definition at line 498 of file TFCS1DFunctionTemplateHelpers.h.

498{ return m_array.size(); };

Member Data Documentation

◆ m_array

template<typename T, typename Tint, typename Trandom = float>
TFCS1DFunction_Array<Tint> TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::m_array
private

Definition at line 497 of file TFCS1DFunctionTemplateHelpers.h.

◆ m_Max

template<typename T, typename Tint, typename Trandom = float>
T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::m_Max {0}
private

Definition at line 500 of file TFCS1DFunctionTemplateHelpers.h.

500{0};

◆ m_Min

template<typename T, typename Tint, typename Trandom = float>
T TFCS1DFunction_HistogramCompactBinEdges< T, Tint, Trandom >::m_Min {0}
private

Definition at line 499 of file TFCS1DFunctionTemplateHelpers.h.

499{0};

The documentation for this class was generated from the following file: