26int main(
int argc,
char **argv)
38 size_t numberOfEvents;
52 JParser<> zap(
"Program to create TH3D and fill according given formula.");
72 catch(
const exception &error) {
77 if ((formula !=
"" && inputFile !=
"") ||
78 (formula ==
"" && inputFile ==
"")) {
79 FATAL(
"Specify input file or formula." <<
endl);
86 const string::size_type pos = title.rfind(
'/');
88 if (pos != string::npos) {
90 const string dir = title.substr(0, pos);
92 out.mkdir(dir.c_str());
95 title = title.substr(pos + 1);
99 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
100 Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit(),
101 Z.getNumberOfBins(), Z.getLowerLimit(), Z.getUpperLimit());
105 TF3
f3(
"f3", formula.c_str(),
106 logx ? pow(10.0, X.getLowerLimit()) : X.getLowerLimit(),
107 logx ? pow(10.0, X.getUpperLimit()) : X.getUpperLimit(),
108 logy ? pow(10.0, Y.getLowerLimit()) : Y.getLowerLimit(),
109 logy ? pow(10.0, Y.getUpperLimit()) : Y.getUpperLimit(),
110 logz ? pow(10.0, Z.getLowerLimit()) : Z.getLowerLimit(),
111 logz ? pow(10.0, Z.getUpperLimit()) : Z.getUpperLimit());
114 f3.FixParameter(getParameter(*i), getValue(*i));
117 if (numberOfEvents > 0) {
123 for (
size_t i = 0; i != numberOfEvents; ++i) {
127 h0.Fill(logx ?
log10(x) : x,
134 for (
Int_t ix = 1;
ix <= h0.GetXaxis()->GetNbins(); ++
ix) {
135 for (
Int_t iy = 1;
iy <= h0.GetYaxis()->GetNbins(); ++
iy) {
136 for (
Int_t iz = 1;
iz <= h0.GetZaxis()->GetNbins(); ++
iz) {
138 h0.SetBinContent(
ix,
iy,
iz,
f3.Eval(h0.GetXaxis()->GetBinCenter(
ix),
139 h0.GetYaxis()->GetBinCenter(
iy),
140 h0.GetZaxis()->GetBinCenter(
iz)));
145 }
else if (inputFile !=
"") {
151 ifstream in(inputFile.c_str());
153 for (
double x, y, z; in >> x >> y >> z; ) {