70{
   72 
   73  string  inputFile;
   75  int     numberOfEvents;
   78 
   79  try {
   80 
   81    JParser<> zap(
"Example program to test conditional probability density function.");
 
   82 
   88 
   89    zap(argc, argv);
   90  }
   91  catch(const exception &error) {
   92    FATAL(error.what() << endl);
 
   93  }
   94 
   95 
   96  if (numberOfEvents <= 0) {
   97    FATAL(
"No events." << endl);
 
   98  }
   99 
  101 
  102 
  103  const double xmin = -10.0;
 
  104  const double xmax = +10.0;
 
  106 
  107 
  109 
  114 
  115    JMultiHistogram_t histogram;
  116 
  118 
  119    for (
double x0 = xmin; x0 <= 
xmax + 0.5*dx; x0 += dx) {
 
  120      for (
double x1 = xmin; x1 <= 
xmax + 0.5*dx; x1 += dx) {
 
  121        for (JGaussHermite::const_iterator x2 = bounds.begin(); x2 != bounds.end(); ++x2) {
  122          for (JGaussHermite::const_iterator x3 = bounds.begin(); x3 != bounds.end(); ++x3) {
  123            histogram[x0][x1][x0 + x2->getX()][x1 + x3->getX()] = 0.0;
  124          }
  125        }
  126      }
  127    }    
  128 
  129    
  130 
  131    JTimer timer(
"histogram");
 
  132 
  133    for (int i = 0; i != numberOfEvents; ++i) {
  134 
  135      if (i%1000 == 0) {
  136        STATUS(
"event: " << setw(10) << i << 
'\r'); 
DEBUG(endl);
 
  137      }
  138 
  139      const double x0 = gRandom->Uniform(xmin, xmax);
  140      const double x1 = gRandom->Uniform(xmin, xmax);
  141      const double x2 = x0 + gRandom->Gaus(0.0, 1.0);
  142      const double x3 = x1 + gRandom->Gaus(0.0, 1.0);
  143      const double w  = 1.0;
  144 
  145      timer.start();
  146 
  147      histogram.fill(x0, x1, x2, x3, w);
  148 
  149      timer.stop();
  150    }
  152 
  153    if (
debug >= status_t) {
 
  154      timer.print(cout, true, micro_t);
  155    }
  156 
  157    try {
  158 
  160 
  162 
  164    }
  167    }
  168  }
  169 
  170 
  171  if (inputFile != "") {
  172 
  175  
  179 
  180    JMultiHistogram_t histogram;
  181 
  182    try {
  183 
  184      NOTICE(
"loading input to file " << inputFile << 
"... " << flush);      
 
  185 
  187 
  189    }
  192    }
  193 
  194 
  197 
  201 
  202 
  203    JMultiFunction_t pdf(histogram);
  204 
  205 
  206    
  207 
  209 
  210    for (int i = 0; i != numberOfEvents; ++i) {
  211      
  212      const double x0 = gRandom->Uniform(xmin, xmax);
  213      const double x1 = gRandom->Uniform(xmin, xmax);
  214      const double x2 = x0 + gRandom->Gaus(0.0, 1.0);
  215      const double x3 = x1 + gRandom->Gaus(0.0, 1.0);
  216      
  217      try {
  218        
  219        const double u = g4 (x0, x1, x2, x3);
  220        const double v = pdf(x0, x1, x2, x3);
  221        
  223      }
  224      catch(const std::exception& error) {}
  225    }
  226    
  227 
  229 
  230    for (JMultiFunction_t::super_const_iterator i = pdf.super_begin(); i != pdf.super_end(); ++i) {
  232    }
  233 
  234    cout << "normalisation " 
  237    cout << "efficiency    " 
  238         << 
FIXED(5,3) << (double) Q.
getCount() / (double) numberOfEvents << endl;
 
  239    
  242  }
  243}
#define DEBUG(A)
Message macros.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
int numberOfBins
number of bins for average CDF integral of optical module
 
Auxiliary class for CPU timing and usage.
 
virtual const char * what() const override
Get error message.
 
Utility class to parse command line options.
 
void store(const std::string &file_name, const T &object)
Store object to output file.
 
void load(const std::string &file_name, T &object)
Load object from input file.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Auxiliary data structure for floating point format specification.
 
Auxiliary data structure for floating point format specification.