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;
23template <typename T>
24class THnSparseT;
25class TArrayD;
27class TProfile;
28class TProfile2D;
29
30namespace ROOT {
31
32namespace RDF {
33
34struct TH1DModel {
37 int fNbinsX = 128;
38 double fXLow = 0.;
39 double fXUp = 64.;
40 std::vector<double> fBinXEdges;
41
42 TH1DModel() = default;
43 TH1DModel(const TH1DModel &) = default;
44 ~TH1DModel();
45 TH1DModel(const ::TH1D &h);
46 TH1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup);
47 TH1DModel(const char *name, const char *title, int nbinsx, const float *xbins);
48 TH1DModel(const char *name, const char *title, int nbinsx, const double *xbins);
49 std::shared_ptr<::TH1D> GetHistogram() const;
50};
51
52struct TH2DModel {
55 int fNbinsX = 128;
56 double fXLow = 0.;
57 double fXUp = 64.;
58 int fNbinsY = 128;
59 double fYLow = 0.;
60 double fYUp = 64.;
61 std::vector<double> fBinXEdges;
62 std::vector<double> fBinYEdges;
63
64 TH2DModel() = default;
65 TH2DModel(const TH2DModel &) = default;
66 ~TH2DModel();
67 TH2DModel(const ::TH2D &h);
68 TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
69 double yup);
70 TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow, double yup);
71 TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, const double *ybins);
72 TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins);
73 TH2DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins);
74 std::shared_ptr<::TH2D> GetHistogram() const;
75};
76
77struct TH3DModel {
80 int fNbinsX = 128;
81 double fXLow = 0.;
82 double fXUp = 64.;
83 int fNbinsY = 128;
84 double fYLow = 0.;
85 double fYUp = 64.;
86 int fNbinsZ = 128;
87 double fZLow = 0.;
88 double fZUp = 64.;
89 std::vector<double> fBinXEdges;
90 std::vector<double> fBinYEdges;
91 std::vector<double> fBinZEdges;
92
93 TH3DModel() = default;
94 TH3DModel(const TH3DModel &) = default;
95 ~TH3DModel();
96 TH3DModel(const ::TH3D &h);
97 TH3DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
98 double yup, int nbinsz, double zlow, double zup);
99 TH3DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins,
100 int nbinsz, const float *zbins);
101 TH3DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins,
102 int nbinsz, const double *zbins);
103 std::shared_ptr<::TH3D> GetHistogram() const;
104};
105
106struct THnDModel {
109 int fDim;
110 std::vector<int> fNbins;
111 std::vector<double> fXmin;
112 std::vector<double> fXmax;
113 std::vector<std::vector<double>> fBinEdges;
114
115 THnDModel() = default;
116 THnDModel(const THnDModel &) = default;
117 ~THnDModel();
118 THnDModel(const ::THnD &h);
119 THnDModel(const char *name, const char *title, int dim, const int *nbins, const double *xmin, const double *xmax);
120 // alternate version with std::vector to allow more convenient initialization from PyRoot
121 THnDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
122 const std::vector<double> &xmin, const std::vector<double> &xmax);
123 THnDModel(const char *name, const char *title, int dim, const int *nbins,
124 const std::vector<std::vector<double>> &xbins);
125 THnDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
126 const std::vector<std::vector<double>> &xbins);
127 std::shared_ptr<::THnD> GetHistogram() const;
128};
129
133 int fDim;
134 std::vector<int> fNbins;
135 std::vector<double> fXmin;
136 std::vector<double> fXmax;
137 std::vector<std::vector<double>> fBinEdges;
139
140 THnSparseDModel() = default;
143 THnSparseDModel(const ::THnSparseD &h);
144 THnSparseDModel(const char *name, const char *title, int dim, const int *nbins, const double *xmin,
145 const double *xmax, Int_t chunksize = 1024 * 16);
146 // alternate version with std::vector to allow more convenient initialization from PyRoot
147 THnSparseDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
148 const std::vector<double> &xmin, const std::vector<double> &xmax, Int_t chunksize = 1024 * 16);
149 THnSparseDModel(const char *name, const char *title, int dim, const int *nbins,
150 const std::vector<std::vector<double>> &xbins, Int_t chunksize = 1024 * 16);
151 THnSparseDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
152 const std::vector<std::vector<double>> &xbins, Int_t chunksize = 1024 * 16);
153 std::shared_ptr<::THnSparseD> GetHistogram() const;
154};
155
159 int fNbinsX = 128;
160 double fXLow = 0.;
161 double fXUp = 64.;
162 double fYLow = 0.;
163 double fYUp = 0.;
165 std::vector<double> fBinXEdges;
166
167 TProfile1DModel() = default;
170 TProfile1DModel(const ::TProfile &h);
171 TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, const char *option = "");
172 TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, double ylow, double yup,
173 const char *option = "");
174 TProfile1DModel(const char *name, const char *title, int nbinsx, const float *xbins, const char *option = "");
175 TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, const char *option = "");
176 TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, double ylow, double yup,
177 const char *option = "");
178 std::shared_ptr<::TProfile> GetProfile() const;
179};
180
184 int fNbinsX = 128;
185 double fXLow = 0.;
186 double fXUp = 64.;
187 int fNbinsY = 128;
188 double fYLow = 0.;
189 double fYUp = 64.;
190 double fZLow = 0.;
191 double fZUp = 0.;
193 std::vector<double> fBinXEdges;
194 std::vector<double> fBinYEdges;
195
196 TProfile2DModel() = default;
199 TProfile2DModel(const ::TProfile2D &h);
200 TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
201 double yup, const char *option = "");
202 TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
203 double yup, double zlow, double zup, const char *option = "");
204 TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow,
205 double yup, const char *option = "");
206 TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy,
207 const double *ybins, const char *option = "");
208 TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy,
209 const double *ybins, const char *option = "");
210 std::shared_ptr<::TProfile2D> GetProfile() const;
211};
212
213} // ns RDF
214
215} // ns ROOT
216
217#endif // ROOT_RDFHISTOMODELS
#define h(i)
Definition RSha256.hxx:106
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
Array of doubles (64 bits per element).
Definition TArrayD.h:27
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:926
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:400
3-D histogram with a double per channel (see TH1 documentation)
Definition TH3.h:418
Templated implementation of the abstract base THnSparse.
Definition THnSparse.h:216
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:138
A struct which stores some basic parameters of a TH1D.
std::shared_ptr<::TH1D > GetHistogram() const
std::vector< double > fBinXEdges
TH1DModel(const TH1DModel &)=default
A struct which stores some basic 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 some basic 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 some basic 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 some basic parameters of a THnSparseD.
std::vector< std::vector< double > > fBinEdges
std::vector< double > fXmin
std::vector< int > fNbins
THnSparseDModel(const THnSparseDModel &)=default
std::vector< double > fXmax
std::shared_ptr<::THnSparseD > GetHistogram() const
A struct which stores some basic parameters of a TProfile.
std::shared_ptr<::TProfile > GetProfile() const
std::vector< double > fBinXEdges
TProfile1DModel(const TProfile1DModel &)=default
A struct which stores some basic parameters of a TProfile2D.
TProfile2DModel(const TProfile2DModel &)=default
std::vector< double > fBinXEdges
std::shared_ptr<::TProfile2D > GetProfile() const
std::vector< double > fBinYEdges