26int main(
int argc, 
char **argv)
 
   31  typedef JToken<
';'>                  JToken_t;
 
   38  size_t            numberOfEvents;
 
   50    JParser<> zap(
"Program to create TH2D and fill according given formula.");
 
   68  catch(
const exception &error) {
 
   69    FATAL(error.what() << endl);
 
   73  if ((formula != 
"" && inputFile != 
"") ||
 
   74      (formula == 
"" && inputFile == 
"")) {
 
   75    FATAL(
"Specify input file or formula." << endl);
 
   78  gRandom->SetSeed(seed);
 
   82  const string::size_type pos = title.rfind(
'/');
 
   84  if (pos != string::npos) {
 
   86    const string dir = title.substr(0, pos);
 
   88    out.mkdir(dir.c_str());
 
   91    title = title.substr(pos + 1);
 
   94  TH2D h0(title.c_str(), NULL,
 
  100    TF2 f2(
"f2", formula.c_str(),
 
  106    for (vector<JToken_t>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
 
  107      f2.FixParameter(getParameter(*i), getValue(*i));
 
  110    if (numberOfEvents > 0) {
 
  116      for (
size_t i = 0; i != numberOfEvents; ++i) {
 
  118        f2.GetRandom2(x, y, gRandom);
 
  120        h0.Fill(logx ? log10(x) : x,
 
  121                logy ? log10(y) : y);
 
  126      for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
 
  127        for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
 
  128          h0.SetBinContent(ix, iy, f2.Eval(h0.GetXaxis()->GetBinCenter(ix),
 
  129                                           h0.GetYaxis()->GetBinCenter(iy)));
 
  133  } 
else if (inputFile != 
"") {
 
  139    ifstream in(inputFile.c_str());
 
  141    for (
double x, y; in >> x >> y; ) {