25 int main(
int argc,
char **argv)
45 JParser<> zap(
"Program to create TH1D and fill according given formula.");
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 const string::size_type pos = title.rfind(
'/');
74 if (pos != string::npos) {
76 const string dir = title.substr(0, pos);
78 out.mkdir(dir.c_str());
81 title = title.substr(pos + 1);
84 TH1D h0(title.c_str(), NULL,
85 X.getNumberOfBins(),
X.getLowerLimit(),
X.getUpperLimit());
89 TF1
f1(
"f1", formula.c_str());
95 if (numberOfEvents > 0) {
98 h0.FillRandom(
f1.GetName(), numberOfEvents);
102 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
103 h0.SetBinContent(ix,
f1.Eval(h0.GetXaxis()->GetBinCenter(ix)));
107 }
else if (inputFile !=
"") {
113 ifstream
in(inputFile.c_str());
115 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 The output file must have the wildcard in the e g root fi 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
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.