26int main(
int argc,
char **argv)
31 typedef JToken<
';'> JToken_t;
38 size_t numberOfEvents;
52 JParser<> zap(
"Program to create TH3D and fill according given formula.");
72 catch(
const exception &error) {
73 FATAL(error.what() << endl);
77 if ((formula !=
"" && inputFile !=
"") ||
78 (formula ==
"" && inputFile ==
"")) {
79 FATAL(
"Specify input file or formula." << endl);
82 gRandom->SetSeed(seed);
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);
98 TH3D h0(title.c_str(), NULL,
105 TF3
f3(
"f3", formula.c_str(),
113 for (vector<JToken_t>::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
114 f3.FixParameter(getParameter(*i), getValue(*i));
117 if (numberOfEvents > 0) {
123 for (
size_t i = 0; i != numberOfEvents; ++i) {
125 f3.GetRandom3(x, y, z, gRandom);
127 h0.Fill(logx ? log10(x) : x,
129 logz ? log10(z) : z);
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; ) {