HerdSoftware  0.3.2
BinnedProfile.h
Go to the documentation of this file.
1 /*
2  * BinnedProfile.h
3  *
4  * Created on: 21 Apr 2022
5  * Author: Valerio Formato
6  */
7 
8 #ifndef HERD_BINNEDPROFILE_H
9 #define HERD_BINNEDPROFILE_H
10 
11 #include <vector>
12 
21 template <typename T> struct BinnedProfile {
22 
30  BinnedProfile(unsigned int n, T v) : values(n, v), binEdges(n + 1, 0.0f) {}
31 
37  void SetRange(float start, float end) {
38  for (std::size_t i = 0; i < binEdges.size(); ++i) {
39  binEdges[i] = start + i * (end - start) / binEdges.size();
40  }
41  }
42 
43  std::vector<T> values;
44  std::vector<float> binEdges;
45 };
46 
47 #endif
std::vector< float > binEdges
The bin contents.
Definition: BinnedProfile.h:44
std::vector< T > values
Definition: BinnedProfile.h:43
void SetRange(float start, float end)
Setup the bin edges from a given range.
Definition: BinnedProfile.h:37
BinnedProfile(unsigned int n, T v)
Construct a new binned profile.
Definition: BinnedProfile.h:30
Handler struct for binned profile of various variables.
Definition: BinnedProfile.h:21