-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathDomains.h
More file actions
90 lines (70 loc) · 2.35 KB
/
Copy pathDomains.h
File metadata and controls
90 lines (70 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Project: RooFit
* Authors:
* Jonas Rembser, CERN, Jan 2023
*
* Copyright (c) 2023, CERN
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted according to the terms
* listed in LICENSE (http://roofit.sourceforge.net/license.txt)
*/
#ifndef RooFit_JSONIO_Detail_Domains_h
#define RooFit_JSONIO_Detail_Domains_h
#include <string>
#include <map>
#include <vector>
class RooAbsBinning;
class RooRealVar;
class RooWorkspace;
namespace RooFit {
namespace Detail {
class JSONNode;
class JSONTree;
} // namespace Detail
} // namespace RooFit
namespace RooFit {
namespace JSONIO {
namespace Detail {
class Domains {
public:
void readVariable(const char *name, double min, double max, const char *domain);
void readVariable(const char *name, double min, double max);
void readVariable(RooRealVar const &);
void writeVariable(RooRealVar &) const;
void readJSON(RooFit::Detail::JSONNode const &);
void writeJSON(RooFit::Detail::JSONNode &) const;
bool hasVariable(const char *name) const;
void populate(RooWorkspace &ws) const;
class ProductDomain {
public:
void readVariable(const RooRealVar &);
void readVariable(const char *name, RooAbsBinning const &binning);
void readVariable(const char *name, double min, double max);
void writeVariable(RooRealVar &) const;
void readJSON(RooFit::Detail::JSONNode const &);
void writeJSON(RooFit::Detail::JSONNode &) const;
bool hasVariable(const char *name) const;
void populate(RooWorkspace &ws) const;
void registerBinnings(const char *name, RooWorkspace &ws) const;
private:
struct ProductDomainElement {
bool hasMin = false;
bool hasMax = false;
double min = 0.0;
double max = 0.0;
bool hasNBins = false;
int nBins = 0;
std::vector<double> edges;
};
static void applyBinning(RooRealVar &var, ProductDomainElement const &elem, const char *name = nullptr);
static void readBinning(ProductDomainElement &elem, RooAbsBinning const &binning);
static void writeBinning(RooFit::Detail::JSONNode &node, ProductDomainElement const &elem);
std::map<std::string, ProductDomainElement> _map;
};
std::map<std::string, ProductDomain> _map;
};
} // namespace Detail
} // namespace JSONIO
} // namespace RooFit
#endif