37 auto const &bound = node[key];
38 return bound.
is_null() ? defaultValue : bound.val_double();
55 if (default_domain !=
_map.end()) {
56 default_domain->second.populate(ws);
58 for (
const auto &domain :
_map) {
61 domain.second.registerBinnings(domain.first.c_str(), ws);
79 if (default_domain !=
_map.end()) {
80 default_domain->second.writeVariable(var);
87 if (!default_domain_element) {
90 for (
auto &domain : node.
children()) {
91 if (!domain.has_child(
"name")) {
94 auto &
name = domain[
"name"];
101 for (
auto const &domain :
_map) {
111 for (
auto const &domain :
_map) {
112 if (domain.second.hasVariable(
name)) {
130 const int nBins = binning.
numBins();
140 for (
int i = 0; i < nBins; ++i) {
154 readBinning(elem, binning);
159 if (!elem.
edges.empty()) {
161 for (
double edge : elem.
edges) {
172 if (!elem.
edges.empty()) {
173 auto &edges = node[
"edges"].
set_seq();
174 for (
double edge : elem.
edges) {
178 node[
"nbins"] << elem.
nBins;
184 if (found !=
_map.end()) {
185 auto const &elem = found->second;
200 applyBinning(var, elem);
211 if (!node.
has_child(
"type") || node[
"type"].
val() !=
"product_domain") {
214 for (
auto const &varNode : node[
"axes"].
children()) {
217 if (varNode.has_child(
"min")) {
221 if (varNode.has_child(
"max")) {
225 if (varNode.has_child(
"edges")) {
226 elem.hasNBins =
false;
228 for (
auto const &edge : varNode[
"edges"].children()) {
229 elem.edges.push_back(edge.val_double());
231 if (!elem.edges.empty()) {
233 elem.min = elem.edges.front();
237 elem.max = elem.edges.back();
241 }
else if (varNode.has_child(
"nbins")) {
242 elem.nBins = varNode[
"nbins"].val_int();
243 elem.hasNBins = elem.nBins != 0;
252 node[
"type"] <<
"product_domain";
254 auto &variablesNode = node[
"axes"];
256 for (
auto const &item :
_map) {
257 auto const &elem = item.second;
261 writeBinning(varnode, elem);
266 for (
auto const &item :
_map) {
267 const auto &
name = item.first;
269 const auto &elem = item.second;
273 applyBinning(var, elem);
280 for (
auto const &item :
_map) {
281 auto *var = ws.
var(item.first);
286 var->setRange(
name, vMin, vMax);
287 applyBinning(*var, item.second,
name);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Abstract base class for RooRealVar binning definitions.
Int_t numBins() const
Return number of bins.
virtual double binLow(Int_t bin) const =0
virtual bool isUniform() const
virtual double highBound() const =0
virtual double lowBound() const =0
virtual double binHigh(Int_t bin) const =0
bool hasMin(const char *name=nullptr) const
Check if variable has a lower bound.
Implements a RooAbsBinning in terms of an array of boundary values, posing no constraints on the choi...
bool addBoundary(double boundary)
Add bin boundary at given value.
virtual std::string val() const =0
virtual JSONNode & set_map()=0
virtual JSONNode & append_child()=0
virtual JSONNode & set_null()=0
virtual children_view children()
virtual JSONNode & set_seq()=0
virtual bool has_child(std::string const &) const =0
virtual bool is_null() const =0
void registerBinnings(const char *name, RooWorkspace &ws) const
bool hasVariable(const char *name) const
static void writeBinning(RooFit::Detail::JSONNode &node, ProductDomainElement const &elem)
static void readBinning(ProductDomainElement &elem, RooAbsBinning const &binning)
void populate(RooWorkspace &ws) const
static void applyBinning(RooRealVar &var, ProductDomainElement const &elem, const char *name=nullptr)
void readVariable(const RooRealVar &)
void writeJSON(RooFit::Detail::JSONNode &) const
void readJSON(RooFit::Detail::JSONNode const &)
void writeVariable(RooRealVar &) const
void populate(RooWorkspace &ws) const
std::map< std::string, ProductDomain > _map
void writeVariable(RooRealVar &) const
void readVariable(RooRealVar const &)
void writeJSON(RooFit::Detail::JSONNode &) const
void readJSON(RooFit::Detail::JSONNode const &)
bool hasVariable(const char *name) const
static constexpr double infinity()
Return internal infinity representation.
static constexpr int isInfinite(double x)
Return true if x is infinite by RooNumber internal specification.
Variable that can be changed from the outside.
void removeMin(const char *name=nullptr)
Remove lower range limit for binning with given name. Empty name means default range.
void setMin(const char *name, double value, bool shared=true)
Set minimum of name range to given value.
std::list< std::string > getBinningNames() const override
Get a list of all binning names.
void setBins(Int_t nBins, const char *name=nullptr, bool shared=true)
Create a uniform binning under name 'name' for this variable.
void setBinning(const RooAbsBinning &binning, const char *name=nullptr, bool shared=true)
Add given binning under name 'name' with this variable.
void setMax(const char *name, double value, bool shared=true)
Set maximum of name range to given value.
void removeMax(const char *name=nullptr)
Remove upper range limit for binning with given name. Empty name means default range.
const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false, bool shared=true) const override
Return binning definition with name.
Persistable container for RooFit projects.
RooAbsArg * arg(RooStringView name) const
Return RooAbsArg with given name. A null pointer is returned if none is found.
RooRealVar * var(RooStringView name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
bool import(const RooAbsArg &arg, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={})
Import a RooAbsArg object, e.g.
const char * GetName() const override
Returns name of object.
static constexpr auto defaultDomainName
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
std::vector< double > edges