30 inline Double_t f2(
const Double_t
x,
33 return TMath::Gaus(
y, 0.0,
x, kTRUE);
44 inline Double_t g2(
const Double_t
x,
47 return TMath::Gaus(
y, 0.0,
x, kTRUE) * -
y/
x;
58 inline Double_t G2(
const Double_t
x,
61 return 0.5 * (1.0 + TMath::Erf(sqrt(0.5)*
y/
x));
67 typedef typename function_type::transformer_type transformer_type;
68 typedef typename function_type::result_type result_type;
74 struct JTransformer_t :
75 public transformer_type
77 typedef typename transformer_type::clone_type clone_type;
78 typedef typename transformer_type::argument_type argument_type;
79 typedef typename transformer_type::const_array_type const_array_type;
89 virtual argument_type putXn(const_array_type& buffer,
const argument_type xn)
const
91 return xn * buffer[0];
102 virtual argument_type getXn(const_array_type& buffer,
const argument_type xn)
const
104 return xn / buffer[0];
114 virtual double getWeight(const_array_type& buffer)
const
149 virtual clone_type clone()
const
151 return new JTransformer_t(*
this);
163 int main(
int argc,
char **argv)
175 JParser<> zap(
"Example program to test transformable function.");
184 catch(
const exception &error) {
185 FATAL(error.what() << endl);
188 if (numberOfEvents <= 0) {
189 FATAL(
"No events." << endl);
193 const double xmin = 0.1;
194 const double xmax = 1.0;
195 const double dx = (
xmax -
xmin) / 3;
199 for (
double x =
xmin;
x <
xmax + 0.5*dx;
x += dx) {
201 const double ymin = -5.0 *
xmax;
202 const double ymax = +5.0 *
xmax;
205 for (
double y = ymin;
y < ymax + 0.5*dy;
y += dy) {
210 h2.setExceptionHandler(
new typename function_type::JDefaultResult(
JMATH::zero));
213 h2.transform(JTransformer_t());
225 const double ymin = -5.0 *
xmax;
226 const double ymax = +5.0 *
xmax;
228 for (
int i = 0; i != numberOfEvents; ++i) {
230 const double x = gRandom->Uniform(
xmin,
xmax);
231 const double y = gRandom->Uniform(ymin, ymax);
235 const result_type value = h2(
x,
y);
237 const double f = f2(
x,
y);
238 const double fp = g2(
x,
y);
239 const double v = G2(
x,
y);
241 Q[0].
put(value.f - f);
242 Q[1].
put(value.fp - fp);
243 Q[2].
put(value.v -
v);
245 catch(
const std::exception& error) {}
252 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
253 cout <<
" " << setw(10) << Q[i].
getTitle();
258 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
264 for (
int i = 0; i !=
sizeof(Q)/
sizeof(Q[0]); ++i) {
Various implementations of functional maps.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
int numberOfBins
number of bins for average CDF integral of optical module
Interface for binary input.
Interface for binary output.
const std::string & getTitle() const
Get title.
Utility class to parse command line options.
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
double getWeight(T __begin, T __end)
Get total weight of data points.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.
static const JZero zero
Function object to assign zero value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.