Auxiliary class that abstracts true representation of a 2D ROOT histogram parameterized with pt and pseudorapidity. More...
Public Member Functions | |
PtEtaHistogram (YAML::Node const &config) | |
Construct from configuration. | |
double | operator() (double pt, double eta) const |
Retrieves the value from the histogram for the given pt and eta. | |
Static Private Member Functions | |
static std::unique_ptr< TH2 > | ReadHistogram (std::string const &pathsWithNames) |
Reads a histogram with given path and name. | |
Private Attributes | |
std::unique_ptr< TH2 > | histogram_ |
Underlying histogram. | |
bool | orderPtEta_ |
Ordering of dimensions in the underlying 2D histogram. | |
bool | useAbsEta_ |
Indicates that absolute (as opposed to signed) pseudorapidity is used. | |
bool | clipPt_ |
Indicates whether pt should be clipped to a maximal value. | |
double | maxPt_ |
Maximal value of pt for clipping. |
Auxiliary class that abstracts true representation of a 2D ROOT histogram parameterized with pt and pseudorapidity.
The two dimensions of the underlying histogram can be ordered in any way. It can also be parameterized with signed or absolute pseudorapidity. The overflow bins in pt can be filled or be empty, which implies that values from the last pt bins should be used. This class provides a consistent interface to read values from the underlying histogram regardless of these aspects.
PtEtaHistogram::PtEtaHistogram | ( | YAML::Node const & | config | ) |
Construct from configuration.
The configuration must be a mapping with the folowing structure:
{.yaml}
path: {file_path}:{in_file_path}
schema: [{tag1}, {tag2}]
clip_pt: {bool}
Here {file_path}
is path to a ROOT file (which is resolved with FileInPath) and {in_file_path}
is the location of a 2D histogram within that file. {tag1}
and {tag2}
take two of the following supported values: "pt", "eta", "abs_eta"; they describe the dimensions of the histogram. Optional key {clip_pt}
specifies whether pt should be clipped (which is the case if the overflow bins in pt are not set correctly).
std::unique_ptr< TH2 > PtEtaHistogram::ReadHistogram | ( | std::string const & | pathsWithNames | ) | [static, private] |
Reads a histogram with given path and name.
Checks for and reports errors. The returned histogram is owned by the caller.
double PtEtaHistogram::maxPt_ [private] |
Maximal value of pt for clipping.
Only used when clipPt_ is true.