ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 More...
 
size_t get_nbins () const
 return number of bins More...
 
void SetBinLowEdge (size_t pos, const T &value)
 set position of lower edge of bins. More...
 
constGetBinLowEdge (size_t pos) const
 get position of lower edge of bins. More...
 
constGetBinLength (size_t pos) const
 get the length of a bin More...
 
void SetMin (const T &value)
 set and get minimum More...
 
const T & GetMin () const
 
void SetMax (const T &value)
 set and get maximum More...
 
const T & GetMax () const
 
void SetMinMax (const T &valuemin, const T &valuemax)
 set minimum and maximum More...
 
constLength () const
 Get length of interval of all bins. More...
 
position (size_t pos, const Trandom &drnd) const
 return linear interpolated position for bin pos. More...
 
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. More...
 
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. More...
 

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

Definition at line 383 of file TFCS1DFunctionTemplateHelpers.h.

384  : m_array(nbins >= 1 ? nbins - 1 : 0){};

◆ ~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.

394 { return size() + 1; };

◆ 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  };

◆ 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  };

◆ GetMax()

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

Definition at line 434 of file TFCS1DFunctionTemplateHelpers.h.

434 { return m_Max; };

◆ GetMin()

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

Definition at line 430 of file TFCS1DFunctionTemplateHelpers.h.

430 { return m_Min; };

◆ 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  {
448  T pos1 = GetBinLowEdge(pos);
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;
480  T pos1 = GetBinLowEdge(pos);
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;
469  T pos1 = GetBinLowEdge(pos);
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  };

◆ 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  {
438  SetMin(valuemin);
439  SetMax(valuemax);
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.

◆ 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.


The documentation for this class was generated from the following file:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TFCS1DFunction_HistogramCompactBinEdges::Length
const T Length() const
Get length of interval of all bins.
Definition: TFCS1DFunctionTemplateHelpers.h:443
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TFCS1DFunction_HistogramCompactBinEdges::m_Max
T m_Max
Definition: TFCS1DFunctionTemplateHelpers.h:500
athena.value
value
Definition: athena.py:124
TFCS1DFunction_HistogramCompactBinEdges::m_array
TFCS1DFunction_Array< Tint > m_array
Definition: TFCS1DFunctionTemplateHelpers.h:494
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
TFCS1DFunction_Array::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:91
TFCS1DFunction_HistogramCompactBinEdges::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:387
TFCS1DFunction_HistogramCompactBinEdges::SetMax
void SetMax(const T &value)
set and get maximum
Definition: TFCS1DFunctionTemplateHelpers.h:433
z
#define z
TFCS1DFunction_HistogramCompactBinEdges::GetBinLowEdge
const T GetBinLowEdge(size_t pos) const
get position of lower edge of bins.
Definition: TFCS1DFunctionTemplateHelpers.h:413
TFCS1DFunction_Numeric::ToNormalizedRange
static Tfloat ToNormalizedRange(const T value)
Definition: TFCS1DFunctionTemplateHelpers.h:26
TFCS1DFunction_Numeric::ExpandToMaxRange
static T ExpandToMaxRange(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:25
TFCS1DFunction_HistogramCompactBinEdges::GetMin
const T & GetMin() const
Definition: TFCS1DFunctionTemplateHelpers.h:430
TFCS1DFunction_Array::resize
void resize(size_t count)
resize to given count, copying old content
Definition: TFCS1DFunctionTemplateHelpers.h:97
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TFCS1DFunction_HistogramCompactBinEdges::m_Min
T m_Min
Definition: TFCS1DFunctionTemplateHelpers.h:499
TFCS1DFunction_HistogramCompactBinEdges::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:498
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
TFCS1DFunction_HistogramCompactBinEdges::GetMax
const T & GetMax() const
Definition: TFCS1DFunctionTemplateHelpers.h:434
TFCS1DFunction_Array::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:94
TFCS1DFunction_HistogramCompactBinEdges::get_nbins
size_t get_nbins() const
return number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:394
TFCS1DFunction_HistogramCompactBinEdges::SetMin
void SetMin(const T &value)
set and get minimum
Definition: TFCS1DFunctionTemplateHelpers.h:429
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35