25int main(
int argc,
char **argv)
45 JParser<> zap(
"Program to create TH1D and fill according given formula.");
59 catch(
const exception &error) {
60 FATAL(error.what() << endl);
64 if ((formula !=
"" && inputFile !=
"") ||
65 (formula ==
"" && inputFile ==
"")) {
66 FATAL(
"Specify input file or formula." << endl);
72 const string::size_type pos = title.rfind(
'/');
74 if (pos != string::npos) {
76 const string dir = title.substr(0, pos);
78 out.mkdir(dir.c_str());
81 title = title.substr(pos + 1);
84 TH1D h0(title.c_str(), NULL,
89 TF1 f1(
"f1", formula.c_str());
91 for (vector<JToken_t>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
92 f1.FixParameter(getParameter(*i), getValue(*i));
95 if (numberOfEvents > 0) {
98 h0.FillRandom(f1.GetName(), numberOfEvents);
102 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
103 h0.SetBinContent(ix, f1.Eval(h0.GetXaxis()->GetBinCenter(ix)));
107 }
else if (inputFile !=
"") {
113 ifstream in(inputFile.c_str());
115 for (
double x; in >> x; ) {