ATLAS Offline Software
Loading...
Searching...
No Matches
TFCS1DFunction_HistogramFloatBinEdges Class Reference

#include <TFCS1DFunctionTemplateHelpers.h>

Inheritance diagram for TFCS1DFunction_HistogramFloatBinEdges:
Collaboration diagram for TFCS1DFunction_HistogramFloatBinEdges:

Public Types

typedef TFCS1DFunction_size_t size_t
typedef float value_type
typedef float random_type

Public Member Functions

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

Detailed Description

Definition at line 352 of file TFCS1DFunctionTemplateHelpers.h.

Member Typedef Documentation

◆ random_type

typedef float TFCS1DFunction_HistogramBinEdges< float, float >::random_type
inherited

Definition at line 258 of file TFCS1DFunctionTemplateHelpers.h.

◆ size_t

typedef TFCS1DFunction_size_t TFCS1DFunction_HistogramBinEdges< float, float >::size_t
inherited

Definition at line 256 of file TFCS1DFunctionTemplateHelpers.h.

◆ value_type

typedef float TFCS1DFunction_HistogramBinEdges< float, float >::value_type
inherited

Definition at line 257 of file TFCS1DFunctionTemplateHelpers.h.

Constructor & Destructor Documentation

◆ TFCS1DFunction_HistogramFloatBinEdges()

TFCS1DFunction_HistogramFloatBinEdges::TFCS1DFunction_HistogramFloatBinEdges ( size_t nbins = 0)
inline

Member Function Documentation

◆ get_nbins()

size_t TFCS1DFunction_HistogramBinEdges< float, float >::get_nbins ( ) const
inlineinherited

return number of bins

Definition at line 270 of file TFCS1DFunctionTemplateHelpers.h.

◆ GetBinLength()

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

get the length of a bin

Definition at line 279 of file TFCS1DFunctionTemplateHelpers.h.

◆ GetBinLowEdge()

const float & TFCS1DFunction_HistogramBinEdges< float, float >::GetBinLowEdge ( size_t pos) const
inlineinherited

get position of lower edge of bins

Definition at line 276 of file TFCS1DFunctionTemplateHelpers.h.

276{ return m_array[pos]; };

◆ GetMax()

const float & TFCS1DFunction_HistogramBinEdges< float, float >::GetMax ( ) const
inlineinherited

◆ GetMin()

const float & TFCS1DFunction_HistogramBinEdges< float, float >::GetMin ( ) const
inlineinherited

Definition at line 285 of file TFCS1DFunctionTemplateHelpers.h.

285{ return m_array[0]; };

◆ Length()

const float TFCS1DFunction_HistogramBinEdges< float, float >::Length ( ) const
inlineinherited

Get length of interval of all bins.

Definition at line 298 of file TFCS1DFunctionTemplateHelpers.h.

◆ MemorySize()

std::size_t TFCS1DFunction_HistogramBinEdges< float, float >::MemorySize ( ) const
inlineinherited

Definition at line 264 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ MemorySizeArray()

std::size_t TFCS1DFunction_HistogramBinEdges< float, float >::MemorySizeArray ( ) const
inlineinherited

Definition at line 263 of file TFCS1DFunctionTemplateHelpers.h.

263{ return m_array.MemorySizeArray(); };

◆ position()

float TFCS1DFunction_HistogramBinEdges< float, 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 302 of file TFCS1DFunctionTemplateHelpers.h.

302 {
303 return (1 - drnd) * m_array[pos] + drnd * m_array[pos + 1];
304 };

◆ position_exp()

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

return exponetially 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 325 of file TFCS1DFunctionTemplateHelpers.h.

325 {
326 Trandom z = drnd;
328 T pos2 = GetBinLowEdge(pos + 1);
329 if (fabs(beta) < 1.0e-8)
330 return (1 - z) * pos1 + z * pos2;
331 else {
332 T deltax = m_array[pos + 1] - m_array[pos];
333 if (deltax == 0)
334 return m_array[pos];
335 else {
336 z = 1 / beta * log(1.0 + drnd * (exp(beta * deltax) - 1.0)) / deltax;
337 }
338 }
339
340 return (1 - z) * pos1 + z * pos2;
341 };

◆ position_lin()

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

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 309 of file TFCS1DFunctionTemplateHelpers.h.

309 {
310 if (m > 2)
311 m = 2;
312 if (m < -2)
313 m = -2;
314 Trandom x =
315 fabs(m) > 0.001
316 ? (0.5 * std::sqrt(m * (m + 8 * drnd - 4) + 4) - 1) / m + 0.5
317 : drnd;
318 return (1 - x) * m_array[pos] + x * m_array[pos + 1];
319 };

◆ set_nbins()

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

set number of bins

Definition at line 267 of file TFCS1DFunctionTemplateHelpers.h.

267{ m_array.resize(nbins + 1); };

◆ SetBinLowEdge()

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

set position of lower edge of bins

Definition at line 273 of file TFCS1DFunctionTemplateHelpers.h.

273{ m_array[pos] = value; };

◆ SetMax()

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

set and get maximum

Definition at line 288 of file TFCS1DFunctionTemplateHelpers.h.

288{ m_array[get_nbins()] = value; };

◆ SetMin()

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

set and get minimum

Definition at line 284 of file TFCS1DFunctionTemplateHelpers.h.

284{ m_array[0] = value; };

◆ SetMinMax()

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

set minimum and maximum

Definition at line 292 of file TFCS1DFunctionTemplateHelpers.h.

◆ size()

size_t TFCS1DFunction_HistogramBinEdges< float, float >::size ( ) const
inlineprivateinherited

Definition at line 345 of file TFCS1DFunctionTemplateHelpers.h.

345{ return m_array.size(); };

Member Data Documentation

◆ m_array

TFCS1DFunction_Array<float> TFCS1DFunction_HistogramBinEdges< float, float >::m_array
privateinherited

Definition at line 344 of file TFCS1DFunctionTemplateHelpers.h.


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