25int main(
int argc,
char **argv)
30 typedef JToken<
';'> JToken_t;
46 JParser<> zap(
"Program to create TH2D and fill according given formula.");
61 catch(
const exception &error) {
62 FATAL(error.what() << endl);
66 if ((formula !=
"" && inputFile !=
"") ||
67 (formula ==
"" && inputFile ==
"")) {
68 FATAL(
"Specify input file or formula." << endl);
74 const string::size_type pos = title.rfind(
'/');
76 if (pos != string::npos) {
78 const string dir = title.substr(0, pos);
80 out.mkdir(dir.c_str());
83 title = title.substr(pos + 1);
86 TH2D h0(title.c_str(), NULL,
92 TF2 f2(
"f2", formula.c_str());
94 for (vector<JToken_t>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
95 f2.FixParameter(getParameter(*i), getValue(*i));
98 if (numberOfEvents > 0) {
101 h0.FillRandom(f2.GetName(), numberOfEvents);
105 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
106 for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
107 h0.SetBinContent(ix, iy, f2.Eval(h0.GetXaxis()->GetBinCenter(ix),
108 h0.GetYaxis()->GetBinCenter(iy)));
112 }
else if (inputFile !=
"") {
118 ifstream in(inputFile.c_str());
120 for (
double x, y; in >> x >> y; ) {