ATLAS Offline Software
TFCS1DFunctionTemplateHelpers.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_FASTCALOSIMEVENT_TFCS1DFunctionTemplateHelpers_h
6 #define ISF_FASTCALOSIMEVENT_TFCS1DFunctionTemplateHelpers_h
7 
8 #include "TBuffer.h"
9 
10 #include <vector>
11 #include <cstring>
12 #include <algorithm>
13 #include <cmath>
14 
15 // For the purpose of FastCaloSim, 32bit are sufficient for bin counting
17 
19 template <typename T, typename Tfloat = float> class TFCS1DFunction_Numeric {
20 public:
21  static constexpr T MaxValue = 1;
22  static constexpr Tfloat MaxValueFloat = MaxValue;
23 
24  static inline T MaxCeilOnlyForInt(const Tfloat value) { return value; };
25  static inline T ExpandToMaxRange(const Tfloat value) { return value; };
26  static inline Tfloat ToNormalizedRange(const T value) { return value; };
27 };
28 
30 template <typename Tfloat> class TFCS1DFunction_Numeric<uint8_t, Tfloat> {
31 public:
32  static constexpr uint8_t MaxValue = UINT8_MAX;
33  static constexpr Tfloat MaxValueFloat = MaxValue;
34 
35  static inline uint8_t MaxCeilOnlyForInt(const Tfloat value) {
36  return std::ceil(MaxValueFloat * value);
37  };
38  static inline uint8_t ExpandToMaxRange(const Tfloat value) {
39  return value * (1 + MaxValueFloat);
40  };
41  static inline Tfloat ToNormalizedRange(const uint8_t value) {
42  return value / (1 + MaxValueFloat);
43  };
44 };
45 
47 template <typename Tfloat> class TFCS1DFunction_Numeric<uint16_t, Tfloat> {
48 public:
49  static constexpr uint16_t MaxValue = UINT16_MAX;
50  static constexpr Tfloat MaxValueFloat = MaxValue;
51 
52  static inline uint16_t MaxCeilOnlyForInt(const Tfloat value) {
53  return std::ceil(MaxValueFloat * value);
54  };
55  static inline uint16_t ExpandToMaxRange(const Tfloat value) {
56  return value * (1 + MaxValueFloat);
57  };
58  static inline Tfloat ToNormalizedRange(const uint16_t value) {
59  return value / (1 + MaxValueFloat);
60  };
61 };
62 
64 template <typename Tfloat> class TFCS1DFunction_Numeric<uint32_t, Tfloat> {
65 public:
66  static constexpr uint32_t MaxValue = UINT32_MAX;
67  static constexpr Tfloat MaxValueFloat = MaxValue;
68 
69  static inline uint32_t MaxCeilOnlyForInt(const Tfloat value) {
70  return std::ceil(MaxValueFloat * value);
71  };
72  static inline uint32_t ExpandToMaxRange(const Tfloat value) {
73  return value * (1 + MaxValueFloat);
74  };
75  static inline Tfloat ToNormalizedRange(const uint32_t value) {
76  return value / (1 + MaxValueFloat);
77  };
78 };
79 
80 template <typename T> class TFCS1DFunction_Array {
81 public:
83 
87  if (m_content)
88  delete[] m_content;
89  };
90 
91  std::size_t MemorySizeArray() const { return size() * sizeof(T); };
92  std::size_t MemorySize() const { return sizeof(*this) + MemorySizeArray(); };
93 
94  inline size_t size() const { return m_size; };
95 
97  void resize(size_t count) {
98  T *new_cont = nullptr;
99  if (count > 0)
100  new_cont = new T[count];
101  if (m_content && new_cont) {
102  size_t ncopy = count;
103  if (size() < ncopy)
104  ncopy = size();
105  ncopy *= sizeof(T);
106  std::memcpy(new_cont, m_content, ncopy);
107  }
108  if (m_content)
109  delete[] m_content;
110  m_size = count;
111  m_content = new_cont;
112  };
113 
115  inline T *data() { return m_content; };
116  inline const T *data() const { return m_content; };
117 
120  inline T &operator[](size_t pos) { return m_content[pos]; };
121  inline const T &operator[](size_t pos) const { return m_content[pos]; };
122 
124  inline T *begin() { return m_content; };
125  inline const T *begin() const { return m_content; };
126 
128  inline T *end() { return m_content + size(); };
129  inline const T *end() const { return m_content + size(); };
130 
131 private:
132  T *m_content{nullptr};
133  size_t m_size{0};
134 
135  // Use ClassDef without virtual functions. Saves 8 bytes per instance
136  ClassDefNV(TFCS1DFunction_Array, 1) // TFCS1DFunction_Array
137 };
138 
140 template <typename T> void TFCS1DFunction_Array<T>::Streamer(TBuffer &b) {
141  if (b.IsReading()) {
142  size_t count;
143  b >> count;
144  resize(count);
145  if (m_size > 0)
146  b.ReadFastArray(m_content, m_size);
147  } else {
148  b << m_size;
149  if (m_size > 0)
150  b.WriteFastArray(m_content, m_size);
151  }
152 }
153 
154 // Class to represent histogram content. Trandom should be a type with a
155 // floating point range [0,1]
156 template <typename T, typename Trandom = float>
158 public:
160  typedef T value_type;
161  typedef Trandom random_type;
162 
164  : m_array(nbins >= 1 ? nbins - 1 : 0){};
165 
166  std::size_t MemorySizeArray() const { return m_array.MemorySizeArray(); };
167  std::size_t MemorySize() const { return sizeof(*this) + MemorySizeArray(); };
168 
171  void set_fraction(size_t pos, Trandom value) {
172  if (pos >= size())
173  return;
175  };
176 
178  inline Trandom get_fraction(size_t pos) const {
179  if (pos >= size())
180  return 1;
182  };
183 
185  inline Trandom get_binfraction(size_t pos) const {
186  if (pos == 0)
188  if (pos == size())
189  return 1 - (m_array[size() - 1] /
191  return (m_array[pos] - m_array[pos - 1]) /
193  };
194 
198  void set_nbins(size_t nbins) { m_array.resize(nbins >= 1 ? nbins - 1 : 0); };
199 
203  inline size_t get_nbins() const { return size() + 1; };
204 
208  size_t get_bin(Trandom drnd, Trandom &residual_rnd) const {
209  if (drnd <= 0)
210  drnd = 0;
211  if (drnd >= 1)
212  drnd = std::nextafter((Trandom)1.0, (Trandom)0.0);
213  if (size() == 0) {
214  residual_rnd = drnd;
215  return 0;
216  }
218  auto it = std::upper_bound(m_array.begin(), m_array.end(), rnd);
219 
220  T basecont = 0;
221  if (it != m_array.begin())
222  basecont = *(it - 1);
223 
225  if (it != m_array.end())
226  fullcont = *it;
227 
228  T dcont = fullcont - basecont;
229  if (dcont > 0) {
230  residual_rnd = ((Trandom)(rnd - basecont)) / dcont;
231  if (residual_rnd > 1)
232  residual_rnd = std::nextafter((Trandom)1.0, (Trandom)0.0);
233  } else {
234  residual_rnd = 0.5;
235  }
236 
237  if (it == m_array.end())
238  return size();
239  return std::distance(m_array.begin(), it);
240  };
241 
242 private:
244  inline size_t size() const { return m_array.size(); };
245 
246  // Use ClassDef without virtual functions. Saves 8 bytes per instance
248  1) // TFCS1DFunction_HistogramContent
249 };
250 
251 // Class to represent histogram bin edges. Trandom should be a type with a
252 // floating point range [0,1]
253 template <typename T, typename Trandom = float>
255 public:
257  typedef T value_type;
258  typedef Trandom random_type;
259 
262 
263  std::size_t MemorySizeArray() const { return m_array.MemorySizeArray(); };
264  std::size_t MemorySize() const { return sizeof(*this) + MemorySizeArray(); };
265 
267  void set_nbins(size_t nbins) { m_array.resize(nbins + 1); };
268 
270  inline size_t get_nbins() const { return size() - 1; };
271 
273  void SetBinLowEdge(size_t pos, const T &value) { m_array[pos] = value; };
274 
276  inline const T &GetBinLowEdge(size_t pos) const { return m_array[pos]; };
277 
279  inline const T GetBinLength(size_t pos) const {
280  return GetBinLowEdge(pos + 1) - GetBinLowEdge(pos);
281  };
282 
284  void SetMin(const T &value) { m_array[0] = value; };
285  inline const T &GetMin() const { return m_array[0]; };
286 
288  void SetMax(const T &value) { m_array[get_nbins()] = value; };
289  inline const T &GetMax() const { return m_array[get_nbins()]; };
290 
292  void SetMinMax(const T &valuemin, const T &valuemax) {
293  SetMin(valuemin);
294  SetMax(valuemax);
295  };
296 
298  inline const T Length() const { return GetMax() - GetMin(); };
299 
302  inline T position(size_t pos, const Trandom &drnd) const {
303  return (1 - drnd) * m_array[pos] + drnd * m_array[pos + 1];
304  };
305 
309  inline T position_lin(size_t pos, Trandom m, const Trandom &drnd) const {
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  };
320 
325  inline T position_exp(size_t pos, Trandom beta, const Trandom &drnd) const {
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  };
342 
343 private:
345  inline size_t size() const { return m_array.size(); };
346 
347  // Use ClassDef without virtual functions. Saves 8 bytes per instance
349  1) // TFCS1DFunction_HistogramBinEdges
350 };
351 
353  : public TFCS1DFunction_HistogramBinEdges<float, float> {
354 public:
357 
359  1) // TFCS1DFunction_HistogramFloatBinEdges
360 };
361 
363  : public TFCS1DFunction_HistogramBinEdges<double, double> {
364 public:
367 
369  1) // TFCS1DFunction_HistogramDoubleBinEdges
370 };
371 
372 // Class to represent histogram bin edges, where the interval between GetMin()
373 // and GetMax() can be stored as a different (smaller) data type Tint Trandom
374 // should be a type with a floating point range [0,1]
375 template <typename T, typename Tint, typename Trandom = float>
377 public:
379  typedef T value_type;
380  typedef Trandom random_type;
381  typedef Tint internal_storage_type;
382 
384  : m_array(nbins >= 1 ? nbins - 1 : 0){};
386 
387  std::size_t MemorySizeArray() const { return m_array.MemorySizeArray(); };
388  std::size_t MemorySize() const { return sizeof(*this) + MemorySizeArray(); };
389 
391  void set_nbins(size_t nbins) { m_array.resize(nbins >= 1 ? nbins - 1 : 0); };
392 
394  inline size_t get_nbins() const { return size() + 1; };
395 
398  void SetBinLowEdge(size_t pos, const T &value) {
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  };
410 
413  inline const T GetBinLowEdge(size_t pos) const {
414  if (pos == 0)
415  return GetMin();
416  if (pos >= get_nbins())
417  return GetMax();
418  return GetMin() +
420  m_array[pos - 1]);
421  };
422 
424  inline const T GetBinLength(size_t pos) const {
425  return GetBinLowEdge(pos + 1) - GetBinLowEdge(pos);
426  };
427 
429  void SetMin(const T &value) { m_Min = value; };
430  inline const T &GetMin() const { return m_Min; };
431 
433  void SetMax(const T &value) { m_Max = value; };
434  inline const T &GetMax() const { return m_Max; };
435 
437  void SetMinMax(const T &valuemin, const T &valuemax) {
438  SetMin(valuemin);
439  SetMax(valuemax);
440  };
441 
443  inline const T Length() const { return GetMax() - GetMin(); };
444 
447  inline T position(size_t pos, const Trandom &drnd) const {
448  T pos1 = GetBinLowEdge(pos);
449  T pos2 = GetBinLowEdge(pos + 1);
450  return (1 - drnd) * pos1 + drnd * pos2;
451  };
452 
456 
460  inline T position_lin(size_t pos, Trandom m, const Trandom &drnd) const {
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  };
473 
478  inline T position_exp(size_t pos, Trandom beta, const Trandom &drnd) const {
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  };
495 
496 private:
498  inline size_t size() const { return m_array.size(); };
499  T m_Min{0};
500  T m_Max{0};
501 
503  1) // TFCS1DFunction_HistogramCompactBinEdges
504 };
505 
507  : public TFCS1DFunction_HistogramCompactBinEdges<float, uint8_t, float> {
508 public:
511 
513  1) // TFCS1DFunction_HistogramInt8BinEdges
514 };
515 
517  : public TFCS1DFunction_HistogramCompactBinEdges<float, uint16_t, float> {
518 public:
521  nbins){};
522 
524  1) // TFCS1DFunction_HistogramInt16BinEdges
525 };
526 
528  : public TFCS1DFunction_HistogramCompactBinEdges<float, uint32_t, float> {
529 public:
532  nbins){};
533 
535  1) // TFCS1DFunction_HistogramInt32BinEdges
536 };
537 
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> + ;
545 
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> - ;
551 
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> + ;
558 
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> + ;
562 
563 #pragma link C++ class TFCS1DFunction_HistogramCompactBinEdges < float, \
564  uint8_t, float> + \
565  ;
566 #pragma link C++ class TFCS1DFunction_HistogramCompactBinEdges < float, \
567  uint16_t, float> + \
568  ;
569 #pragma link C++ class TFCS1DFunction_HistogramCompactBinEdges < float, \
570  uint32_t, float> + \
571  ;
572 
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 + ;
578 
579 #endif
580 
581 #endif
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TFCS1DFunction_size_t
uint32_t TFCS1DFunction_size_t
Definition: TFCS1DFunctionTemplateHelpers.h:16
TFCS1DFunction_HistogramCompactBinEdges::Length
const T Length() const
Get length of interval of all bins.
Definition: TFCS1DFunctionTemplateHelpers.h:443
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TFCS1DFunction_Numeric< uint32_t, Tfloat >::ExpandToMaxRange
static uint32_t ExpandToMaxRange(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:72
TFCS1DFunction_HistogramCompactBinEdges::MemorySize
std::size_t MemorySize() const
Definition: TFCS1DFunctionTemplateHelpers.h:388
TFCS1DFunction_HistogramContent::value_type
T value_type
Definition: TFCS1DFunctionTemplateHelpers.h:160
TFCS1DFunction_Numeric::MaxValueFloat
static constexpr Tfloat MaxValueFloat
Definition: TFCS1DFunctionTemplateHelpers.h:22
TFCS1DFunction_HistogramCompactBinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:376
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
TFCS1DFunction_HistogramCompactBinEdges::~TFCS1DFunction_HistogramCompactBinEdges
~TFCS1DFunction_HistogramCompactBinEdges()
Definition: TFCS1DFunctionTemplateHelpers.h:385
TFCS1DFunction_Array::m_content
T * m_content
Definition: TFCS1DFunctionTemplateHelpers.h:132
TFCS1DFunction_HistogramBinEdges::Length
const T Length() const
Get length of interval of all bins.
Definition: TFCS1DFunctionTemplateHelpers.h:298
TFCS1DFunction_HistogramContent::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:244
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TFCS1DFunction_HistogramCompactBinEdges::m_Max
T m_Max
Definition: TFCS1DFunctionTemplateHelpers.h:500
TFCS1DFunction_HistogramInt16BinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:517
TFCS1DFunction_HistogramCompactBinEdges::set_nbins
void set_nbins(size_t nbins)
set number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:391
TFCS1DFunction_HistogramContent::random_type
Trandom random_type
Definition: TFCS1DFunctionTemplateHelpers.h:161
TFCS1DFunction_Array::~TFCS1DFunction_Array
~TFCS1DFunction_Array()
Definition: TFCS1DFunctionTemplateHelpers.h:86
TFCS1DFunction_Array::data
const T * data() const
Definition: TFCS1DFunctionTemplateHelpers.h:116
TFCS1DFunction_HistogramFloatBinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:353
TFCS1DFunction_HistogramBinEdges::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:345
TFCS1DFunction_HistogramBinEdges::SetMax
void SetMax(const T &value)
set and get maximum
Definition: TFCS1DFunctionTemplateHelpers.h:288
TFCS1DFunction_HistogramBinEdges::SetMinMax
void SetMinMax(const T &valuemin, const T &valuemax)
set minimum and maximum
Definition: TFCS1DFunctionTemplateHelpers.h:292
TFCS1DFunction_HistogramInt32BinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:528
TFCS1DFunction_HistogramBinEdges::position_exp
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...
Definition: TFCS1DFunctionTemplateHelpers.h:325
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TFCS1DFunction_HistogramContent::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:166
TFCS1DFunction_HistogramInt8BinEdges::TFCS1DFunction_HistogramInt8BinEdges
TFCS1DFunction_HistogramInt8BinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:509
TFCS1DFunction_HistogramContent::set_nbins
void set_nbins(size_t nbins)
set number of bins.
Definition: TFCS1DFunctionTemplateHelpers.h:198
athena.value
value
Definition: athena.py:124
TFCS1DFunction_Array::operator[]
const T & operator[](size_t pos) const
Definition: TFCS1DFunctionTemplateHelpers.h:121
TFCS1DFunction_HistogramContent::m_array
TFCS1DFunction_Array< T > m_array
Definition: TFCS1DFunctionTemplateHelpers.h:240
TFCS1DFunction_HistogramBinEdges::size_t
TFCS1DFunction_size_t size_t
Definition: TFCS1DFunctionTemplateHelpers.h:256
TFCS1DFunction_Array
Definition: TFCS1DFunctionTemplateHelpers.h:80
TFCS1DFunction_HistogramCompactBinEdges::m_array
TFCS1DFunction_Array< Tint > m_array
Definition: TFCS1DFunctionTemplateHelpers.h:494
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
TFCS1DFunction_HistogramContent::get_nbins
size_t get_nbins() const
return number of bins.
Definition: TFCS1DFunctionTemplateHelpers.h:203
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_HistogramCompactBinEdges::internal_storage_type
Tint internal_storage_type
Definition: TFCS1DFunctionTemplateHelpers.h:381
TFCS1DFunction_HistogramBinEdges::GetBinLowEdge
const T & GetBinLowEdge(size_t pos) const
get position of lower edge of bins
Definition: TFCS1DFunctionTemplateHelpers.h:276
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
TFCS1DFunction_Numeric< uint32_t, Tfloat >::MaxCeilOnlyForInt
static uint32_t MaxCeilOnlyForInt(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:69
TFCS1DFunction_HistogramContent::set_fraction
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].
Definition: TFCS1DFunctionTemplateHelpers.h:171
TFCS1DFunction_Numeric::MaxCeilOnlyForInt
static T MaxCeilOnlyForInt(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:24
TFCS1DFunction_Array::begin
const T * begin() const
Definition: TFCS1DFunctionTemplateHelpers.h:125
TFCS1DFunction_Numeric< uint32_t, Tfloat >::ToNormalizedRange
static Tfloat ToNormalizedRange(const uint32_t value)
Definition: TFCS1DFunctionTemplateHelpers.h:75
TFCS1DFunction_HistogramBinEdges::GetMax
const T & GetMax() const
Definition: TFCS1DFunctionTemplateHelpers.h:289
TFCS1DFunction_HistogramCompactBinEdges::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:387
TFCS1DFunction_HistogramCompactBinEdges::SetMax
void SetMax(const T &value)
set and get maximum
Definition: TFCS1DFunctionTemplateHelpers.h:433
TFCS1DFunction_Array::end
const T * end() const
Definition: TFCS1DFunctionTemplateHelpers.h:129
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TFCS1DFunction_HistogramCompactBinEdges::position_exp
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...
Definition: TFCS1DFunctionTemplateHelpers.h:478
TFCS1DFunction_HistogramBinEdges::GetBinLength
const T GetBinLength(size_t pos) const
get the length of a bin
Definition: TFCS1DFunctionTemplateHelpers.h:279
TFCS1DFunction_HistogramContent::get_binfraction
Trandom get_binfraction(size_t pos) const
Get the content at bin pos as fraction in the range [0,1].
Definition: TFCS1DFunctionTemplateHelpers.h:185
z
#define z
TFCS1DFunction_Numeric< uint8_t, Tfloat >::MaxCeilOnlyForInt
static uint8_t MaxCeilOnlyForInt(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:35
TFCS1DFunction_HistogramCompactBinEdges::GetBinLowEdge
const T GetBinLowEdge(size_t pos) const
get position of lower edge of bins.
Definition: TFCS1DFunctionTemplateHelpers.h:413
TFCS1DFunction_Array::TFCS1DFunction_Array
TFCS1DFunction_Array()
Definition: TFCS1DFunctionTemplateHelpers.h:84
TFCS1DFunction_Numeric::ToNormalizedRange
static Tfloat ToNormalizedRange(const T value)
Definition: TFCS1DFunctionTemplateHelpers.h:26
TFCS1DFunction_HistogramInt16BinEdges::TFCS1DFunction_HistogramInt16BinEdges
TFCS1DFunction_HistogramInt16BinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:519
TFCS1DFunction_HistogramCompactBinEdges::SetMinMax
void SetMinMax(const T &valuemin, const T &valuemax)
set minimum and maximum
Definition: TFCS1DFunctionTemplateHelpers.h:437
TFCS1DFunction_HistogramBinEdges::MemorySizeArray
std::size_t MemorySizeArray() const
Definition: TFCS1DFunctionTemplateHelpers.h:263
TFCS1DFunction_Numeric::ExpandToMaxRange
static T ExpandToMaxRange(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:25
TFCS1DFunction_HistogramContent::get_bin
size_t get_bin(Trandom drnd, Trandom &residual_rnd) const
Get the matching bin for a given random value in the range [0,1).
Definition: TFCS1DFunctionTemplateHelpers.h:208
TFCS1DFunction_HistogramBinEdges::get_nbins
size_t get_nbins() const
return number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:270
TFCS1DFunction_HistogramDoubleBinEdges::TFCS1DFunction_HistogramDoubleBinEdges
TFCS1DFunction_HistogramDoubleBinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:365
TFCS1DFunction_HistogramCompactBinEdges::GetMin
const T & GetMin() const
Definition: TFCS1DFunctionTemplateHelpers.h:430
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
TFCS1DFunction_HistogramBinEdges::MemorySize
std::size_t MemorySize() const
Definition: TFCS1DFunctionTemplateHelpers.h:264
TFCS1DFunction_Numeric< uint16_t, Tfloat >::ExpandToMaxRange
static uint16_t ExpandToMaxRange(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:55
TFCS1DFunction_HistogramInt8BinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:507
TFCS1DFunction_HistogramBinEdges::SetBinLowEdge
void SetBinLowEdge(size_t pos, const T &value)
set position of lower edge of bins
Definition: TFCS1DFunctionTemplateHelpers.h:273
TFCS1DFunction_HistogramBinEdges::position_lin
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...
Definition: TFCS1DFunctionTemplateHelpers.h:309
TFCS1DFunction_Numeric< uint8_t, Tfloat >::ToNormalizedRange
static Tfloat ToNormalizedRange(const uint8_t value)
Definition: TFCS1DFunctionTemplateHelpers.h:41
TFCS1DFunction_HistogramBinEdges::value_type
T value_type
Definition: TFCS1DFunctionTemplateHelpers.h:257
TFCS1DFunction_HistogramContent::TFCS1DFunction_HistogramContent
TFCS1DFunction_HistogramContent(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:163
TFCS1DFunction_HistogramContent::get_fraction
Trandom get_fraction(size_t pos) const
Get the cumulative content at bin pos as fraction in the range [0,1].
Definition: TFCS1DFunctionTemplateHelpers.h:178
TFCS1DFunction_Array::operator[]
T & operator[](size_t pos)
Direct access operators.
Definition: TFCS1DFunctionTemplateHelpers.h:120
TFCS1DFunction_Array::resize
void resize(size_t count)
resize to given count, copying old content
Definition: TFCS1DFunctionTemplateHelpers.h:97
TFCS1DFunction_HistogramBinEdges::TFCS1DFunction_HistogramBinEdges
TFCS1DFunction_HistogramBinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:260
TFCS1DFunction_Array::m_size
size_t m_size
Definition: TFCS1DFunctionTemplateHelpers.h:133
TFCS1DFunction_HistogramContent::MemorySize
std::size_t MemorySize() const
Definition: TFCS1DFunctionTemplateHelpers.h:167
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TFCS1DFunction_Array::TFCS1DFunction_Array
TFCS1DFunction_Array(size_t count)
Definition: TFCS1DFunctionTemplateHelpers.h:85
TFCS1DFunction_HistogramBinEdges::GetMin
const T & GetMin() const
Definition: TFCS1DFunctionTemplateHelpers.h:285
TFCS1DFunction_HistogramBinEdges::m_array
TFCS1DFunction_Array< T > m_array
Definition: TFCS1DFunctionTemplateHelpers.h:341
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TFCS1DFunction_HistogramCompactBinEdges::m_Min
T m_Min
Definition: TFCS1DFunctionTemplateHelpers.h:499
TFCS1DFunction_HistogramContent
Definition: TFCS1DFunctionTemplateHelpers.h:157
TFCS1DFunction_HistogramCompactBinEdges::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:498
TFCS1DFunction_HistogramBinEdges::random_type
Trandom random_type
Definition: TFCS1DFunctionTemplateHelpers.h:258
TFCS1DFunction_Numeric< uint16_t, Tfloat >::MaxCeilOnlyForInt
static uint16_t MaxCeilOnlyForInt(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:52
TFCS1DFunction_HistogramCompactBinEdges::TFCS1DFunction_HistogramCompactBinEdges
TFCS1DFunction_HistogramCompactBinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:383
TFCS1DFunction_HistogramCompactBinEdges::position
T position(size_t pos, const Trandom &drnd) const
return linear interpolated position for bin pos.
Definition: TFCS1DFunctionTemplateHelpers.h:447
TFCS1DFunction_Array::data
T * data()
Direct data pointer.
Definition: TFCS1DFunctionTemplateHelpers.h:115
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TFCS1DFunction_Numeric< uint16_t, Tfloat >::ToNormalizedRange
static Tfloat ToNormalizedRange(const uint16_t value)
Definition: TFCS1DFunctionTemplateHelpers.h:58
TFCS1DFunction_Numeric::MaxValue
static constexpr T MaxValue
Definition: TFCS1DFunctionTemplateHelpers.h:21
TFCS1DFunction_HistogramDoubleBinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:363
TFCS1DFunction_HistogramFloatBinEdges::TFCS1DFunction_HistogramFloatBinEdges
TFCS1DFunction_HistogramFloatBinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:355
TFCS1DFunction_HistogramBinEdges::SetMin
void SetMin(const T &value)
set and get minimum
Definition: TFCS1DFunctionTemplateHelpers.h:284
TFCS1DFunction_Array::size_t
TFCS1DFunction_size_t size_t
Definition: TFCS1DFunctionTemplateHelpers.h:82
TFCS1DFunction_HistogramContent::size_t
TFCS1DFunction_size_t size_t
Definition: TFCS1DFunctionTemplateHelpers.h:159
TFCS1DFunction_HistogramBinEdges::set_nbins
void set_nbins(size_t nbins)
set number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:267
TFCS1DFunction_Array::MemorySize
std::size_t MemorySize() const
Definition: TFCS1DFunctionTemplateHelpers.h:92
TFCS1DFunction_Array::end
T * end()
end() iterators
Definition: TFCS1DFunctionTemplateHelpers.h:128
TFCS1DFunction_Numeric< uint8_t, Tfloat >::ExpandToMaxRange
static uint8_t ExpandToMaxRange(const Tfloat value)
Definition: TFCS1DFunctionTemplateHelpers.h:38
TFCS1DFunction_HistogramCompactBinEdges::GetBinLength
const T GetBinLength(size_t pos) const
get the length of a bin
Definition: TFCS1DFunctionTemplateHelpers.h:424
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
TFCS1DFunction_HistogramBinEdges::position
T position(size_t pos, const Trandom &drnd) const
return linear interpolated position for bin pos.
Definition: TFCS1DFunctionTemplateHelpers.h:302
TFCS1DFunction_HistogramCompactBinEdges::GetMax
const T & GetMax() const
Definition: TFCS1DFunctionTemplateHelpers.h:434
TFCS1DFunction_HistogramCompactBinEdges::position_lin
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,...
Definition: TFCS1DFunctionTemplateHelpers.h:460
TFCS1DFunction_HistogramCompactBinEdges::SetBinLowEdge
void SetBinLowEdge(size_t pos, const T &value)
set position of lower edge of bins.
Definition: TFCS1DFunctionTemplateHelpers.h:398
TFCS1DFunction_Array::size
size_t size() const
Definition: TFCS1DFunctionTemplateHelpers.h:94
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
TFCS1DFunction_HistogramCompactBinEdges::size_t
TFCS1DFunction_size_t size_t
Definition: TFCS1DFunctionTemplateHelpers.h:378
TFCS1DFunction_HistogramCompactBinEdges::get_nbins
size_t get_nbins() const
return number of bins
Definition: TFCS1DFunctionTemplateHelpers.h:394
TFCS1DFunction_HistogramBinEdges
Definition: TFCS1DFunctionTemplateHelpers.h:254
TFCS1DFunction_HistogramCompactBinEdges::SetMin
void SetMin(const T &value)
set and get minimum
Definition: TFCS1DFunctionTemplateHelpers.h:429
readCCLHist.float
float
Definition: readCCLHist.py:83
TFCS1DFunction_Numeric
Converter functions that does nothing for floats.
Definition: TFCS1DFunctionTemplateHelpers.h:19
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
TFCS1DFunction_Array::begin
T * begin()
begin() iterators
Definition: TFCS1DFunctionTemplateHelpers.h:124
TFCS1DFunction_HistogramCompactBinEdges::random_type
Trandom random_type
Definition: TFCS1DFunctionTemplateHelpers.h:380
TFCS1DFunction_HistogramCompactBinEdges::value_type
T value_type
Definition: TFCS1DFunctionTemplateHelpers.h:379
TFCS1DFunction_HistogramBinEdges::~TFCS1DFunction_HistogramBinEdges
~TFCS1DFunction_HistogramBinEdges()
Definition: TFCS1DFunctionTemplateHelpers.h:261
TFCS1DFunction_HistogramInt32BinEdges::TFCS1DFunction_HistogramInt32BinEdges
TFCS1DFunction_HistogramInt32BinEdges(size_t nbins=0)
Definition: TFCS1DFunctionTemplateHelpers.h:530