Jpp - the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JMath
JMathSupportkit.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "TROOT.h"
6
#include "TFile.h"
7
#include "TH1D.h"
8
9
#include "
JMath/JMathSupportkit.hh
"
10
11
#include "
JROOT/JManager.hh
"
12
13
#include "
Jeep/JParser.hh
"
14
#include "
Jeep/JMessage.hh
"
15
16
17
/**
18
* \file
19
*
20
* Example program to plot mathematical functions.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
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
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JMathSupportkit.hh
Auxiliary methods for mathematics.
H1
do rm f tmp H1
Definition:
plot-equalizer.sh:38
JManager.hh
Dynamic ROOT object management.
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
JMATH::legendre
double legendre(const unsigned int n, const double x)
Legendre polynome.
Definition:
JMath/JMathSupportkit.hh:173
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
n
alias put_queue eval echo n
Definition:
qlib.csh:19
Generated by
1.8.5