Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:21

0001 // Author: Enrico Guiraud, Danilo Piparo CERN  09/2017
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_RDFHISTOMODELS
0012 #define ROOT_RDFHISTOMODELS
0013 
0014 #include <TString.h>
0015 #include <memory>
0016 
0017 class TH1D;
0018 class TH2D;
0019 class TH3D;
0020 template <typename T>
0021 class THnT;
0022 using THnD = THnT<double>;
0023 class TProfile;
0024 class TProfile2D;
0025 
0026 namespace ROOT {
0027 
0028 namespace RDF {
0029 
0030 struct TH1DModel {
0031    TString fName;
0032    TString fTitle;
0033    int fNbinsX = 128;
0034    double fXLow = 0.;
0035    double fXUp = 64.;
0036    std::vector<double> fBinXEdges;
0037 
0038    TH1DModel() = default;
0039    TH1DModel(const TH1DModel &) = default;
0040    ~TH1DModel();
0041    TH1DModel(const ::TH1D &h);
0042    TH1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup);
0043    TH1DModel(const char *name, const char *title, int nbinsx, const float *xbins);
0044    TH1DModel(const char *name, const char *title, int nbinsx, const double *xbins);
0045    std::shared_ptr<::TH1D> GetHistogram() const;
0046 };
0047 
0048 struct TH2DModel {
0049    TString fName;
0050    TString fTitle;
0051    int fNbinsX = 128;
0052    double fXLow = 0.;
0053    double fXUp = 64.;
0054    int fNbinsY = 128;
0055    double fYLow = 0.;
0056    double fYUp = 64.;
0057    std::vector<double> fBinXEdges;
0058    std::vector<double> fBinYEdges;
0059 
0060    TH2DModel() = default;
0061    TH2DModel(const TH2DModel &) = default;
0062    ~TH2DModel();
0063    TH2DModel(const ::TH2D &h);
0064    TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
0065              double yup);
0066    TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow, double yup);
0067    TH2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, const double *ybins);
0068    TH2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins);
0069    TH2DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins);
0070    std::shared_ptr<::TH2D> GetHistogram() const;
0071 };
0072 
0073 struct TH3DModel {
0074    TString fName;
0075    TString fTitle;
0076    int fNbinsX = 128;
0077    double fXLow = 0.;
0078    double fXUp = 64.;
0079    int fNbinsY = 128;
0080    double fYLow = 0.;
0081    double fYUp = 64.;
0082    int fNbinsZ = 128;
0083    double fZLow = 0.;
0084    double fZUp = 64.;
0085    std::vector<double> fBinXEdges;
0086    std::vector<double> fBinYEdges;
0087    std::vector<double> fBinZEdges;
0088 
0089    TH3DModel() = default;
0090    TH3DModel(const TH3DModel &) = default;
0091    ~TH3DModel();
0092    TH3DModel(const ::TH3D &h);
0093    TH3DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
0094              double yup, int nbinsz, double zlow, double zup);
0095    TH3DModel(const char *name, const char *title, int nbinsx, const float *xbins, int nbinsy, const float *ybins,
0096              int nbinsz, const float *zbins);
0097    TH3DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, const double *ybins,
0098              int nbinsz, const double *zbins);
0099    std::shared_ptr<::TH3D> GetHistogram() const;
0100 };
0101 
0102 struct THnDModel {
0103    TString fName;
0104    TString fTitle;
0105    int fDim;
0106    std::vector<int> fNbins;
0107    std::vector<double> fXmin;
0108    std::vector<double> fXmax;
0109    std::vector<std::vector<double>> fBinEdges;
0110 
0111    THnDModel() = default;
0112    THnDModel(const THnDModel &) = default;
0113    ~THnDModel();
0114    THnDModel(const ::THnD &h);
0115    THnDModel(const char *name, const char *title, int dim, const int *nbins, const double *xmin, const double *xmax);
0116    // alternate version with std::vector to allow more convenient initialization from PyRoot
0117    THnDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
0118              const std::vector<double> &xmin, const std::vector<double> &xmax);
0119    THnDModel(const char *name, const char *title, int dim, const int *nbins,
0120              const std::vector<std::vector<double>> &xbins);
0121    THnDModel(const char *name, const char *title, int dim, const std::vector<int> &nbins,
0122              const std::vector<std::vector<double>> &xbins);
0123    std::shared_ptr<::THnD> GetHistogram() const;
0124 };
0125 
0126 struct TProfile1DModel {
0127    TString fName;
0128    TString fTitle;
0129    int fNbinsX = 128;
0130    double fXLow = 0.;
0131    double fXUp = 64.;
0132    double fYLow = 0.;
0133    double fYUp = 0.;
0134    TString fOption;
0135    std::vector<double> fBinXEdges;
0136 
0137    TProfile1DModel() = default;
0138    TProfile1DModel(const TProfile1DModel &) = default;
0139    ~TProfile1DModel();
0140    TProfile1DModel(const ::TProfile &h);
0141    TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, const char *option = "");
0142    TProfile1DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, double ylow, double yup,
0143                    const char *option = "");
0144    TProfile1DModel(const char *name, const char *title, int nbinsx, const float *xbins, const char *option = "");
0145    TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, const char *option = "");
0146    TProfile1DModel(const char *name, const char *title, int nbinsx, const double *xbins, double ylow, double yup,
0147                    const char *option = "");
0148    std::shared_ptr<::TProfile> GetProfile() const;
0149 };
0150 
0151 struct TProfile2DModel {
0152    TString fName;
0153    TString fTitle;
0154    int fNbinsX = 128;
0155    double fXLow = 0.;
0156    double fXUp = 64.;
0157    int fNbinsY = 128;
0158    double fYLow = 0.;
0159    double fYUp = 64.;
0160    double fZLow = 0.;
0161    double fZUp = 0.;
0162    TString fOption;
0163    std::vector<double> fBinXEdges;
0164    std::vector<double> fBinYEdges;
0165 
0166    TProfile2DModel() = default;
0167    TProfile2DModel(const TProfile2DModel &) = default;
0168    ~TProfile2DModel();
0169    TProfile2DModel(const ::TProfile2D &h);
0170    TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
0171                    double yup, const char *option = "");
0172    TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy, double ylow,
0173                    double yup, double zlow, double zup, const char *option = "");
0174    TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy, double ylow,
0175                    double yup, const char *option = "");
0176    TProfile2DModel(const char *name, const char *title, int nbinsx, double xlow, double xup, int nbinsy,
0177                    const double *ybins, const char *option = "");
0178    TProfile2DModel(const char *name, const char *title, int nbinsx, const double *xbins, int nbinsy,
0179                    const double *ybins, const char *option = "");
0180    std::shared_ptr<::TProfile2D> GetProfile() const;
0181 };
0182 
0183 } // ns RDF
0184 
0185 } // ns ROOT
0186 
0187 #endif // ROOT_RDFHISTOMODELS