61 JParser<> zap(
"Example program to test interpolation between 2D tables.");
68 catch(
const exception &error) {
69 FATAL(error.what() << endl);
80 const JGrid<double>
X(NX, -10.0, +10.0);
81 const JGrid<double>
Y(NY, -5.0, +5.0);
82 const JGrid<double> Z(NZ, -5.0, +5.0);
85 typedef JTable2D<NY, NZ> JTable2D_t;
87 typedef JPolintFunction1D<2, JElement2D_t, JGridCollection> JFunction1D_t;
92 for (
int i = 0; i !=
X.getSize(); ++i) {
94 DEBUG(
"table[" << i <<
"]" << endl);
96 const double x =
X.getX(i);
98 JTable2D_t& table = buffer[x];
100 for (
int __i = 0; __i != NY; ++__i) {
101 for (
int __j = 0; __j != NZ; ++__j) {
103 const double y =
Y.getX(__i);
104 const double z = Z.getX(__j);
106 table[__i][__j] =
f3(x,y,z);
117 typedef JMapList<JPolint1FunctionalGridMap> JMaplist_t;
118 typedef JMultiFunction<JGridPolint1Function1D_t, JMaplist_t> JMultiFunction_t;
124 for (JMultiFunction_t::iterator i = g2.begin(); i != g2.end(); ++i) {
125 i->getY().configure(Z);
132 JQuantile f1(
"table");
133 JQuantile f2(
"polint");
136 for (
int i = 0; i != numberOfEvents; ++i) {
138 const double x = gRandom->Uniform(
X.getXmin(),
X.getXmax());
139 const double y = gRandom->Uniform(
Y.getXmin(),
Y.getXmax());
140 const double z = gRandom->Uniform(Z.getXmin(), Z.getXmax());
142 const double v =
f3(x,y,z);
149 const int __i = (int) (
Y.getSize() * (y -
X.getXmin()) / (
Y.getXmax() -
Y.getXmin()));
150 const int __j = (int) (Z.getSize() * (z - Z.getXmin()) / (Z.getXmax() - Z.getXmin()));
152 const double w1 = buffer(x)[__i][__j];
161 const JTable2D_t& table = buffer(x);
163 for (
int __i = 0; __i !=
Y.getSize(); ++__i) {
164 for (
int __j = 0; __j != Z.getSize(); ++__j) {
165 g2.getY(__i).getY(__j) = table[__i][__j];
171 const double w2 = g2(y,z);
180 for (JQuantile buffer[] = { f1, f2, JQuantile() }, *i = buffer; i->getCount() != 0; ++i) {
182 cout << i->getTitle() << endl;
183 cout <<
"mean " <<
SCIENTIFIC(10,2) << i->getMean() << endl;
184 cout <<
"RMS " <<
SCIENTIFIC(10,2) << i->getSTDev() << endl;
187 for (JTimer buffer[] = { t1, t2, JTimer() }, *i = buffer; i->getTitle() !=
""; ++i) {
Utility class to parse command line options.
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
Auxiliary data structure for floating point format specification.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
then break fi done getCenter read X Y Z let X
JTOOLS::JElement2D< double, double > JElement2D_t
double f3(const double x, const double y, const double z)
3D function.
Auxiliary data structure for floating point format specification.
#define DEBUG(A)
Message macros.