17{
20
22
24
26
27 try {
28
29 JParser<> zap(
"Program to test methods of `JROOT::JBinsMap`");
30
34
35 zap(argc, argv);
36 }
37 catch(const exception& error) {
38 FATAL(error.what() << endl);
39 }
40
42
43 unique_ptr<TH1> p;
44
45 if (i->second.find('z') != i->second.cend()) {
47 } else if (i->second.find('y') != i->second.cend()) {
49 } else if (i->second.find('x') != i->second.cend()) {
51 }
52
54
55 const Int_t Ndim = p->GetDimension();
56
57 if (Ndim > 0 && Ndim < 4) {
58
60
61 ASSERT(p->GetXaxis()->GetNbins() == (Int_t) Xbins.size()-1);
62
63 for (Int_t n = 1;
n <= p->GetXaxis()->GetNbins(); ++
n) {
64 DEBUG (p->GetXaxis()->GetBinLowEdge(n) <<
" =?= " << Xbins[n-1] << endl);
65 ASSERT(p->GetXaxis()->GetBinLowEdge(n) == Xbins[n-1]);
66 }
67
68 if (Ndim > 1) {
69
71
72 ASSERT(p->GetYaxis()->GetNbins() == (Int_t) Ybins.size()-1);
73
74 for (Int_t n = 1;
n <= p->GetYaxis()->GetNbins(); ++
n) {
75 DEBUG (p->GetYaxis()->GetBinLowEdge(n) <<
" =?= " << Ybins[n-1] << endl);
76 ASSERT(p->GetYaxis()->GetBinLowEdge(n) == Ybins[n-1]);
77 }
78
79 if (Ndim > 2) {
80
82
83 ASSERT(p->GetZaxis()->GetNbins() == (Int_t) Zbins.size()-1);
84
85 for (Int_t n = 1;
n <= p->GetZaxis()->GetNbins(); ++
n) {
86 DEBUG (p->GetZaxis()->GetBinLowEdge(n) <<
" =?= " << Zbins[n-1] << endl);
87 ASSERT(p->GetZaxis()->GetBinLowEdge(n) == Zbins[n-1]);
88 }
89 }
90 }
91
92 } else {
93 FATAL(
"Unexpected dimensionality for histogram " << p->GetName());
94 }
95 }
96
98
99 ofs << binsMap;
100
101 ofs.close();
102
103 return 0;
104}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
Class for I/O of variable-width binning of multiple histograms.
map_type::const_iterator const_iterator
std::unique_ptr< T > getHistogram(const std::string &name) const
Get histogram with binning corresponding to a given histogram name.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).