MnPlot.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: MnPlot.cxx 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #include "Minuit2/MnPlot.h"
00011 
00012 namespace ROOT {
00013 
00014    namespace Minuit2 {
00015 
00016 
00017 void mnplot(double* xpt, double* ypt, char* chpt, int nxypt, int npagwd, int npagln);
00018 
00019 void MnPlot::operator()(const std::vector<std::pair<double,double> >& points) const {
00020    // call routine from Fortran minuit (mnplot) to plot the vector of (x,y) points
00021    std::vector<double> x; x.reserve(points.size());
00022    std::vector<double> y; y.reserve(points.size());
00023    std::vector<char> chpt; chpt.reserve(points.size());
00024    
00025    for(std::vector<std::pair<double,double> >::const_iterator ipoint = points.begin(); ipoint != points.end(); ipoint++) {
00026       x.push_back((*ipoint).first);
00027       y.push_back((*ipoint).second);
00028       chpt.push_back('*');
00029    }
00030    
00031    mnplot(&(x.front()), &(y.front()), &(chpt.front()), points.size(), Width(), Length());
00032    
00033 }
00034 
00035 void MnPlot::operator()(double xmin, double ymin, const std::vector<std::pair<double,double> >& points) const {
00036    // call routine from Fortran minuit (mnplot) to plot the vector of (x,y) points + minimum values
00037    std::vector<double> x; x.reserve(points.size()+2);
00038    x.push_back(xmin);
00039    x.push_back(xmin);
00040    std::vector<double> y; y.reserve(points.size()+2);
00041    y.push_back(ymin);
00042    y.push_back(ymin);
00043    std::vector<char> chpt; chpt.reserve(points.size()+2);
00044    chpt.push_back(' ');
00045    chpt.push_back('X');
00046    
00047    for(std::vector<std::pair<double,double> >::const_iterator ipoint = points.begin(); ipoint != points.end(); ipoint++) {
00048       x.push_back((*ipoint).first);
00049       y.push_back((*ipoint).second);
00050       chpt.push_back('*');
00051    }
00052    
00053    mnplot(&(x.front()), &(y.front()), &(chpt.front()), points.size()+2, Width(), Length());
00054 }
00055 
00056    }  // namespace Minuit2
00057 
00058 }  // namespace ROOT

Generated on Tue Jul 5 14:37:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1