Jpp
18.6.0-rc.1
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
software
JGizmo
JF1.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
#include <vector>
5
6
#include "TROOT.h"
7
#include "TFile.h"
8
#include "TF1.h"
9
10
#include "
JTools/JRange.hh
"
11
#include "
JLang/JToken.hh
"
12
#include "
JGizmo/JGizmoToolkit.hh
"
13
14
#include "
Jeep/JParser.hh
"
15
#include "
Jeep/JMessage.hh
"
16
17
18
/**
19
* \file
20
* Auxiliary program to write 1D ROOT function.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
24
{
25
using namespace
std;
26
using namespace
JPP;
27
28
typedef
JToken<';'> JToken_t;
29
typedef
JRange<double> JRange_t;
30
31
string
formula;
32
string
name
;
33
string
outputFile
;
34
JRange_t
x
;
35
vector<JToken_t>
parameters
;
36
int
N
;
37
int
debug
;
38
39
try
{
40
41
JParser<>
zap(
"Auxiliary program to write 1D ROOT function."
);
42
43
zap[
'F'
] =
make_field
(formula,
"function, e.g: \"[0]+[1]*x\""
);
44
zap[
'T'
] =
make_field
(
name
,
"name of ROOT function"
) =
"user"
;
45
zap[
'o'
] =
make_field
(
outputFile
,
"ROOT file with formula"
) =
"f1.root"
;
46
zap[
'x'
] =
make_field
(
x
,
"abscissa range"
) = JRange_t();
47
zap[
'@'
] =
make_field
(
parameters
,
"parameter values, e.g: \"p0 = 1.0;\""
) =
JPARSER::initialised
();
48
zap[
'N'
] =
make_field
(
N
,
"number of points (for drawing)"
) = 0;
49
zap[
'd'
] =
make_field
(
debug
) = 1;
50
51
zap(argc, argv);
52
}
53
catch
(
const
exception &error) {
54
FATAL
(error.what() << endl);
55
}
56
57
TF1
f1
(
name
.c_str(),
58
formula.c_str(),
59
x
.getLowerLimit(),
60
x
.getUpperLimit());
61
62
if
(
N
> 0) {
63
f1
.SetNpx(
N
);
64
}
65
66
for
(
vector<JToken_t>::const_iterator
i
=
parameters
.begin();
i
!=
parameters
.end(); ++
i
) {
67
f1
.SetParameter(
getParameter
(*
i
),
getValue
(*
i
,&
f1
));
68
}
69
70
TFile out(
outputFile
.c_str(),
"recreate"
);
71
72
out.WriteTObject(&
f1
);
73
74
out.Write();
75
out.Close();
76
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1711
JEEP::getValue
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Definition:
JScale.hh:47
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JGIZMO::getParameter
int getParameter(const std::string &text)
Get parameter number from text string.
Definition:
JGizmoToolkit.hh:336
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:84
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
std::vector
Definition:
JSTDTypes.hh:13
GAUSS_LEGENDRE::f1
const JPolynome f1(1.0, 2.0, 3.0)
Function.
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
makedeclinationtable.x
tuple x
Definition:
makedeclinationtable.py:44
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:2158
JGizmoToolkit.hh
JToken.hh
JMessage.hh
General purpose messaging.
name
then fatal The output file must have the wildcard in the name
Definition:
JCanberra.sh:31
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
N
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition:
JMuonPostfit.sh:40
JRange.hh
Auxiliary class to define a range between two values.
JParser.hh
Utility class to parse command line options.
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5