Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JMathSupportkit.cc File Reference

Example program to plot mathematical functions. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JMath/JMathSupportkit.hh"
#include "JROOT/JManager.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to plot mathematical functions.

Author
mdejong

Definition in file JMathSupportkit.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file JMathSupportkit.cc.

24 {
25  using namespace std;
26  using namespace JPP;
27 
28  string outputFile;
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Example program to plot mathematical functions.");
34 
35  zap['o'] = make_field(outputFile) = "math.root";
36  zap['d'] = make_field(debug) = 3;
37 
38  zap(argc, argv);
39  }
40  catch(const exception &error) {
41  FATAL(error.what() << endl);
42  }
43 
44 
45  JManager<int, TH1D> H1(new TH1D("[%]", NULL, 1000, -1.0, +1.0));
46 
47 
48  for (int ix = 1; ix <= H1->GetXaxis()->GetNbins(); ++ix) {
49 
50  const Double_t x = H1->GetXaxis()->GetBinCenter(ix);
51 
52  for (unsigned int n = 0; n <= 5; ++ n) {
53 
54  H1[n]->SetBinContent(ix, legendre(n,x));
55  }
56  }
57 
58 
59  TFile out(outputFile.c_str(), "recreate");
60 
61  out << H1;
62 
63  out.Write();
64  out.Close();
65 
66  return 0;
67 }
Utility class to parse command line options.
Definition: JParser.hh:1500
do rm f tmp H1
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
double legendre(const unsigned int n, const double x)
Legendre polynome.
#define FATAL(A)
Definition: JMessage.hh:67
alias put_queue eval echo n
Definition: qlib.csh:19