25 int main(
int argc,
char **argv)
30 typedef JToken<';'> JToken_t;
31 typedef JAbstractHistogram<Double_t> JHistogram_t;
44 JParser<> zap(
"Program to create TH1D and fill according given formula.");
51 zap[
'x'] =
make_field(X) = JHistogram_t(100, -1.0, +1.0);
52 zap[
'y'] =
make_field(
Y) = JHistogram_t(100, -1.0, +1.0);
57 catch(
const exception &error) {
58 FATAL(error.what() << endl);
62 if ((formula !=
"" && inputFile !=
"") ||
63 (formula ==
"" && inputFile ==
"")) {
64 FATAL(
"Specify input file or formula." << endl);
71 X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
72 Y.getNumberOfBins(),
Y.getLowerLimit(),
Y.getUpperLimit());
76 TF2 f2(
"f2", formula.c_str());
82 if (numberOfEvents > 0) {
85 h0.FillRandom(f2.GetName(), numberOfEvents);
89 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
90 for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
91 h0.SetBinContent(ix, iy, f2.Eval(h0.GetXaxis()->GetBinCenter(ix),
92 h0.GetYaxis()->GetBinCenter(iy)));
96 }
else if (inputFile !=
"") {
100 ifstream
in(inputFile.c_str());
102 for (
double x, y;
in >> x >> y; ) {
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)...
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Utility class to parse command line options.
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 typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
int main(int argc, char *argv[])