ROOT   Reference Guide
MnPlot.cxx
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#include "Minuit2/MnPlot.h"
11
12namespace ROOT {
13
14namespace Minuit2 {
15
16void mnplot(double *xpt, double *ypt, char *chpt, int nxypt, int npagwd, int npagln);
17
18void MnPlot::operator()(const std::vector<std::pair<double, double>> &points) const
19{
20 // call routine from Fortran minuit (mnplot) to plot the vector of (x,y) points
21 std::vector<double> x;
22 x.reserve(points.size());
23 std::vector<double> y;
24 y.reserve(points.size());
25 std::vector<char> chpt;
26 chpt.reserve(points.size());
27
28 for (std::vector<std::pair<double, double>>::const_iterator ipoint = points.begin(); ipoint != points.end();
29 ++ipoint) {
30 x.push_back((*ipoint).first);
31 y.push_back((*ipoint).second);
32 chpt.push_back('*');
33 }
34
35 mnplot(&(x.front()), &(y.front()), &(chpt.front()), points.size(), Width(), Length());
36}
37
38void MnPlot::operator()(double xmin, double ymin, const std::vector<std::pair<double, double>> &points) const
39{
40 // call routine from Fortran minuit (mnplot) to plot the vector of (x,y) points + minimum values
41 std::vector<double> x;
42 x.reserve(points.size() + 2);
43 x.push_back(xmin);
44 x.push_back(xmin);
45 std::vector<double> y;
46 y.reserve(points.size() + 2);
47 y.push_back(ymin);
48 y.push_back(ymin);
49 std::vector<char> chpt;
50 chpt.reserve(points.size() + 2);
51 chpt.push_back(' ');
52 chpt.push_back('X');
53
54 for (std::vector<std::pair<double, double>>::const_iterator ipoint = points.begin(); ipoint != points.end();
55 ++ipoint) {
56 x.push_back((*ipoint).first);
57 y.push_back((*ipoint).second);
58 chpt.push_back('*');
59 }
60
61 mnplot(&(x.front()), &(y.front()), &(chpt.front()), points.size() + 2, Width(), Length());
62}
63
64} // namespace Minuit2
65
66} // namespace ROOT
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
float xmin
Definition: THbookFile.cxx:95
float ymin
Definition: THbookFile.cxx:95
void operator()(const std::vector< std::pair< double, double > > &) const
Definition: MnPlot.cxx:18
unsigned int Width() const
Definition: MnPlot.h:43
unsigned int Length() const
Definition: MnPlot.h:44
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
void mnplot(double *xpt, double *ypt, char *chpt, int nxypt, int npagwd, int npagln)
Definition: mntplot.cxx:25
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.