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) {
 
   65    FATAL(error.what() << endl);
 
   69  if ((formula != 
"" && inputFile != 
"") ||
 
   70      (formula == 
"" && inputFile == 
"")) {
 
   71    FATAL(
"Specify input file or formula." << endl);
 
   74  gRandom->SetSeed(seed);
 
   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);
 
   90  TH1D h0(title.c_str(), NULL,
 
   95    TF1 f1(
"f1", formula.c_str(),
 
   99    for (vector<JToken_t>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
 
  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; ) {