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.
31 JParser<> zap(
"Example program to plot various M-Estimators.");
34 zap[
'M'] =
make_field(mestimator) =
"normal",
"lorentzian",
"tukey",
"linear";
39 catch(
const exception &error) {
40 FATAL(error.what() << endl);
46 JMEstimator* me = NULL;
48 if (mestimator ==
"normal")
49 me =
new JMEstimatorNormal();
50 else if (mestimator ==
"lorentzian")
51 me =
new JMEstimatorLorentzian();
52 else if (mestimator ==
"tukey")
53 me =
new JMEstimatorTukey(5.0);
54 else if (mestimator ==
"linear")
55 me =
new JMEstimatorLinear();
57 FATAL(
"Missing M-Estimator.");
62 TH1D h0(
"rho", NULL, 4000, -10.0, +10.0);
63 TH1D
h1(
"psi", NULL, 4000, -10.0, +10.0);
65 for (
int i = 1; i <= h0.GetNbinsX(); ++i) {
67 const double x = h0.GetBinCenter(i);
69 const double rho = me->getRho(x);
70 const double psi = me->getPsi(x);
72 h0.SetBinContent(i, rho);
73 h1.SetBinContent(i, psi);
Utility class to parse command line options.
then for HISTOGRAM in h0 h1
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object