#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TMath.h"
#include "TRandom.h"
#include "JTools/JHistogram1D.hh"
#include "JTools/JCollection.hh"
#include "JTools/JGrid.hh"
#include "JTools/JSet.hh"
#include "JTools/JQuadrature.hh"
#include "JTools/JFunction1D_t.hh"
#include "JTools/JToolsToolkit.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::JHistogram1D. 
- Author
 - mdejong 
 
Definition in file JTools/JHistogram1D.cc.
 
◆ main()
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 57 of file JTools/JHistogram1D.cc.
   70     JParser<> zap(
"Example program to test 1D histogram.");
 
   81   catch(
const exception &error) {
 
   82     FATAL(error.what() << endl);
 
   86   if (numberOfEvents <= 0) {
 
   87     FATAL(
"No events." << endl);
 
   93   const Int_t    nx   = 1000;
 
   94   const Double_t xmin = -5.0;
 
   95   const Double_t xmax = +5.0;
 
   98   typedef JElement2D<double, double>    JElement_t;
 
  100   JHistogram1D<JElement_t, JCollection> histogram;
 
  106     histogram.configure(
make_grid(numberOfBins, xmin, xmax));
 
  108     histogram.configure(JGaussHermite(numberOfBins));
 
  113   for (
int i = 0; i != numberOfEvents; ++i) {
 
  114     histogram.fill(gRandom->Gaus(0.0, 1.0), 1.0);
 
  117   histogram.div((
double) numberOfEvents);
 
  122   typedef  JSplineFunction1S_t    JFunction1D_t;
 
  139   f1.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
 
  140   F1.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
 
  145   TH1D h0(
"h0", NULL, nx,  xmin, xmax);
 
  146   TH1D h1(
"h1", NULL, nx,  xmin, xmax);
 
  147   TH1D h2(
"h2", NULL, nx,  xmin, xmax);
 
  149   TH1D i0(
"i0", NULL, nx,  xmin, xmax);
 
  150   TH1D i1(
"i1", NULL, nx,  xmin, xmax);
 
  152   for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
 
  154     const Double_t x = h0.GetBinCenter(i);
 
  156     h0.SetBinContent(i, 
g1(x));
 
  157     i0.SetBinContent(i, 
G1(x));
 
  160       h1.SetBinContent(i, 
get_value(F1(x).fp));
 
  164     catch(
const exception& error) {
 
  165       ERROR(error.what() << endl);