ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
TFCS1DFunction_HistogramInt32BinEdges Class Reference

#include <TFCS1DFunctionTemplateHelpers.h>

Inheritance diagram for TFCS1DFunction_HistogramInt32BinEdges:
Collaboration diagram for TFCS1DFunction_HistogramInt32BinEdges:

Public Types

typedef TFCS1DFunction_size_t size_t
 
typedef float value_type
 
typedef float random_type
 
typedef uint32_t internal_storage_type
 

Public Member Functions

 TFCS1DFunction_HistogramInt32BinEdges (size_t nbins=0)
 
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 float &value)
 set position of lower edge of bins. More...
 
const float GetBinLowEdge (size_t pos) const
 get position of lower edge of bins. More...
 
const float GetBinLength (size_t pos) const
 get the length of a bin More...
 
void SetMin (const float &value)
 set and get minimum More...
 
const float & GetMin () const
 
void SetMax (const float &value)
 set and get maximum More...
 
const float & GetMax () const
 
void SetMinMax (const float &valuemin, const float &valuemax)
 set minimum and maximum More...
 
const float Length () const
 Get length of interval of all bins. More...
 
float position (size_t pos, const float &drnd) const
 return linear interpolated position for bin pos. More...
 
float position_lin (size_t pos, float m, const float &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...
 
float position_exp (size_t pos, float beta, const float &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< uint32_t > m_array
 
float m_Min
 
float m_Max
 

Detailed Description

Definition at line 527 of file TFCS1DFunctionTemplateHelpers.h.

Member Typedef Documentation

◆ internal_storage_type

typedef uint32_t TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::internal_storage_type
inherited

Definition at line 381 of file TFCS1DFunctionTemplateHelpers.h.

◆ random_type

typedef float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::random_type
inherited

Definition at line 380 of file TFCS1DFunctionTemplateHelpers.h.

◆ size_t

typedef TFCS1DFunction_size_t TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::size_t
inherited

Definition at line 378 of file TFCS1DFunctionTemplateHelpers.h.

◆ value_type

typedef float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::value_type
inherited

Definition at line 379 of file TFCS1DFunctionTemplateHelpers.h.

Constructor & Destructor Documentation

◆ TFCS1DFunction_HistogramInt32BinEdges()

TFCS1DFunction_HistogramInt32BinEdges::TFCS1DFunction_HistogramInt32BinEdges ( size_t  nbins = 0)
inline

Member Function Documentation

◆ get_nbins()

size_t TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::get_nbins
inlineinherited

return number of bins

Definition at line 394 of file TFCS1DFunctionTemplateHelpers.h.

394 { return size() + 1; };

◆ GetBinLength()

const float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::GetBinLength ( size_t  pos) const
inlineinherited

get the length of a bin

Definition at line 424 of file TFCS1DFunctionTemplateHelpers.h.

424  {
425  return GetBinLowEdge(pos + 1) - GetBinLowEdge(pos);
426  };

◆ GetBinLowEdge()

const float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::GetBinLowEdge ( size_t  pos) const
inlineinherited

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()

const float & TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::GetMax
inlineinherited

Definition at line 434 of file TFCS1DFunctionTemplateHelpers.h.

434 { return m_Max; };

◆ GetMin()

const float & TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::GetMin
inlineinherited

Definition at line 430 of file TFCS1DFunctionTemplateHelpers.h.

430 { return m_Min; };

◆ Length()

const float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::Length
inlineinherited

Get length of interval of all bins.

Definition at line 443 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ MemorySize()

std::size_t TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::MemorySize
inlineinherited

Definition at line 388 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ MemorySizeArray()

std::size_t TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::MemorySizeArray
inlineinherited

Definition at line 387 of file TFCS1DFunctionTemplateHelpers.h.

387 { return m_array.MemorySizeArray(); };

◆ position()

float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::position ( size_t  pos,
const float &  drnd 
) const
inlineinherited

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()

float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::position_exp ( size_t  pos,
float  beta,
const float &  drnd 
) const
inlineinherited

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()

float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::position_lin ( size_t  pos,
float  m,
const float &  drnd 
) const
inlineinherited

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()

void TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::set_nbins ( size_t  nbins)
inlineinherited

set number of bins

Definition at line 391 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ SetBinLowEdge()

void TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::SetBinLowEdge ( size_t  pos,
const float &  value 
)
inlineinherited

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()

void TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::SetMax ( const float &  value)
inlineinherited

set and get maximum

Definition at line 433 of file TFCS1DFunctionTemplateHelpers.h.

433 { m_Max = value; };

◆ SetMin()

void TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::SetMin ( const float &  value)
inlineinherited

set and get minimum

Definition at line 429 of file TFCS1DFunctionTemplateHelpers.h.

429 { m_Min = value; };

◆ SetMinMax()

void TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::SetMinMax ( const float &  valuemin,
const float &  valuemax 
)
inlineinherited

set minimum and maximum

Definition at line 437 of file TFCS1DFunctionTemplateHelpers.h.

437  {
438  SetMin(valuemin);
439  SetMax(valuemax);
440  };

◆ size()

size_t TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::size
inlineprivateinherited

Definition at line 498 of file TFCS1DFunctionTemplateHelpers.h.

498 { return m_array.size(); };

Member Data Documentation

◆ m_array

TFCS1DFunction_Array<uint32_t > TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::m_array
privateinherited

Definition at line 497 of file TFCS1DFunctionTemplateHelpers.h.

◆ m_Max

float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::m_Max
privateinherited

Definition at line 500 of file TFCS1DFunctionTemplateHelpers.h.

◆ m_Min

float TFCS1DFunction_HistogramCompactBinEdges< float , uint32_t , float >::m_Min
privateinherited

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< float, uint32_t, float >::Length
const float Length() const
Get length of interval of all bins.
Definition: TFCS1DFunctionTemplateHelpers.h:443
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::m_Max
float m_Max
Definition: TFCS1DFunctionTemplateHelpers.h:500
athena.value
value
Definition: athena.py:124
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::m_array
TFCS1DFunction_Array< uint32_t > 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< float, uint32_t, float >::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:387
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::SetMax
void SetMax(const float &value)
set and get maximum
Definition: TFCS1DFunctionTemplateHelpers.h:433
z
#define z
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::GetBinLowEdge
const float 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< float, uint32_t, float >::GetMin
const float & 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< float, uint32_t, float >::m_Min
float m_Min
Definition: TFCS1DFunctionTemplateHelpers.h:499
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::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< float, uint32_t, float >::GetMax
const float & GetMax() const
Definition: TFCS1DFunctionTemplateHelpers.h:434
TFCS1DFunction_Array::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:94
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::get_nbins
size_t get_nbins() const
return number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:394
TFCS1DFunction_HistogramCompactBinEdges< float, uint32_t, float >::SetMin
void SetMin(const float &value)
set and get minimum
Definition: TFCS1DFunctionTemplateHelpers.h:429
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35