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

#include <TFCS1DFunctionTemplateHelpers.h>

Collaboration diagram for TFCS1DFunction_HistogramBinEdges< T, Trandom >:

Public Types

typedef TFCS1DFunction_size_t size_t
typedef T value_type
typedef Trandom random_type

Public Member Functions

 TFCS1DFunction_HistogramBinEdges (size_t nbins=0)
 ~TFCS1DFunction_HistogramBinEdges ()
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 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.
position_exp (size_t pos, Trandom beta, const Trandom &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< T > m_array

Detailed Description

template<typename T, typename Trandom = float>
class TFCS1DFunction_HistogramBinEdges< T, Trandom >

Definition at line 254 of file TFCS1DFunctionTemplateHelpers.h.

Member Typedef Documentation

◆ random_type

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

Definition at line 258 of file TFCS1DFunctionTemplateHelpers.h.

◆ size_t

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

Definition at line 256 of file TFCS1DFunctionTemplateHelpers.h.

◆ value_type

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

Definition at line 257 of file TFCS1DFunctionTemplateHelpers.h.

Constructor & Destructor Documentation

◆ TFCS1DFunction_HistogramBinEdges()

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

◆ ~TFCS1DFunction_HistogramBinEdges()

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

Definition at line 261 of file TFCS1DFunctionTemplateHelpers.h.

261{};

Member Function Documentation

◆ get_nbins()

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

return number of bins

Definition at line 270 of file TFCS1DFunctionTemplateHelpers.h.

270{ return size() - 1; };

◆ GetBinLength()

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

get the length of a bin

Definition at line 279 of file TFCS1DFunctionTemplateHelpers.h.

279 {
280 return GetBinLowEdge(pos + 1) - GetBinLowEdge(pos);
281 };
const T & GetBinLowEdge(size_t pos) const
get position of lower edge of bins

◆ GetBinLowEdge()

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

get position of lower edge of bins

Definition at line 276 of file TFCS1DFunctionTemplateHelpers.h.

276{ return m_array[pos]; };

◆ GetMax()

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

Definition at line 289 of file TFCS1DFunctionTemplateHelpers.h.

289{ return m_array[get_nbins()]; };
size_t get_nbins() const
return number of bins

◆ GetMin()

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

Definition at line 285 of file TFCS1DFunctionTemplateHelpers.h.

285{ return m_array[0]; };

◆ Length()

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

Get length of interval of all bins.

Definition at line 298 of file TFCS1DFunctionTemplateHelpers.h.

◆ MemorySize()

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

Definition at line 264 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ MemorySizeArray()

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

Definition at line 263 of file TFCS1DFunctionTemplateHelpers.h.

263{ return m_array.MemorySizeArray(); };

◆ position()

template<typename T, typename Trandom = float>
T TFCS1DFunction_HistogramBinEdges< T, 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 302 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ position_exp()

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

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

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

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

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

set number of bins

Definition at line 267 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ SetBinLowEdge()

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

set position of lower edge of bins

Definition at line 273 of file TFCS1DFunctionTemplateHelpers.h.

273{ m_array[pos] = value; };

◆ SetMax()

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

set and get maximum

Definition at line 288 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ SetMin()

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

set and get minimum

Definition at line 284 of file TFCS1DFunctionTemplateHelpers.h.

284{ m_array[0] = value; };

◆ SetMinMax()

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

set minimum and maximum

Definition at line 292 of file TFCS1DFunctionTemplateHelpers.h.

292 {
295 };
void SetMax(const T &value)
set and get maximum
void SetMin(const T &value)
set and get minimum

◆ size()

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

Definition at line 345 of file TFCS1DFunctionTemplateHelpers.h.

345{ return m_array.size(); };

Member Data Documentation

◆ m_array

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

Definition at line 344 of file TFCS1DFunctionTemplateHelpers.h.


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