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
examples
JFit
JMEstimator.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 "
JFit/JMEstimator.hh
"
10
11
#include "
Jeep/JParser.hh
"
12
#include "
Jeep/JMessage.hh
"
13
14
15
/**
16
* \file
17
*
18
* Example program to plot various M-Estimators.
19
* \author mdejong
20
*/
21
int
main
(
int
argc,
char
**argv)
22
{
23
using namespace
std;
24
using namespace
JPP;
25
26
string
outputFile
;
27
string
mestimator;
28
int
debug
;
29
30
try
{
31
32
JParser<>
zap(
"Example program to plot various M-Estimators."
);
33
34
zap[
'o'
] =
make_field
(
outputFile
) =
"mestimator.root"
;
35
zap[
'M'
] =
make_field
(mestimator) =
"normal"
,
"lorentzian"
,
"linear"
,
"tukey"
,
"normalwithbackground"
;
36
zap[
'd'
] =
make_field
(
debug
) = 2;
37
38
zap(argc, argv);
39
}
40
catch
(
const
exception &error) {
41
FATAL
(error.what() << endl);
42
}
43
44
45
JMEstimator* me = NULL;
46
47
if
(mestimator ==
"normal"
)
48
me =
new
JMEstimatorNormal();
49
else
if
(mestimator ==
"lorentzian"
)
50
me =
new
JMEstimatorLorentzian();
51
else
if
(mestimator ==
"linear"
)
52
me =
new
JMEstimatorLinear();
53
else
if
(mestimator ==
"tukey"
)
54
me =
new
JMEstimatorTukey(5.0);
55
else
if
(mestimator ==
"normalwithbackground"
)
56
me =
new
JMEstimatorNormalWithBackground(1.0e-5);
57
else
58
FATAL
(
"Missing M-Estimator."
);
59
60
61
TFile out(
outputFile
.c_str(),
"recreate"
);
62
63
TH1D h0(
"rho"
, NULL, 4000, -10.0, +10.0);
64
TH1D h1(
"psi"
, NULL, 4000, -10.0, +10.0);
65
66
for
(
int
i
= 1;
i
<= h0.GetNbinsX(); ++
i
) {
67
68
const
double
x
= h0.GetBinCenter(
i
);
69
70
const
double
rho = me->getRho(x);
71
const
double
psi = me->getPsi(x);
72
73
h0.SetBinContent(
i
, rho);
74
h1.SetBinContent(
i
, psi);
75
}
76
77
delete
me;
78
79
out.Write();
80
out.Close();
81
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1711
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
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
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JMEstimator.hh
Maximum likelihood estimator (M-estimators).
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5