Jpp in_tag_pdf_generation
the software that should make you happy
Loading...
Searching...
No Matches
JBell.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JMath/JBell.hh"
#include "Jeep/JParser.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 Example program to plot Bell function.
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Example program to plot Bell function.

Author
mdejong

Definition at line 19 of file JBell.cc.

20{
21 using namespace std;
22 using namespace JPP;
23
24 string outputFile;
25 double sigma;
26 double alpha;
27 int debug;
28
29 try {
30
31 JParser<> zap("Example program to plot Bell function.");
32
33 zap['o'] = make_field(outputFile) = "";
34 zap['s'] = make_field(sigma) = 1.0;
35 zap['a'] = make_field(alpha);
36 zap['d'] = make_field(debug) = 1;
37
38 zap(argc, argv);
39 }
40 catch(const exception& error) {
41 FATAL(error.what() << endl);
42 }
43
44
45 const JBell bell(0.0, sigma, 1.0, 0.0, alpha);
46
47 TFile out(outputFile.c_str(), "recreate");
48
49 const double xmin = -7.0 * sigma;
50 const double xmax = +7.0 * sigma;
51 const double dx = 1.0e-4 * sigma;
52 const int nx = (int) ((xmax - xmin) / dx);
53
54 TH1D h0("h0", "", nx, xmin, xmax);
55
56 for (Int_t i = 1; i != h0.GetXaxis()->GetNbins(); ++i) {
57
58 const Double_t x = h0.GetXaxis()->GetBinCenter(i);
59 const Double_t y = bell(x);
60
61 h0.SetBinContent(i, y);
62 }
63
64 out.Write();
65 out.Close();
66}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
const double sigma[]
const double xmax
const double xmin
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Bell function object.
Definition JBell.hh:32