25int main(
int argc,
char **argv)
30 typedef JToken<
';'> JToken_t;
47 JParser<> zap(
"Program to create TH2D and fill according given formula.");
63 catch(
const exception &error) {
64 FATAL(error.what() << endl);
68 if ((formula !=
"" && inputFile !=
"") ||
69 (formula ==
"" && inputFile ==
"")) {
70 FATAL(
"Specify input file or formula." << endl);
76 const string::size_type pos = title.rfind(
'/');
78 if (pos != string::npos) {
80 const string dir = title.substr(0, pos);
82 out.mkdir(dir.c_str());
85 title = title.substr(pos + 1);
88 TH3D h0(title.c_str(), NULL,
95 TF3
f3(
"f3", formula.c_str());
97 for (vector<JToken_t>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
98 f3.FixParameter(getParameter(*i), getValue(*i));
101 if (numberOfEvents > 0) {
104 h0.FillRandom(
f3.GetName(), numberOfEvents);
108 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
109 for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
110 for (Int_t iz = 1; iz <= h0.GetZaxis()->GetNbins(); ++iz) {
112 h0.SetBinContent(ix, iy, iz,
f3.Eval(h0.GetXaxis()->GetBinCenter(ix),
113 h0.GetYaxis()->GetBinCenter(iy),
114 h0.GetZaxis()->GetBinCenter(iz)));
119 }
else if (inputFile !=
"") {
125 ifstream in(inputFile.c_str());
127 for (
double x, y, z; in >> x >> y >> z; ) {