|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef ISF_FASTCALOSIMEVENT_TFCS1DFunctionTemplateHelpers_h
6 #define ISF_FASTCALOSIMEVENT_TFCS1DFunctionTemplateHelpers_h
98 T *new_cont =
nullptr;
102 size_t ncopy =
count;
146 b.ReadFastArray(m_content, m_size);
150 b.WriteFastArray(m_content, m_size);
156 template <
typename T,
typename Trandom =
float>
208 size_t get_bin(Trandom drnd, Trandom &residual_rnd)
const {
212 drnd = std::nextafter((Trandom)1.0, (Trandom)0.0);
222 basecont = *(
it - 1);
228 T dcont = fullcont - basecont;
230 residual_rnd = ((Trandom)(rnd - basecont)) / dcont;
231 if (residual_rnd > 1)
232 residual_rnd = std::nextafter((Trandom)1.0, (Trandom)0.0);
253 template <
typename T,
typename Trandom =
float>
316 ? (0.5 * std::sqrt(
m * (
m + 8 * drnd - 4) + 4) - 1) /
m + 0.5
329 if (fabs(
beta) < 1.0
e-8)
330 return (1 -
z) * pos1 +
z * pos2;
340 return (1 -
z) * pos1 +
z * pos2;
375 template <
typename T,
typename T
int,
typename Trandom =
float>
450 return (1 - drnd) * pos1 + drnd * pos2;
467 ? (0.5 * std::sqrt(
m * (
m + 8 * drnd - 4) + 4) - 1) /
m + 0.5
471 return (1 -
x) * pos1 +
x * pos2;
482 if (fabs(
beta) < 1.0
e-8)
483 return (1 -
z) * pos1 +
z * pos2;
493 return (1 -
z) * pos1 +
z * pos2;
538 #if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__)
539 #pragma link C++ class TFCS1DFunction_Numeric < uint8_t, float> + ;
540 #pragma link C++ class TFCS1DFunction_Numeric < uint16_t, float> + ;
541 #pragma link C++ class TFCS1DFunction_Numeric < uint32_t, float> + ;
542 #pragma link C++ class TFCS1DFunction_Numeric < float, float> + ;
543 #pragma link C++ class TFCS1DFunction_Numeric < double, float> + ;
544 #pragma link C++ class TFCS1DFunction_Numeric < double, double> + ;
546 #pragma link C++ class TFCS1DFunction_Array < float> - ;
547 #pragma link C++ class TFCS1DFunction_Array < double> - ;
548 #pragma link C++ class TFCS1DFunction_Array < uint8_t> - ;
549 #pragma link C++ class TFCS1DFunction_Array < uint16_t> - ;
550 #pragma link C++ class TFCS1DFunction_Array < uint32_t> - ;
552 #pragma link C++ class TFCS1DFunction_HistogramContent < float, float> + ;
553 #pragma link C++ class TFCS1DFunction_HistogramContent < double, float> + ;
554 #pragma link C++ class TFCS1DFunction_HistogramContent < double, double> + ;
555 #pragma link C++ class TFCS1DFunction_HistogramContent < uint8_t, float> + ;
556 #pragma link C++ class TFCS1DFunction_HistogramContent < uint16_t, float> + ;
557 #pragma link C++ class TFCS1DFunction_HistogramContent < uint32_t, float> + ;
559 #pragma link C++ class TFCS1DFunction_HistogramBinEdges < float, float> + ;
560 #pragma link C++ class TFCS1DFunction_HistogramBinEdges < double, float> + ;
561 #pragma link C++ class TFCS1DFunction_HistogramBinEdges < double, double> + ;
563 #pragma link C++ class TFCS1DFunction_HistogramCompactBinEdges < float, \
566 #pragma link C++ class TFCS1DFunction_HistogramCompactBinEdges < float, \
569 #pragma link C++ class TFCS1DFunction_HistogramCompactBinEdges < float, \
573 #pragma link C++ class TFCS1DFunction_HistogramInt8BinEdges + ;
574 #pragma link C++ class TFCS1DFunction_HistogramInt16BinEdges + ;
575 #pragma link C++ class TFCS1DFunction_HistogramInt32BinEdges + ;
576 #pragma link C++ class TFCS1DFunction_HistogramFloatBinEdges + ;
577 #pragma link C++ class TFCS1DFunction_HistogramDoubleBinEdges + ;
uint32_t TFCS1DFunction_size_t
const T Length() const
Get length of interval of all bins.
static uint32_t ExpandToMaxRange(const Tfloat value)
std::size_t MemorySize() const
static constexpr Tfloat MaxValueFloat
~TFCS1DFunction_HistogramCompactBinEdges()
const T Length() const
Get length of interval of all bins.
void set_nbins(size_t nbins)
set number of bins
void SetMax(const T &value)
set and get maximum
void SetMinMax(const T &valuemin, const T &valuemax)
set minimum and maximum
T 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 li...
std::size_t MemorySizeArray() const
TFCS1DFunction_HistogramInt8BinEdges(size_t nbins=0)
void set_nbins(size_t nbins)
set number of bins.
const T & operator[](size_t pos) const
TFCS1DFunction_Array< T > m_array
TFCS1DFunction_size_t size_t
TFCS1DFunction_Array< Tint > m_array
size_t get_nbins() const
return number of bins.
std::size_t MemorySizeArray() const
Tint internal_storage_type
const T & GetBinLowEdge(size_t pos) const
get position of lower edge of bins
static uint32_t MaxCeilOnlyForInt(const Tfloat value)
void set_fraction(size_t pos, Trandom value)
Set the content of bin pos to a given value, where value is in the range [0,1].
static T MaxCeilOnlyForInt(const Tfloat value)
static Tfloat ToNormalizedRange(const uint32_t value)
std::size_t MemorySizeArray() const
void SetMax(const T &value)
set and get maximum
T 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 l...
const T GetBinLength(size_t pos) const
get the length of a bin
Trandom get_binfraction(size_t pos) const
Get the content at bin pos as fraction in the range [0,1].
static uint8_t MaxCeilOnlyForInt(const Tfloat value)
const T GetBinLowEdge(size_t pos) const
get position of lower edge of bins.
static Tfloat ToNormalizedRange(const T value)
TFCS1DFunction_HistogramInt16BinEdges(size_t nbins=0)
void SetMinMax(const T &valuemin, const T &valuemax)
set minimum and maximum
std::size_t MemorySizeArray() const
static T ExpandToMaxRange(const Tfloat value)
size_t get_bin(Trandom drnd, Trandom &residual_rnd) const
Get the matching bin for a given random value in the range [0,1).
size_t get_nbins() const
return number of bins
TFCS1DFunction_HistogramDoubleBinEdges(size_t nbins=0)
std::size_t MemorySize() const
static uint16_t ExpandToMaxRange(const Tfloat value)
void SetBinLowEdge(size_t pos, const T &value)
set position of lower edge of bins
T 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...
static Tfloat ToNormalizedRange(const uint8_t value)
TFCS1DFunction_HistogramContent(size_t nbins=0)
Trandom get_fraction(size_t pos) const
Get the cumulative content at bin pos as fraction in the range [0,1].
T & operator[](size_t pos)
Direct access operators.
void resize(size_t count)
resize to given count, copying old content
TFCS1DFunction_HistogramBinEdges(size_t nbins=0)
std::size_t MemorySize() const
TFCS1DFunction_Array(size_t count)
TFCS1DFunction_Array< T > m_array
static uint16_t MaxCeilOnlyForInt(const Tfloat value)
TFCS1DFunction_HistogramCompactBinEdges(size_t nbins=0)
T position(size_t pos, const Trandom &drnd) const
return linear interpolated position for bin pos.
T * data()
Direct data pointer.
static Tfloat ToNormalizedRange(const uint16_t value)
static constexpr T MaxValue
TFCS1DFunction_HistogramFloatBinEdges(size_t nbins=0)
void SetMin(const T &value)
set and get minimum
TFCS1DFunction_size_t size_t
TFCS1DFunction_size_t size_t
void set_nbins(size_t nbins)
set number of bins
std::size_t MemorySize() const
static uint8_t ExpandToMaxRange(const Tfloat value)
const T GetBinLength(size_t pos) const
get the length of a bin
T position(size_t pos, const Trandom &drnd) const
return linear interpolated position for bin pos.
T 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,...
void SetBinLowEdge(size_t pos, const T &value)
set position of lower edge of bins.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
TFCS1DFunction_size_t size_t
size_t get_nbins() const
return number of bins
void SetMin(const T &value)
set and get minimum
Converter functions that does nothing for floats.
T * begin()
begin() iterators
~TFCS1DFunction_HistogramBinEdges()
TFCS1DFunction_HistogramInt32BinEdges(size_t nbins=0)