Example program to test Legendre polynome.  
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "TRandom3.h"
#include "JMath/JLegendre.hh"
#include "JMath/JMathSupportkit.hh"
#include "JFit/JLegendreEstimator.hh"
#include "JTools/JCollection.hh"
#include "JTools/JElement.hh"
#include "JTools/JQuantile.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 Legendre polynome. 
- Author
 - mdejong 
 
Definition in file JFit/JLegendre.cc.
 
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 26 of file JFit/JLegendre.cc.
   33   typedef JLegendre<double, N>  JLegendre_t;
 
   35   const double xmin = -10.0;
 
   36   const double xmax = +10.0;
 
   38   unsigned int  numberOfEvents;
 
   40   JLegendre_t   f1(xmin, xmax);
 
   46     JParser<> zap(
"Example program to test Legendre polynome.");
 
   56   catch(
const exception &error) {
 
   57     FATAL(error.what() << endl);
 
   61   typedef JCollection< JElement2D<double, double> >  collection_type;
 
   67     const double x = xmin + i * (xmax - xmin) / (
numberOfBins - 1);
 
   72   for (collection_type::const_iterator i = data.begin(); i != data.end(); ++i) {
 
   73     DEBUG(
"data: " << 
FIXED(7,3) << i->getX()  << 
' ' << 
FIXED(7,3) << i->getY() << endl);
 
   77   JEstimator<JLegendre_t> 
g1(data.begin(), data.end());
 
   79   for (
size_t n = 0; 
n != 
g1.size(); ++
n) {
 
   80     STATUS(
"Legendre: " << setw(2) << 
n << 
' ' << 
FIXED(7,3) << 
g1[
n] << endl);
 
   86   if (numberOfEvents > 0) {
 
   88     for (
unsigned int i = 0; i != numberOfEvents; ++i) {
 
   90       const double x = gRandom->Uniform(xmin, xmax);
 
   91       const double y = f1(x);
 
   92       const double z = 
g1(x);
 
  100   ASSERT(numberOfEvents > 0);
 
  104   for (
size_t n = 0; 
n != 
g1.size(); ++
n) {
 
  105     ASSERT(fabs(f1[
n] - 
g1[
n]) <= precision, 
"Legendre: " << setw(2) << n << 
' ' << 
FIXED(7,3) << 
g1[n]);
 
  108   ASSERT(fabs(Q.getMean()) <= precision);
 
  110   ASSERT(Q.getSTDev() <= precision);
 
Utility class to parse command line options. 
 
Auxiliary data structure for floating point format specification. 
 
#define ASSERT(A,...)
Assert macro. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
alias put_queue eval echo n
 
then usage $script[input file[working directory[option]]] nWhere option can be N
 
int numberOfBins
number of bins for average CDF integral of optical module 
 
#define DEBUG(A)
Message macros. 
 
Double_t g1(const Double_t x)
Function.