Example program to plot various M-Estimators.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "JFit/JMEstimator.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to plot various M-Estimators.
- Author
- mdejong
Definition in file JMEstimator.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 21 of file JMEstimator.cc.
32 JParser<> zap(
"Example program to plot various M-Estimators.");
35 zap[
'M'] =
make_field(mestimator) =
"normal",
"lorentzian",
"linear",
"tukey",
"normalwithbackground";
40 catch(
const exception &error) {
41 FATAL(error.what() << endl);
45 JMEstimator* me = NULL;
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);
58 FATAL(
"Missing M-Estimator.");
63 TH1D h0(
"rho", NULL, 4000, -10.0, +10.0);
64 TH1D h1(
"psi", NULL, 4000, -10.0, +10.0);
66 for (
int i = 1;
i <= h0.GetNbinsX(); ++
i) {
68 const double x = h0.GetBinCenter(
i);
70 const double rho = me->getRho(x);
71 const double psi = me->getPsi(x);
73 h0.SetBinContent(
i, rho);
74 h1.SetBinContent(
i, psi);
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object