Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
HistoModels.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 09/2017
2
3/*************************************************************************
4 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_RDFHISTOMODELS
12#define ROOT_RDFHISTOMODELS
13
14#include <TString.h>
15#include <memory>
16
17class TH1D;
18class TH2D;
19class TH3D;
20template <typename T>
21class THnT;
23class TProfile;
24class TProfile2D;
25
26namespace ROOT {
27
28namespace RDF {
29
30struct TH1DModel {
33 int fNbinsX = 128;
34 double fXLow = 0.;
35 double fXUp = 64.;
36 std::vector<double> fBinXEdges;
37
38 TH1DModel() = default;
39 TH1DModel(const TH1DModel &) = default;
40 ~TH1DModel();
41 TH1DModel(const ::TH1D &h);
42 TH1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup);
43 TH1DModel(const char *name, const char *title, int nbinsx, const float *xbins);
44 TH1DModel(const char *name, const char *title, int nbinsx, const double *xbins);
45 std::shared_ptr<::TH1D> GetHistogram() const;
46};
47
48struct TH2DModel {
51 int fNbinsX = 128;
52 double fXLow = 0.;
53 double fXUp = 64.;
54 int fNbinsY = 128;
55 double fYLow = 0.;
56 double fYUp = 64.;
57 std::vector<double> fBinXEdges;
58 std::vector<double> fBinYEdges;
59
60 TH2DModel() = default;
61 TH2DModel(const TH2DModel &) = default;
62 ~TH2DModel();
63 TH2DModel(const ::TH2D &h);
64 TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
65 double yup);
66 TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow, double yup);
67 TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, const double *ybins);
68 TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins);
69 TH2DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins);
70 std::shared_ptr<::TH2D> GetHistogram() const;
71};
72
73struct TH3DModel {
76 int fNbinsX = 128;
77 double fXLow = 0.;
78 double fXUp = 64.;
79 int fNbinsY = 128;
80 double fYLow = 0.;
81 double fYUp = 64.;
82 int fNbinsZ = 128;
83 double fZLow = 0.;
84 double fZUp = 64.;
85 std::vector<double> fBinXEdges;
86 std::vector<double> fBinYEdges;
87 std::vector<double> fBinZEdges;
88
89 TH3DModel() = default;
90 TH3DModel(const TH3DModel &) = default;
91 ~TH3DModel();
92 TH3DModel(const ::TH3D &h);
93 TH3DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
94 double yup, int nbinsz, double zlow, double zup);
95 TH3DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins,
96 int nbinsz, const float *zbins);
97 TH3DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins,
98 int nbinsz, const double *zbins);
99 std::shared_ptr<::TH3D> GetHistogram() const;
100};
101
102struct THnDModel {
105 int fDim;
106 std::vector<int> fNbins;
107 std::vector<double> fXmin;
108 std::vector<double> fXmax;
109 std::vector<std::vector<double>> fBinEdges;
110
111 THnDModel() = default;
112 THnDModel(const THnDModel &) = default;
113 ~THnDModel();
114 THnDModel(const ::THnD &h);
115 THnDModel(const char *name, const char *title, int dim, const int *nbins, const double *xmin, const double *xmax);
116 // alternate version with std::vector to allow more convenient initialization from PyRoot
117 THnDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
118 const std::vector<double> &xmin, const std::vector<double> &xmax);
119 THnDModel(const char *name, const char *title, int dim, const int *nbins,
120 const std::vector<std::vector<double>> &xbins);
121 THnDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
122 const std::vector<std::vector<double>> &xbins);
123 std::shared_ptr<::THnD> GetHistogram() const;
124};
125
129 int fNbinsX = 128;
130 double fXLow = 0.;
131 double fXUp = 64.;
132 double fYLow = 0.;
133 double fYUp = 0.;
135 std::vector<double> fBinXEdges;
136
137 TProfile1DModel() = default;
140 TProfile1DModel(const ::TProfile &h);
141 TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, const char *option = "");
142 TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, double ylow, double yup,
143 const char *option = "");
144 TProfile1DModel(const char *name, const char *title, int nbinsx, const float *xbins, const char *option = "");
145 TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, const char *option = "");
146 TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, double ylow, double yup,
147 const char *option = "");
148 std::shared_ptr<::TProfile> GetProfile() const;
149};
150
154 int fNbinsX = 128;
155 double fXLow = 0.;
156 double fXUp = 64.;
157 int fNbinsY = 128;
158 double fYLow = 0.;
159 double fYUp = 64.;
160 double fZLow = 0.;
161 double fZUp = 0.;
163 std::vector<double> fBinXEdges;
164 std::vector<double> fBinYEdges;
165
166 TProfile2DModel() = default;
169 TProfile2DModel(const ::TProfile2D &h);
170 TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
171 double yup, const char *option = "");
172 TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
173 double yup, double zlow, double zup, const char *option = "");
174 TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow,
175 double yup, const char *option = "");
176 TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy,
177 const double *ybins, const char *option = "");
178 TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy,
179 const double *ybins, const char *option = "");
180 std::shared_ptr<::TProfile2D> GetProfile() const;
181};
182
183} // ns RDF
184
185} // ns ROOT
186
187#endif // ROOT_RDFHISTOMODELS
#define h(i)
Definition RSha256.hxx:106
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:664
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:338
3-D histogram with a double per channel (see TH1 documentation)
Definition TH3.h:344
Templated implementation of the abstract base THn.
Definition THn.h:219
Profile2D histograms are used to display the mean value of Z and its error for each cell in X,...
Definition TProfile2D.h:27
Profile Histogram.
Definition TProfile.h:32
Basic string class.
Definition TString.h:139
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
A struct which stores the parameters of a TH1D.
std::shared_ptr<::TH1D > GetHistogram() const
std::vector< double > fBinXEdges
TH1DModel(const TH1DModel &)=default
A struct which stores the parameters of a TH2D.
std::vector< double > fBinYEdges
TH2DModel(const TH2DModel &)=default
std::vector< double > fBinXEdges
std::shared_ptr<::TH2D > GetHistogram() const
A struct which stores the parameters of a TH3D.
std::vector< double > fBinZEdges
TH3DModel(const TH3DModel &)=default
std::vector< double > fBinYEdges
std::vector< double > fBinXEdges
std::shared_ptr<::TH3D > GetHistogram() const
A struct which stores the parameters of a THnD.
std::vector< double > fXmax
std::vector< std::vector< double > > fBinEdges
std::shared_ptr<::THnD > GetHistogram() const
THnDModel(const THnDModel &)=default
std::vector< double > fXmin
std::vector< int > fNbins
A struct which stores the parameters of a TProfile.
std::shared_ptr<::TProfile > GetProfile() const
std::vector< double > fBinXEdges
TProfile1DModel(const TProfile1DModel &)=default
A struct which stores the parameters of a TProfile2D.
TProfile2DModel(const TProfile2DModel &)=default
std::vector< double > fBinXEdges
std::shared_ptr<::TProfile2D > GetProfile() const
std::vector< double > fBinYEdges