25 int main(
int argc,
char **argv)
31 typedef JAbstractHistogram<Double_t> JHistogram_t;
43 JParser<> zap(
"Program to create TH1D and fill according given formula.");
49 zap[
'x'] =
make_field(X) = JHistogram_t(100, -1.0, +1.0);
50 zap[
'y'] =
make_field(Y) = JHistogram_t(100, -1.0, +1.0);
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
60 TF2 f2(
"f2", formula.c_str());
70 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
71 Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit());
75 if (numberOfEvents > 0) {
77 h0.FillRandom(f2.GetName(), numberOfEvents);
81 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
82 for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
83 h0.SetBinContent(ix, iy, f2.Eval(h0.GetXaxis()->GetBinCenter(ix),
84 h0.GetYaxis()->GetBinCenter(iy)));