#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TH2D.h"
#include "TF2.h"
#include "JLang/JToken.hh"
#include "JTools/JAbstractHistogram.hh"
#include "JGizmo/JGizmoToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Program to create TH1D and fill according given formula.
- Author
- mdejong
Definition in file JGizmo/JHistogram2D.cc.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 25 of file JGizmo/JHistogram2D.cc.
31 typedef JAbstractHistogram<Double_t> JHistogram_t;
43 JParser<> zap(
"Program to create TH1D and fill according given formula.");
49 zap[
'x'] =
make_field(X) = JHistogram_t(100, -1.0, +1.0);
50 zap[
'y'] =
make_field(Y) = JHistogram_t(100, -1.0, +1.0);
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
60 TF2 f2(
"f2", formula.c_str());
70 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
71 Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit());
75 if (numberOfEvents > 0) {
77 h0.FillRandom(f2.GetName(), numberOfEvents);
81 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
82 for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
83 h0.SetBinContent(ix, iy, f2.Eval(h0.GetXaxis()->GetBinCenter(ix),
84 h0.GetYaxis()->GetBinCenter(iy)));