Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add getters to Histo #251

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

## New features since last release

- In expert mode, all `Histo` protected properties like `nbins_` now have getters, e.g. `Manager()->GetPlotManager()->GetHistos()[0]->Nbins()` ([#251](https://github.com/MadAnalysis/madanalysis5/pull/251)).

## Improvements

## Bug fixes

## Contributors

This release contains contributions from (in alphabetical order):

[Bastien Voirin](https://github.com/bastienvoirin)
26 changes: 26 additions & 0 deletions tools/SampleAnalyzer/Process/Plot/Histo.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,32 @@ class Histo : public PlotBase
}
}

/// Histogram arrays
std::vector< std::pair<MAfloat64,MAfloat64> > Histo() { return histo_; }
std::pair<MAfloat64, MAfloat64> Underflow() { return underflow_; }
std::pair<MAfloat64, MAfloat64> Overflow() { return overflow_; }

/// Histogram description
MAuint32 Nbins() { return nbins_; }
MAfloat64 Xmin() { return xmin_; }
MAfloat64 Xmax() { return xmax_; }
MAfloat64 Step() { return step_; }

/// Sum of event-weights over entries
std::pair<MAfloat64,MAfloat64> SumW() { return sum_w_; }

/// Sum of squared weights
std::pair<MAfloat64,MAfloat64> SumWW() { return sum_ww_; }

/// Sum of value * weight
std::pair<MAfloat64,MAfloat64> SumXW() { return sum_xw_; }

/// Sum of value * value * weight
std::pair<MAfloat64,MAfloat64> SumXXW() { return sum_xxw_; }

/// RegionSelections attached to the histo
std::vector<RegionSelection*> Regions() { return regions_; }

/// Write the plot in a ROOT file
virtual void Write_TextFormat(std::ostream* output);

Expand Down