26int main(
int argc,
char **argv)
38 size_t numberOfEvents;
48 JParser<> zap(
"Program to create TH1D and fill according given formula.");
64 catch(
const exception &error) {
69 if ((formula !=
"" && inputFile !=
"") ||
70 (formula ==
"" && inputFile ==
"")) {
71 FATAL(
"Specify input file or formula." <<
endl);
78 const string::size_type pos = title.rfind(
'/');
80 if (pos != string::npos) {
82 const string dir = title.substr(0, pos);
84 out.mkdir(dir.c_str());
87 title = title.substr(pos + 1);
91 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit());
95 TF1 f1(
"f1", formula.c_str(),
96 logx ? pow(10.0, X.getLowerLimit()) : X.getLowerLimit(),
97 logx ? pow(10.0, X.getUpperLimit()) : X.getUpperLimit());
100 f1.FixParameter(getParameter(*i), getValue(*i));
103 if (numberOfEvents > 0) {
107 for (
size_t i = 0; i != numberOfEvents; ++i) {
109 const double x = f1.GetRandom(
gRandom);
111 h0.Fill(logx ?
log10(x) : x);
116 for (
Int_t ix = 1;
ix <= h0.GetXaxis()->GetNbins(); ++
ix) {
117 h0.SetBinContent(
ix, f1.Eval(h0.GetXaxis()->GetBinCenter(
ix)));
121 }
else if (inputFile !=
"") {
127 ifstream in(inputFile.c_str());
129 for (
double x; in >> x; ) {