25 int main(
int argc,
char **argv)
31 typedef JAbstractHistogram<Double_t> JHistogram_t;
45 JParser<> zap(
"Program to create TH1D and fill according given formula.");
53 zap[
'x'] =
make_field(
X) = JHistogram_t(100, -1.0, +1.0);
59 catch(
const exception &error) {
60 FATAL(error.what() << endl);
64 if ((formula !=
"" && inputFile !=
"") ||
65 (formula ==
"" && inputFile ==
"")) {
66 FATAL(
"Specify input file or formula." << endl);
72 TH1D h0(title.c_str(), NULL,
73 X.getNumberOfBins(),
X.getLowerLimit(),
X.getUpperLimit());
77 TF1
f1(
"f1", formula.c_str());
83 if (numberOfEvents > 0) {
86 h0.FillRandom(
f1.GetName(), numberOfEvents);
90 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
91 h0.SetBinContent(ix,
f1.Eval(h0.GetXaxis()->GetBinCenter(ix)));
95 }
else if (inputFile !=
"") {
101 ifstream
in(inputFile.c_str());
103 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 main(int argc, char *argv[])
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)...
const JPolynome f1(1.0, 2.0, 3.0)
Function.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options.
Wrapper class around string.
no fit printf nominal n $STRING awk v X