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

#include <TFCS1DFunctionTemplateHelpers.h>

Inheritance diagram for TFCS1DFunction_HistogramDoubleBinEdges:
Collaboration diagram for TFCS1DFunction_HistogramDoubleBinEdges:

Public Types

typedef TFCS1DFunction_size_t size_t
 
typedef double value_type
 
typedef double random_type
 

Public Member Functions

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

Private Member Functions

size_t size () const
 

Private Attributes

TFCS1DFunction_Array< double > m_array
 

Detailed Description

Definition at line 362 of file TFCS1DFunctionTemplateHelpers.h.

Member Typedef Documentation

◆ random_type

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

Definition at line 258 of file TFCS1DFunctionTemplateHelpers.h.

◆ size_t

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

Definition at line 256 of file TFCS1DFunctionTemplateHelpers.h.

◆ value_type

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

Definition at line 257 of file TFCS1DFunctionTemplateHelpers.h.

Constructor & Destructor Documentation

◆ TFCS1DFunction_HistogramDoubleBinEdges()

TFCS1DFunction_HistogramDoubleBinEdges::TFCS1DFunction_HistogramDoubleBinEdges ( size_t  nbins = 0)
inline

Member Function Documentation

◆ get_nbins()

size_t TFCS1DFunction_HistogramBinEdges< double , double >::get_nbins
inlineinherited

return number of bins

Definition at line 270 of file TFCS1DFunctionTemplateHelpers.h.

270 { return size() - 1; };

◆ GetBinLength()

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

get the length of a bin

Definition at line 279 of file TFCS1DFunctionTemplateHelpers.h.

279  {
280  return GetBinLowEdge(pos + 1) - GetBinLowEdge(pos);
281  };

◆ GetBinLowEdge()

const double & TFCS1DFunction_HistogramBinEdges< double , double >::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 double & TFCS1DFunction_HistogramBinEdges< double , double >::GetMax
inlineinherited

Definition at line 289 of file TFCS1DFunctionTemplateHelpers.h.

289 { return m_array[get_nbins()]; };

◆ GetMin()

const double & TFCS1DFunction_HistogramBinEdges< double , double >::GetMin
inlineinherited

Definition at line 285 of file TFCS1DFunctionTemplateHelpers.h.

285 { return m_array[0]; };

◆ Length()

const double TFCS1DFunction_HistogramBinEdges< double , double >::Length
inlineinherited

Get length of interval of all bins.

Definition at line 298 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ MemorySize()

std::size_t TFCS1DFunction_HistogramBinEdges< double , double >::MemorySize
inlineinherited

Definition at line 264 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ MemorySizeArray()

std::size_t TFCS1DFunction_HistogramBinEdges< double , double >::MemorySizeArray
inlineinherited

Definition at line 263 of file TFCS1DFunctionTemplateHelpers.h.

263 { return m_array.MemorySizeArray(); };

◆ position()

double TFCS1DFunction_HistogramBinEdges< double , double >::position ( size_t  pos,
const double &  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()

double TFCS1DFunction_HistogramBinEdges< double , double >::position_exp ( size_t  pos,
double  beta,
const double &  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;
327  T pos1 = GetBinLowEdge(pos);
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()

double TFCS1DFunction_HistogramBinEdges< double , double >::position_lin ( size_t  pos,
double  m,
const double &  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< double , double >::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< double , double >::SetBinLowEdge ( size_t  pos,
const double &  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< double , double >::SetMax ( const double &  value)
inlineinherited

set and get maximum

Definition at line 288 of file TFCS1DFunctionTemplateHelpers.h.

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

◆ SetMin()

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

set and get minimum

Definition at line 284 of file TFCS1DFunctionTemplateHelpers.h.

284 { m_array[0] = value; };

◆ SetMinMax()

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

set minimum and maximum

Definition at line 292 of file TFCS1DFunctionTemplateHelpers.h.

292  {
293  SetMin(valuemin);
294  SetMax(valuemax);
295  };

◆ size()

size_t TFCS1DFunction_HistogramBinEdges< double , double >::size
inlineprivateinherited

Definition at line 345 of file TFCS1DFunctionTemplateHelpers.h.

345 { return m_array.size(); };

Member Data Documentation

◆ m_array

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

Definition at line 344 of file TFCS1DFunctionTemplateHelpers.h.


The documentation for this class was generated from the following file:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TFCS1DFunction_HistogramBinEdges< double, double >::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:345
TFCS1DFunction_HistogramBinEdges< double, double >::SetMax
void SetMax(const double &value)
set and get maximum
Definition: TFCS1DFunctionTemplateHelpers.h:288
athena.value
value
Definition: athena.py:124
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
TFCS1DFunction_Array::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:91
TFCS1DFunction_HistogramBinEdges< double, double >::GetBinLowEdge
const double & GetBinLowEdge(size_t pos) const
get position of lower edge of bins
Definition: TFCS1DFunctionTemplateHelpers.h:276
TFCS1DFunction_HistogramBinEdges< double, double >::GetMax
const double & GetMax() const
Definition: TFCS1DFunctionTemplateHelpers.h:289
z
#define z
TFCS1DFunction_HistogramBinEdges< double, double >::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:263
TFCS1DFunction_HistogramBinEdges< double, double >::get_nbins
size_t get_nbins() const
return number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:270
TFCS1DFunction_Array::resize
void resize(size_t count)
resize to given count, copying old content
Definition: TFCS1DFunctionTemplateHelpers.h:97
TFCS1DFunction_HistogramBinEdges< double, double >::GetMin
const double & GetMin() const
Definition: TFCS1DFunctionTemplateHelpers.h:285
TFCS1DFunction_HistogramBinEdges< double, double >::m_array
TFCS1DFunction_Array< double > m_array
Definition: TFCS1DFunctionTemplateHelpers.h:341
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TFCS1DFunction_HistogramBinEdges< double, double >::SetMin
void SetMin(const double &value)
set and get minimum
Definition: TFCS1DFunctionTemplateHelpers.h:284
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
TFCS1DFunction_Array::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:94
TFCS1DFunction_HistogramBinEdges< double, double >
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35