Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
17 class TH1D;
18 class TH2D;
19 class TH3D;
20 class TProfile;
21 class TProfile2D;
22 
23 namespace ROOT {
24 
25 namespace RDF {
26 
27 struct TH1DModel {
28  TString fName;
29  TString fTitle;
30  int fNbinsX = 128;
31  double fXLow = 0.;
32  double fXUp = 64.;
33  std::vector<double> fBinXEdges;
34 
35  TH1DModel() = default;
36  TH1DModel(const TH1DModel &) = default;
37  ~TH1DModel();
38  TH1DModel(const ::TH1D &h);
39  TH1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup);
40  TH1DModel(const char *name, const char *title, int nbinsx, const float *xbins);
41  TH1DModel(const char *name, const char *title, int nbinsx, const double *xbins);
42  std::shared_ptr<::TH1D> GetHistogram() const;
43 };
44 
45 struct TH2DModel {
46  TString fName;
47  TString fTitle;
48  int fNbinsX = 128;
49  double fXLow = 0.;
50  double fXUp = 64.;
51  int fNbinsY = 128;
52  double fYLow = 0.;
53  double fYUp = 64.;
54  std::vector<double> fBinXEdges;
55  std::vector<double> fBinYEdges;
56 
57  TH2DModel() = default;
58  TH2DModel(const TH2DModel &) = default;
59  ~TH2DModel();
60  TH2DModel(const ::TH2D &h);
61  TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
62  double yup);
63  TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow, double yup);
64  TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, const double *ybins);
65  TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins);
66  TH2DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins);
67  std::shared_ptr<::TH2D> GetHistogram() const;
68 };
69 
70 struct TH3DModel {
71  TString fName;
72  TString fTitle;
73  int fNbinsX = 128;
74  double fXLow = 0.;
75  double fXUp = 64.;
76  int fNbinsY = 128;
77  double fYLow = 0.;
78  double fYUp = 64.;
79  int fNbinsZ = 128;
80  double fZLow = 0.;
81  double fZUp = 64.;
82  std::vector<double> fBinXEdges;
83  std::vector<double> fBinYEdges;
84  std::vector<double> fBinZEdges;
85 
86  TH3DModel() = default;
87  TH3DModel(const TH3DModel &) = default;
88  ~TH3DModel();
89  TH3DModel(const ::TH3D &h);
90  TH3DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
91  double yup, int nbinsz, double zlow, double zup);
92  TH3DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins,
93  int nbinsz, const float *zbins);
94  TH3DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins,
95  int nbinsz, const double *zbins);
96  std::shared_ptr<::TH3D> GetHistogram() const;
97 };
98 
99 struct TProfile1DModel {
100  TString fName;
101  TString fTitle;
102  int fNbinsX = 128;
103  double fXLow = 0.;
104  double fXUp = 64.;
105  double fYLow = 0.;
106  double fYUp = 0.;
107  TString fOption;
108  std::vector<double> fBinXEdges;
109 
110  TProfile1DModel() = default;
111  TProfile1DModel(const TProfile1DModel &) = default;
112  ~TProfile1DModel();
113  TProfile1DModel(const ::TProfile &h);
114  TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, const char *option = "");
115  TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, double ylow, double yup,
116  const char *option = "");
117  TProfile1DModel(const char *name, const char *title, int nbinsx, const float *xbins, const char *option = "");
118  TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, const char *option = "");
119  TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, double ylow, double yup,
120  const char *option = "");
121  std::shared_ptr<::TProfile> GetProfile() const;
122 };
123 
124 struct TProfile2DModel {
125  TString fName;
126  TString fTitle;
127  int fNbinsX = 128;
128  double fXLow = 0.;
129  double fXUp = 64.;
130  int fNbinsY = 128;
131  double fYLow = 0.;
132  double fYUp = 64.;
133  double fZLow = 0.;
134  double fZUp = 0.;
135  TString fOption;
136  std::vector<double> fBinXEdges;
137  std::vector<double> fBinYEdges;
138 
139  TProfile2DModel() = default;
140  TProfile2DModel(const TProfile2DModel &) = default;
141  ~TProfile2DModel();
142  TProfile2DModel(const ::TProfile2D &h);
143  TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
144  double yup, const char *option = "");
145  TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
146  double yup, double zlow, double zup, const char *option = "");
147  TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow,
148  double yup, const char *option = "");
149  TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy,
150  const double *ybins, const char *option = "");
151  TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy,
152  const double *ybins, const char *option = "");
153  std::shared_ptr<::TProfile2D> GetProfile() const;
154 };
155 
156 } // ns RDF
157 
158 } // ns ROOT
159 
160 #endif // ROOT_RDFHISTOMODELS