Program to create TH1D and fill according given formula.
More...
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TF1.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/JHistogram1D.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 25 of file JGizmo/JHistogram1D.cc.
31 typedef JAbstractHistogram<Double_t> JHistogram_t;
43 JParser<> zap(
"Program to create TH1D and fill according given formula.");
50 zap[
'x'] =
make_field(
X) = JHistogram_t(100, -1.0, +1.0);
55 catch(
const exception &error) {
56 FATAL(error.what() << endl);
60 if ((formula !=
"" && inputFile !=
"") ||
61 (formula ==
"" && inputFile ==
"")) {
62 FATAL(
"Specify input file or formula." << endl);
69 X.getNumberOfBins(),
X.getLowerLimit(),
X.getUpperLimit());
73 TF1 f1(
"f1", formula.c_str());
79 if (numberOfEvents > 0) {
82 h0.FillRandom(f1.GetName(), numberOfEvents);
86 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
87 h0.SetBinContent(ix, f1.Eval(h0.GetXaxis()->GetBinCenter(ix)));
91 }
else if (inputFile !=
"") {
95 ifstream
in(inputFile.c_str());
97 for (
double x;
in >> x; ) {
Utility class to parse command line options.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
int getParameter(const std::string &text)
Get parameter number from text string.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then break fi done getCenter read X Y Z let X
Wrapper class around string.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in