75T
Slice(
const T &histo, std::vector<Int_t> &args)
77 static_assert(std::is_pointer_v<
decltype(histo.fArray)>,
78 "The type of the histogram to slice must expose the internal array data.");
81 T slicedHisto = histo;
83 using ValueType = std::remove_pointer_t<
decltype(slicedHisto.fArray)>;
84 slicedHisto.template SliceHistoInPlace<ValueType>(args, slicedHisto.fArray, slicedHisto.fN);
99 const std::vector<std::pair<Int_t, Int_t>> &sliceEdges)
101 static_assert(std::is_pointer_v<
decltype(histo.fArray)>,
102 "The type of the histogram to slice must expose the internal array data.");
104 using ValueType = std::remove_pointer_t<
decltype(histo.fArray)>;
205 template <
typename ValueType>
208 constexpr Int_t kMaxDim = 3;
209 Int_t ndim = args.size() / 2;
211 throw std::invalid_argument(
212 Form(
"Number of dimensions in slice (%d) does not match histogram dimension (%d).", ndim,
fDimension));
216 std::array<Int_t, kMaxDim> nBins{}, totalBins{};
217 std::array<std::vector<Double_t>, kMaxDim> edges;
218 for (
decltype(ndim)
d = 0;
d < ndim; ++
d) {
220 auto start = std::max(1, args[
d * 2]);
221 auto end = std::min(axis.GetNbins() + 1, args[
d * 2 + 1]);
223 totalBins[
d] = axis.GetNbins() + 2;
225 args[2 *
d + 1] = end;
228 edges[
d].push_back(axis.GetBinLowEdge(
b));
229 edges[
d].push_back(axis.GetBinUpEdge(end));
233 size_t rowSz = nBins[0] + 2;
234 size_t planeSz = rowSz * (ndim > 1 ? nBins[1] + 2 : 1);
235 size_t newSize = planeSz * (ndim > 2 ? nBins[2] + 2 : 1);
238 auto *newArr =
new ValueType[newSize]();
240 auto rowIncr = 1 + (ndim > 1 ? (rowSz - 1) : 0);
241 ValueType under = 0, over = 0;
242 Bool_t firstUnder =
false;
243 Int_t lastOverIdx = 0;
246 size_t dstIdx = 1 + (ndim > 1 ? rowSz : 0) + (ndim > 2 ? planeSz : 0);
247 for (
auto z = (ndim > 2 ? args[4] : 0); z < (ndim > 2 ? args[5] : 1); ++z) {
248 for (
auto y = (ndim > 1 ? args[2] : 0);
y < (ndim > 1 ? args[3] : 1); ++
y) {
249 size_t rowStart = z * totalBins[1] * totalBins[0] +
y * totalBins[0] + args[0];
250 std::copy_n(dataArray + rowStart, nBins[0], newArr + dstIdx);
252 under = std::accumulate(dataArray, dataArray + rowStart, ValueType{});
255 under += std::accumulate(dataArray + rowStart - args[0], dataArray + rowStart, ValueType{});
257 lastOverIdx = rowStart - args[0] + totalBins[0];
258 over += std::accumulate(dataArray + rowStart + nBins[0], dataArray + lastOverIdx, ValueType{});
262 dstIdx += 2 * rowIncr;
267 over += std::accumulate(dataArray + lastOverIdx, dataArray + fN, ValueType{});
269 newArr[newSize - 1] = over;
277 case 1: this->
SetBins(nBins[0], edges[0].
data());
break;
278 case 2: this->
SetBins(nBins[0], edges[0].
data(), nBins[1], edges[1].
data());
break;
279 case 3: this->
SetBins(nBins[0], edges[0].
data(), nBins[1], edges[1].
data(), nBins[2], edges[2].
data());
break;
286 template <
typename T>
300 template <
typename ValueType>
301 void SetSliceContent(
const std::vector<Double_t> &values,
const std::vector<std::pair<Int_t, Int_t>> &sliceEdges,
302 ValueType *dataArray)
304 const Int_t ndim = sliceEdges.size();
306 throw std::invalid_argument(
Form(
307 "Number of edges in the specified slice (%d) does not match histogram dimension (%d).", ndim,
fDimension));
311 auto getSliceIndices = [](
const std::vector<std::pair<Int_t, Int_t>> &edges) -> std::vector<std::vector<Int_t>> {
312 const auto dim = edges.size();
317 std::vector<std::vector<Int_t>> slices(dim);
318 for (
size_t d = 0;
d < dim; ++
d) {
319 for (
auto val = edges[
d].first; val < edges[
d].second; ++val) {
320 slices[
d].push_back(val);
324 size_t totalCombinations = 1;
325 for (
const auto &slice : slices) {
326 totalCombinations *= slice.size();
329 std::vector<std::vector<Int_t>>
result(totalCombinations, std::vector<Int_t>(3, 0));
330 for (
size_t d = 0;
d < slices.size(); ++
d) {
332 for (
size_t i =
d + 1; i < slices.size(); ++i) {
333 repeat *= slices[i].size();
337 for (
size_t i = 0; i < totalCombinations; ++i) {
346 auto sliceIndices = getSliceIndices(sliceEdges);
348 if (values.size() != sliceIndices.size()) {
349 throw std::invalid_argument(
"Number of provided values does not match number of bins to set.");
352 for (
size_t i = 0; i < sliceIndices.size(); ++i) {
353 auto globalBin = this->
GetBin(sliceIndices[i][0], sliceIndices[i][1], sliceIndices[i][2]);
356 dataArray[globalBin] = values[i];
363 template <
typename T>
365 const std::vector<std::pair<Int_t, Int_t>> &sliceEdges);
709 std::string printValue(TH1 *val);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Style_t
Style number (short).
bool Bool_t
Boolean (0=false, 1=true) (bool).
int Int_t
Signed integer 4 bytes (int).
short Color_t
Color number (short).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
float Float_t
Float 4 bytes (float).
short Short_t
Signed Short integer 2 bytes (short).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TH1C operator+(const TH1C &h1, const TH1C &h2)
TH1C operator-(const TH1C &h1, const TH1C &h2)
TH1C operator/(const TH1C &h1, const TH1C &h2)
TH1C operator*(Double_t c1, const TH1C &h1)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
TVectorT< Double_t > TVectorD
TVectorT< Float_t > TVectorF
TArrayC()
Default TArrayC ctor.
Array of doubles (64 bits per element).
TArrayD()
Default TArrayD ctor.
TArrayF()
Default TArrayF ctor.
TArrayI()
Default TArrayI ctor.
TArrayL64()
Default TArrayL64 ctor.
TArrayS()
Default TArrayS ctor.
Class to manage histogram axis.
Using a TBrowser one can browse all ROOT objects.
Collection abstract base class.
TDirectory::TContext keeps track and restore the current directory.
Describe directory structure in memory.
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
1-D histogram with a byte per channel (see TH1 documentation)
void SetBinsLength(Int_t n=-1) override
TH1C(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
TH1C & operator=(const TH1C &h1)
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
void Copy(TObject &hnew) const override
Copy this to obj.
void AddBinContent(Int_t bin) override
Increment bin content by 1.
void Reset(Option_t *option="") override
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
TH1C(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
TH1C(const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
1-D histogram with a double per channel (see TH1 documentation)
TH1D(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
void SetBinsLength(Int_t n=-1) override
TH1D(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
void Copy(TObject &hnew) const override
Copy this to obj.
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
TH1D(const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
TH1D & operator=(const TH1D &h1)
void Reset(Option_t *option="") override
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w Passing an out-of-range bin leads to undefined behavior.
void AddBinContent(Int_t bin) override
Increment bin content by 1.
1-D histogram with a float per channel (see TH1 documentation)
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
void Reset(Option_t *option="") override
TH1F(const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
TH1F(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
TH1F & operator=(const TH1F &h1)
TH1F(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
void Copy(TObject &hnew) const override
Copy this to obj.
void SetBinsLength(Int_t n=-1) override
1-D histogram with an int per channel (see TH1 documentation)
void SetBinsLength(Int_t n=-1) override
void Reset(Option_t *option="") override
void AddBinContent(Int_t bin) override
Increment bin content by 1.
TH1I(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
TH1I(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
void Copy(TObject &hnew) const override
Copy this to obj.
TH1I & operator=(const TH1I &h1)
TH1I(const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
1-D histogram with a long64 per channel (see TH1 documentation)
TH1L(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
TH1L(const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
TH1L & operator=(const TH1L &h1)
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
void AddBinContent(Int_t bin) override
Increment bin content by 1.
void SetBinsLength(Int_t n=-1) override
void Reset(Option_t *option="") override
TH1L(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
void Copy(TObject &hnew) const override
Copy this to obj.
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
1-D histogram with a short per channel (see TH1 documentation)
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
TH1S & operator=(const TH1S &h1)
TH1S(const char *name, const char *title, Int_t nbinsx, const Float_t *xbins)
TH1S(const char *name, const char *title, Int_t nbinsx, const Double_t *xbins)
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
void Copy(TObject &hnew) const override
Copy this to obj.
void Reset(Option_t *option="") override
void SetBinsLength(Int_t n=-1) override
TH1S(const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup)
void AddBinContent(Int_t bin) override
Increment bin content by 1.
TH1 is the base class of all histogram classes in ROOT.
~TH1() override
Histogram default destructor.
virtual void SavePrimitiveHelp(std::ostream &out, const char *hname, Option_t *option="")
virtual void SetLabelFont(Style_t font=62, Option_t *axis="X")
Set font number used to draw axis labels.
virtual Int_t FindFirstBinAbove(Double_t threshold=0, Int_t axis=1, Int_t firstBin=1, Int_t lastBin=-1) const
virtual Double_t DoIntegral(Int_t ix1, Int_t ix2, Int_t iy1, Int_t iy2, Int_t iz1, Int_t iz2, Double_t &err, Option_t *opt, Bool_t doerr=kFALSE) const
virtual Double_t Integral(Option_t *option="") const
virtual void LabelsInflate(Option_t *axis="X")
virtual Double_t GetBinErrorUp(Int_t bin) const
Double_t * fBuffer
[fBufferSize] entry buffer
virtual Int_t AutoP2FindLimits(Double_t min, Double_t max)
Buffer-based estimate of the histogram range using the power of 2 algorithm.
static void SmoothArray(Int_t NN, Double_t *XX, Int_t ntimes=1)
void SetStatOverflows(EStatOverflows statOverflows)
See GetStatOverflows for more information.
char * GetObjectInfo(Int_t px, Int_t py) const override
Returns string containing info about the object at position (px,py).
virtual void LabelsOption(Option_t *option="h", Option_t *axis="X")
virtual void SetNormFactor(Double_t factor=1)
virtual Color_t GetLabelColor(Option_t *axis="X") const
Return the "axis" label color.
static Bool_t fgStatOverflows
! Flag to use under/overflows in statistics
virtual void SetTitleSize(Float_t size=0.02, Option_t *axis="X")
Set the axis' title size.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
virtual TH1 * FFT(TH1 *h_output, Option_t *option)
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
virtual void Scale(Double_t c1=1, Option_t *option="")
virtual Double_t GetKurtosis(Int_t axis=1) const
Int_t fNcells
Number of bins(1D), cells (2D) +U/Overflows.
virtual void SetBuffer(Int_t bufsize, Option_t *option="")
virtual TH1 * ShowBackground(Int_t niter=20, Option_t *option="same")
virtual Double_t Chi2Test(const TH1 *h2, Option_t *option="UU", Double_t *res=nullptr) const
void Copy(TObject &hnew) const override
Copy this to obj.
virtual Double_t GetCellContent(Int_t binx, Int_t biny) const
void SetTitle(const char *title) override
Set the title of the TNamed.
virtual Double_t GetBinError(Int_t binx, Int_t biny) const
virtual void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr)
Double_t fTsumw
Total Sum of weights.
virtual EBinErrorOpt GetBinErrorOption() const
static Bool_t GetDefaultSumw2()
virtual Float_t GetBarWidth() const
Double_t fTsumw2
Total Sum of squares of weights.
TDirectory * GetDirectory() const
virtual Double_t Chisquare(TF1 *f1, Option_t *option="") const
virtual Double_t GetMinimumStored() const
virtual void ExtendAxis(Double_t x, TAxis *axis)
virtual void SetBinError(Int_t binx, Int_t biny, Double_t error)
virtual void SetError(const Double_t *error)
virtual Float_t GetBarOffset() const
Double_t GetSumOfAllWeights(const bool includeOverflow, Double_t *sumWeightSquare=nullptr) const
TList * fFunctions
->Pointer to list of functions (fits and user)
virtual void RebinAxis(Double_t x, TAxis *axis)
EStatOverflows GetStatOverflows() const
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
static Bool_t fgAddDirectory
! Flag to add histograms to the directory
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
virtual Double_t GetEffectiveEntries() const
virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
virtual Int_t GetMaximumBin() const
static Bool_t RecomputeAxisLimits(TAxis &destAxis, const TAxis &anAxis)
Double_t fTsumwx2
Total Sum of weight*X*X.
void SetSliceContent(const std::vector< Double_t > &values, const std::vector< std::pair< Int_t, Int_t > > &sliceEdges, ValueType *dataArray)
Sets the content of a slice of bins in a histogram.
static void SavePrimitiveFunctions(std::ostream &out, const char *varname, TList *lst)
TH1()
Histogram default constructor.
virtual void DoFillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
virtual TH1 * DrawNormalized(Option_t *option="", Double_t norm=1) const
void UseCurrentStyle() override
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
virtual void SetHighlight(Bool_t set=kTRUE)
virtual Int_t GetNbinsY() const
Short_t fBarOffset
(1000*offset) for bar charts or legos
virtual void AddBinContent(Int_t bin, Double_t w)=0
Increment bin content by a weight w.
static bool CheckBinLimits(const TAxis *a1, const TAxis *a2)
Check bin limits.
virtual Int_t GetNbinsZ() const
virtual Double_t GetNormFactor() const
virtual void SetContour(Int_t nlevels, const Double_t *levels=nullptr)
virtual void ResetStats()
virtual void SetStats(Bool_t stats=kTRUE)
virtual void Normalize(Option_t *option="")
virtual void SetXTitle(const char *title)
virtual Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const
virtual Double_t GetContourLevel(Int_t level) const
EStatOverflows
Enumeration specifying the way to treat statoverflow.
@ kNeutral
Adapt to the global flag.
@ kIgnore
Override global flag ignoring the overflows.
@ kConsider
Override global flag considering the overflows.
virtual Int_t GetDimension() const
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
virtual Double_t GetBinContent(Int_t bin, Int_t) const
EStatusBits
TH1 status bits.
@ kLogX
X-axis in log scale.
@ kIsAverage
Bin contents are average (used by Add).
@ kNoTitle
Don't draw the histogram title.
@ kUserContour
User specified contour levels.
@ kNoStats
Don't draw stats box.
@ kIsZoomed
Bit set when zooming on Y axis.
@ kAutoBinPTwo
different than 1.
@ kIsNotW
Histogram is forced to be not weighted even when the histogram is filled with weighted.
@ kIsHighlight
bit set if histo is highlight
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
static void StatOverflows(Bool_t flag=kTRUE)
TDirectory * fDirectory
! Pointer to directory holding this histogram
Option_t * GetOption() const override
virtual void Rebuild(Option_t *option="")
virtual void GetCenter(Double_t *center) const
void SetNameTitle(const char *name, const char *title) override
Set all the TNamed parameters (name and title).
TH1 * GetCumulative(Bool_t forward=kTRUE, const char *suffix="_cumulative") const
static Double_t AutoP2GetPower2(Double_t x, Bool_t next=kTRUE)
Auxiliary function to get the power of 2 next (larger) or previous (smaller) a given x.
virtual Int_t GetNcells() const
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Int_t GetBufferLength() const
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax)
virtual Style_t GetTitleFont(Option_t *axis="X") const
Return the "axis" title font.
virtual void SetNdivisions(Int_t n=510, Option_t *axis="X")
Set the number of divisions to draw an axis.
virtual void LabelsDeflate(Option_t *axis="X")
virtual Style_t GetLabelFont(Option_t *axis="X") const
Return the "axis" label font.
virtual Float_t GetTickLength(Option_t *axis="X") const
Return the "axis" tick length.
Int_t GetBufferSize() const
virtual Double_t GetSumOfWeights() const
Return the sum of weights across all bins excluding under/overflows.
TVirtualHistPainter * GetPainter(Option_t *option="")
TObject * FindObject(const char *name) const override
Must be redefined in derived classes.
virtual Float_t GetTitleSize(Option_t *axis="X") const
Return the "axis" title size.
void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr)
void Print(Option_t *option="") const override
This method must be overridden when a class wants to print itself.
virtual void Eval(TF1 *f1, Option_t *option="")
virtual void GetBinXYZ(Int_t binglobal, Int_t &binx, Int_t &biny, Int_t &binz) const
virtual Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
Double_t GetRMSError(Int_t axis=1) const
virtual Int_t GetNbinsX() const
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetDirectory(TDirectory *dir)
virtual Double_t ComputeIntegral(Bool_t onlyPositive=false, Option_t *option="")
virtual void FillN(Int_t, const Double_t *, const Double_t *, const Double_t *, Int_t)
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2),...
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
Double_t fMaximum
Maximum value for plotting.
Int_t fBufferSize
fBuffer size
virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Double_t &err, Option_t *option="") const
TString ProvideSaveName(Option_t *option, Bool_t testfdir=kFALSE)
Int_t fDimension
! Histogram dimension (1, 2 or 3 dim)
virtual void SetBins(Int_t nx, const Double_t *xBins, Int_t ny, const Double_t *yBins, Int_t nz, const Double_t *zBins)
virtual Int_t GetMinimumBin(Int_t &locmix, Int_t &locmiy, Int_t &locmiz) const
EBinErrorOpt fBinStatErrOpt
Option for bin statistical errors.
static Int_t fgBufferSize
! Default buffer size for automatic histograms
TObject * FindObject(const TObject *obj) const override
Must be redefined in derived classes.
virtual void SetBinsLength(Int_t=-1)
Double_t fNormFactor
Normalization factor.
EInconsistencyBits
Enumeration specifying inconsistencies between two histograms, in increasing severity.
virtual Double_t GetMeanError(Int_t axis=1) const
Long64_t Merge(TCollection *list, Option_t *option)
virtual UInt_t SetCanExtend(UInt_t extendBitMask)
static Bool_t SameLimitsAndNBins(const TAxis &axis1, const TAxis &axis2)
TArrayD fContour
Array to display contour levels.
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
virtual void SetContent(const Double_t *content)
virtual TH1 * RebinX(Int_t ngroup=2, const char *newname="")
void Browse(TBrowser *b) override
Browse the Histogram object.
virtual Double_t GetBinContent(Int_t bin, Int_t, Int_t) const
virtual Double_t GetBinCenter(Int_t bin) const
virtual Double_t GetBinWidth(Int_t bin) const
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax, Int_t ny, Double_t ymin, Double_t ymax, Int_t nz, Double_t zmin, Double_t zmax)
virtual Bool_t Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="")
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
virtual Float_t GetLabelSize(Option_t *axis="X") const
Return the "axis" label size.
void Draw(Option_t *option="") override
Default Draw method for all objects.
Short_t fBarWidth
(1000*width) for bar charts or legos
virtual Double_t GetBinErrorSqUnchecked(Int_t bin) const
virtual Double_t GetCellError(Int_t binx, Int_t biny) const
virtual Int_t GetNdivisions(Option_t *axis="X") const
Return the number of divisions for "axis".
virtual void SetBins(Int_t nx, const Double_t *xBins)
Int_t AxisChoice(Option_t *axis) const
Choose an axis according to "axis".
virtual void SetMinimum(Double_t minimum=-1111)
Bool_t IsBinUnderflow(Int_t bin, Int_t axis=0) const
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
virtual Double_t Interpolate(Double_t x, Double_t y) const
virtual void DirectoryAutoAdd(TDirectory *)
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t Multiply(TF1 *f1, Double_t c1=1)
virtual void SetCellContent(Int_t binx, Int_t biny, Double_t content)
static bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
Check that axis have same labels.
virtual void GetMinimumAndMaximum(Double_t &min, Double_t &max) const
Bool_t IsBinOverflow(Int_t bin, Int_t axis=0) const
UInt_t GetAxisLabelStatus() const
Double_t GetRMS(Int_t axis=1) const
This function returns the Standard Deviation (Sigma) of the distribution not the Root Mean Square (RM...
virtual Double_t GetStdDevError(Int_t axis=1) const
Double_t * fIntegral
! Integral of bins used by GetRandom
Double_t fMinimum
Minimum value for plotting.
virtual void SetBarWidth(Float_t width=0.5)
virtual void SetBinError(Int_t bin, Double_t error)
virtual Int_t GetQuantiles(Int_t n, Double_t *xp, const Double_t *p=nullptr)
TH1 & operator=(const TH1 &)=delete
virtual Double_t GetEntries() const
virtual void Smooth(Int_t ntimes=1, Option_t *option="")
virtual Int_t Fill(Double_t x)
static void SetDefaultBufferSize(Int_t bufsize=1000)
virtual Int_t GetMinimumBin() const
void Build()
Creates histogram basic data structure.
const TAxis * GetZaxis() const
virtual Double_t RetrieveBinContent(Int_t bin) const =0
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
static TH1 * TransformHisto(TVirtualFFT *fft, TH1 *h_output, Option_t *option)
virtual void SetZTitle(const char *title)
virtual Int_t BufferFill(Double_t x, Double_t w)
accumulate arguments in buffer.
virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
virtual Double_t Interpolate(Double_t x) const
TList * GetListOfFunctions() const
void SetName(const char *name) override
Set the name of the TNamed.
virtual Float_t GetTitleOffset(Option_t *axis="X") const
Return the "axis" title offset.
virtual Double_t GetBinWithContent(Double_t c, Int_t &binx, Int_t firstx=0, Int_t lastx=0, Double_t maxdiff=0) const
void Paint(Option_t *option="") override
This method must be overridden if a class wants to paint itself.
virtual Bool_t Divide(TF1 *f1, Double_t c1=1)
virtual void SetBarOffset(Float_t offset=0.25)
@ kNstat
Size of statistics data (up to TProfile3D).
virtual Double_t AndersonDarlingTest(const TH1 *h2, Option_t *option="") const
virtual void PutStats(Double_t *stats)
virtual void SetBinContent(Int_t bin, Int_t, Int_t, Double_t content)
virtual void Reset(Option_t *option="")
virtual Int_t Fill(const char *name, Double_t w)
virtual Double_t Chi2TestX(const TH1 *h2, Double_t &chi2, Int_t &ndf, Int_t &igood, Option_t *option="UU", Double_t *res=nullptr) const
virtual void SetBinErrorOption(EBinErrorOpt type)
virtual Double_t GetBinErrorLow(Int_t bin) const
virtual Double_t GetSkewness(Int_t axis=1) const
virtual Double_t GetStdDev(Int_t axis=1) const
virtual Int_t FindLastBinAbove(Double_t threshold=0, Int_t axis=1, Int_t firstBin=1, Int_t lastBin=-1) const
const TAxis * GetXaxis() const
virtual Double_t GetMaximumStored() const
virtual Double_t AndersonDarlingTest(const TH1 *h2, Double_t &advalue) const
virtual void SetBins(Int_t nx, const Double_t *xBins, Int_t ny, const Double_t *yBins)
virtual Double_t GetBinError(Int_t bin) const
virtual const TArrayD * GetSumw2() const
static Int_t AutoP2GetBins(Int_t n)
Auxiliary function to get the next power of 2 integer value larger then n.
Double_t fEntries
Number of entries.
virtual Long64_t Merge(TCollection *list)
virtual Bool_t Multiply(const TH1 *h1)
virtual Bool_t CanExtendAllAxes() const
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
virtual Double_t GetBinLowEdge(Int_t bin) const
static Int_t FitOptionsMake(Option_t *option, Foption_t &Foption)
TAxis fZaxis
Z axis descriptor.
EStatOverflows fStatOverflows
Per object flag to use under/overflows in statistics.
virtual void FillRandom(TH1 *h, Int_t ntimes=5000, TRandom *rng=nullptr)
virtual Float_t GetLabelOffset(Option_t *axis="X") const
Return the "axis" label offset.
static bool CheckEqualAxes(const TAxis *a1, const TAxis *a2)
Check that the axis are the same.
EBinErrorOpt
Enumeration specifying type of statistics for bin errors.
@ kPoisson2
Errors from Poisson interval at 95% CL (~ 2 sigma).
@ kNormal
Errors with Normal (Wald) approximation: errorUp=errorLow= sqrt(N).
@ kPoisson
Errors from Poisson interval at 68.3% (1 sigma).
virtual TArrayD * GetSumw2()
virtual Double_t GetContourLevelPad(Int_t level) const
TAxis fXaxis
X axis descriptor.
virtual void SetColors(Color_t linecolor=-1, Color_t markercolor=-1, Color_t fillcolor=-1)
virtual void SetTitleOffset(Float_t offset=1, Option_t *axis="X")
Specify a parameter offset to control the distance between the axis and the axis' title.
virtual Int_t GetMaximumBin(Int_t &locmax, Int_t &locmay, Int_t &locmaz) const
const Double_t * GetBuffer() const
virtual Bool_t IsHighlight() const
virtual void SetLabelColor(Color_t color=1, Option_t *axis="X")
Set axis labels color.
virtual Double_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const
virtual Double_t GetRandom(TRandom *rng=nullptr, Option_t *option="") const
virtual Bool_t Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="")
virtual Bool_t Divide(const TH1 *h1)
virtual void SetAxisColor(Color_t color=1, Option_t *axis="X")
Set color to draw the axis line and tick marks.
const TAxis * GetYaxis() const
TArrayD fSumw2
Array of sum of squares of weights.
virtual void SetOption(Option_t *option=" ")
TH1 * GetAsymmetry(TH1 *h2, Double_t c2=1, Double_t dc2=0)
virtual void SetBinError(Int_t binx, Int_t biny, Int_t binz, Double_t error)
virtual void SetAxisRange(Double_t xmin, Double_t xmax, Option_t *axis="X")
Set the "axis" range.
virtual void SetYTitle(const char *title)
virtual TH1 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=nullptr)
virtual TF1 * GetFunction(const char *name) const
virtual Int_t GetSumw2N() const
virtual void SetCellError(Int_t binx, Int_t biny, Double_t content)
virtual Bool_t FindNewAxisLimits(const TAxis *axis, const Double_t point, Double_t &newMin, Double_t &newMax)
virtual void GetLowEdge(Double_t *edge) const
Bool_t GetStatOverflowsBehaviour() const
void SaveAs(const char *filename="hist", Option_t *option="") const override
Save this object in the file specified by filename.
virtual Double_t GetBinContent(Int_t bin) const
virtual void SetTitleFont(Style_t font=62, Option_t *axis="X")
Set the axis' title font.
virtual void ClearUnderflowAndOverflow()
virtual void SetBinContent(Int_t bin, Double_t content)
virtual Color_t GetAxisColor(Option_t *axis="X") const
Return the number of divisions for "axis".
virtual void AddBinContent(Int_t bin)=0
Increment bin content by 1.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
virtual Double_t Interpolate(Double_t x, Double_t y, Double_t z) const
int LoggedInconsistency(const char *name, const TH1 *h1, const TH1 *h2, bool useMerge=false) const
static bool CheckConsistentSubAxes(const TAxis *a1, Int_t firstBin1, Int_t lastBin1, const TAxis *a2, Int_t firstBin2=0, Int_t lastBin2=0)
Check that two sub axis are the same.
static Int_t CheckConsistency(const TH1 *h1, const TH1 *h2)
Check histogram compatibility.
void RecursiveRemove(TObject *obj) override
Recursively remove this object from a list.
TAxis fYaxis
Y axis descriptor.
virtual TFitResultPtr Fit(TF1 *f1, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
TVirtualHistPainter * fPainter
! Pointer to histogram painter
virtual void GetStats(Double_t *stats) const
virtual void SetBinContent(Int_t bin, Int_t, Double_t content)
virtual void SetLabelSize(Float_t size=0.02, Option_t *axis="X")
Set size of axis' labels.
virtual void SetEntries(Double_t n)
virtual void Sumw2(Bool_t flag=kTRUE)
static bool CheckAxisLimits(const TAxis *a1, const TAxis *a2)
Check that the axis limits of the histograms are the same.
static Bool_t AddDirectoryStatus()
Check whether TH1-derived classes should register themselves to the current gDirectory.
static Bool_t fgDefaultSumw2
! Flag to call TH1::Sumw2 automatically at histogram creation time
virtual void UpdateBinContent(Int_t bin, Double_t content)=0
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
virtual Double_t GetMean(Int_t axis=1) const
virtual Double_t * GetIntegral()
void SliceHistoInPlace(std::vector< Int_t > &args, ValueType *&dataArray, Int_t &fN)
Slices a histogram in place based on the specified bin ranges for each dimension.
Double_t fTsumwx
Total Sum of weight*X.
virtual Int_t Fill(Double_t x, Double_t w)
TString fOption
Histogram options.
static Int_t GetDefaultBufferSize()
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
virtual void SetContourLevel(Int_t level, Double_t value)
virtual Double_t Integral(Int_t binx1, Int_t binx2, Option_t *option="") const
@ kNoAxis
NOTE: Must always be 0 !!!
virtual void SetTickLength(Float_t length=0.02, Option_t *axis="X")
Set the axis' tick marks length.
virtual Int_t GetContour(Double_t *levels=nullptr)
Bool_t TestBit(UInt_t f) const
TObject()
TObject constructor.
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
Use this method to declare a method obsolete.
This is the base class for the ROOT Random number generators.
TVirtualFFT is an interface class for Fast Fourier Transforms.
Abstract interface to a histogram painter.
T Slice(const T &histo, std::vector< Int_t > &args)
Creates a sliced copy of the given histogram.
void SetSliceContent(T &histo, const std::vector< Double_t > &input, const std::vector< std::pair< Int_t, Int_t > > &sliceEdges)
Sets the content of a slice in a histogram.