29 fFiles.emplace_back(fileName);
42 "Could not find histogram %s in file %s",
78 for (
const auto& file :
fFiles) {
83 "Could not find histogram %s in file %s",
92 "Histogram %s from file %s is inconsistent with the histogram from file %s",
107 }
else if (ndim == 2) {
109 }
else if (ndim == 3) {
120 static_cast<TH1*
>(h_merged)->
Add(
static_cast<TH1*
>(
h));
148 f->GetObject(
fName.c_str(), hs);
177 const Int_t naxes =
h.GetNdimensions();
178 const Int_t naxes2 = axes.size();
180 if (naxes != naxes2) {
185 const TAxis* ax1 =
h.GetAxis(
i);
186 const TAxis* ax2 = axes[
i];
203 if (h2Array->
fN != fN) {
206 for (
int ibin = 0; ibin < fN; ++ibin) {
225 Int_t dim[1] = {xDim};
233 Int_t dim[2] = {xDim, yDim};
241 Int_t dim[3] = {xDim, yDim, zDim};
Array of doubles (64 bits per element).
Double_t GetAt(Int_t i) const override
Class to manage histogram axis.
const TArrayD * GetXbins() const
void Copy(TObject &axis) const override
Copy axis structure to another axis.
TDirectory::TContext keeps track and restore the current directory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
TH1 is the base class of all histogram classes in ROOT.
Service class for 2-D histogram classes.
The 3-D histogram classes derived from the 1-D histogram classes.
Multidimensional histogram base.
TH1D * Projection(Int_t xDim, Option_t *option="") const
Project all bins into a 1-dimensional histogram, keeping only axis "xDim".
Int_t GetNdimensions() const
THnBase * ProjectionND(Int_t ndim, const Int_t *dim, Option_t *option="") const
TAxis * GetAxis(Int_t dim) const
TAxis * GetAxis(Int_t i) const
Get an axis from the histogram.
std::vector< TAxis * > fAxes
the list of histogram axes
THnBase * ReadHistogram(const char *fileName) const
Retrieve a histogram from a file.
void SetupAxes(THnBase &hs) const
Copy the properties of all axes to a histogram.
THnBase * ProjectionND(Int_t ndim, const Int_t *dim, Option_t *option="") const
See THnBase::Projection for the intended behavior.
TObject * ProjectionAny(Int_t ndim, const Int_t *dim, Option_t *option="") const
Projects all histograms in the chain.
static bool CheckConsistency(const THnBase &h, const std::vector< TAxis * > &axes)
Ensure a histogram has axes similar to the ones we expect.
void AddFile(const char *fileName)
Add a new file to this chain.
TH1 * Projection(Int_t xDim, Option_t *option="") const
See THnBase::Projection for the intended behavior.
std::string fName
name of the histogram
std::vector< std::string > fFiles
a list of files to extract the histogram from
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
TObject()
TObject constructor.
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Comparing floating points.
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.