Commit b5ecda31 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Use gsl::owner on TH1F and TH2F in Helpers (NEEDS TESTING)

parent bd093139
......@@ -9,6 +9,7 @@
#pragma once
#include <string>
#include <gsl/gsl>
#include "TEfficiency.h"
#include "TFitResult.h"
......@@ -39,7 +40,8 @@ struct Binning {
/// @param histTitle the title of histogram
/// @param varBinning the binning info of variable
/// @return histogram pointer
TH1F* bookHisto(const char* histName, const char* histTitle,
gsl::owner<TH1F*> bookHisto(
const char* histName, const char* histTitle,
const Binning& varBinning);
/// @brief book a 2D histogram
......@@ -48,7 +50,8 @@ TH1F* bookHisto(const char* histName, const char* histTitle,
/// @param varXBinning the binning info of variable at x axis
/// @param varYBinning the binning info of variable at y axis
/// @return histogram pointer
TH2F* bookHisto(const char* histName, const char* histTitle,
gsl::owner<TH2F*> bookHisto(
const char* histName, const char* histTitle,
const Binning& varXBinning, const Binning& varYBinning);
/// @brief fill a 1D histogram
......
......@@ -11,8 +11,9 @@
#include <gsl/gsl>
namespace Jug::PlotHelpers {
TH1F* bookHisto(const char* histName, const char* histTitle,
const Binning& varBinning) {
gsl::owner<TH1F*> bookHisto(
const char* histName, const char* histTitle,
const Binning& varBinning) {
gsl::owner<TH1F*> hist = new TH1F(histName, histTitle, varBinning.nBins, varBinning.min,
varBinning.max);
hist->GetXaxis()->SetTitle(varBinning.title.c_str());
......@@ -21,8 +22,9 @@ TH1F* bookHisto(const char* histName, const char* histTitle,
return hist;
}
TH2F* bookHisto(const char* histName, const char* histTitle,
const Binning& varXBinning, const Binning& varYBinning) {
gsl::owner<TH2F*> bookHisto(
const char* histName, const char* histTitle,
const Binning& varXBinning, const Binning& varYBinning) {
gsl::owner<TH2F*> hist = new TH2F(histName, histTitle, varXBinning.nBins, varXBinning.min,
varXBinning.max, varYBinning.nBins, varYBinning.min,
varYBinning.max);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment