21 int main(
int argc,
char **argv)
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);