diff --git a/tree/dataframe/src/RDFHistoModels.cxx b/tree/dataframe/src/RDFHistoModels.cxx index 8607acd33a714c767f75bac84fd593cfbeb9d2b1..1eda9cd30ad91f3e841b46c53995450449a5ee68 100644 --- a/tree/dataframe/src/RDFHistoModels.cxx +++ b/tree/dataframe/src/RDFHistoModels.cxx @@ -313,6 +313,11 @@ TProfile2DModel::TProfile2DModel(const char *name, const char *title, int nbinsx std::shared_ptr<::TProfile2D> TProfile2DModel::GetProfile() const { + // In this method we decide how to build the profile based on the input given in the constructor of the model. + // There are 4 cases: + // 1. No custom binning for both the x and y axes: we return a profile with equally spaced binning + // 2./3. Custom binning only for x(y): we return a profile with custom binning for x(y) and equally spaced for y(x). + // 4. No custom binning: we return a profile with equally spaced bins on both axes auto xEdgesEmpty = fBinXEdges.empty(); auto yEdgesEmpty = fBinYEdges.empty(); std::shared_ptr<::TProfile2D> prof; diff --git a/tree/dataframe/test/dataframe_histomodels.cxx b/tree/dataframe/test/dataframe_histomodels.cxx index 9dcb5c3074dd4388e5bb03b84c067819384f5518..8e10e7d34863ba6f5b30c7f0641793faec91bd3b 100644 --- a/tree/dataframe/test/dataframe_histomodels.cxx +++ b/tree/dataframe/test/dataframe_histomodels.cxx @@ -18,6 +18,12 @@ void CheckBins(const TAxis *axis, const COLL &v) EXPECT_DOUBLE_EQ(axis->GetBinUpEdge(nBinsm1), (double)v[nBinsm1]); } +/* +These tests help us checking that the binning of the final histograms/profiles is correct. +We test construction of models with full blown histos/profiles and also using constructors +that mimick the ones of those very classes. +*/ + TEST(RDataFrameHistoModels, Histo1D) { ROOT::RDataFrame tdf(10);