Example program to test JTOOLS::JRange operations.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "JTools/JRange.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test JTOOLS::JRange operations.
- Author
- mdejong
Definition in file JRange.cc.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 45 of file JRange.cc.
54 JParser<> zap(
"Example program to test range operations.");
60 catch(
const exception &error) {
61 FATAL(error.what() << endl);
65 const double xmin = -1.0;
66 const double xmax = +1.0;
67 const double dx = (
xmax -
xmin) / 10;
74 JRange_t A(JRange_t::DEFAULT_RANGE());
77 for (
double x =
xmin;
x <
xmax + 0.5 * dx;
x += dx) {
79 DEBUG(setw(
WIDTH) << left <<
"inside" <<
' ' << B <<
' ' << setw(5) <<
x <<
' ' << (B(
x) ?
"Y" :
"N") << endl);
86 DEBUG(setw(
WIDTH) << left <<
"range" <<
' ' << A << endl);
105 const double x1 = -1.0;
106 const double x2 = +0.5;
107 const double x3 = -0.5;
108 const double x4 = +1.0;
113 DEBUG(setw(
WIDTH) << left <<
"join" <<
' ' << A <<
' ' << B <<
" = " <<
join(A,B) << endl);
122 const double x1 = -1.0;
123 const double x2 = -0.5;
124 const double x3 = +0.5;
125 const double x4 = +1.0;
130 DEBUG(setw(
WIDTH) << left <<
"combine" <<
' ' << A <<
' ' << B <<
" = " <<
combine(A,B) << endl);
138 const double x1 = -1.0;
139 const double x2 = -0.5;
140 const double x3 = +0.5;
141 const double x4 = +1.0;
146 DEBUG(setw(
WIDTH) << left <<
"add" <<
' ' << A <<
' ' << B <<
" = " << A + B << endl);
155 __A__() : value(0.0) {}
156 __A__(
const double value) : value(value) {}
158 double get()
const {
return value; }
165 for (
double x =
xmin;
x <
xmax + 0.5 * dx;
x += dx) {
175 DEBUG(setw(
WIDTH) << left <<
"setRange" <<
' ' << A << endl);
176 DEBUG(setw(
WIDTH) << left <<
"setRange" <<
' ' << B << endl);
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
static const double C
Physics constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Type definition of range.
Auxiliary data structure for alignment of data.