Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:49

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004   //proxies to have less verbose user programming :
0005 
0006   //WARNING : the plotter must have at least 1x1 plotting area,
0007   //          else the below will crash because current_plotter()
0008   //          will return a null pointer.
0009 
0010   tools::sg::plots& plots() {return m_plots;}
0011   const tools::sg::plots& plots() const {return m_plots;}
0012 
0013   void next() {m_plots.next();}
0014   bool set_current_plotter(unsigned int a_index) {return m_plots.set_current_plotter(a_index);}
0015 
0016   void add_plottable(tools::sg::plottable* a_plottable) {
0017     m_plots.current_plotter().add_plottable(a_plottable); //it takes ownership.
0018   }
0019 
0020   tools::sg::plottable* plot(const tools::histo::h1d& a_histo) {
0021   //tools::sg::plottable* p = new tools::sg::h1d2plot<tools::histo::h1d>(a_histo);
0022     tools::sg::plottable* p = new tools::sg::h1d2plot(a_histo);
0023     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0024     return p;
0025   }
0026 
0027   tools::sg::plottable* plot(const tools::histo::h2d& a_histo) {
0028   //tools::sg::plottable* p = new tools::sg::h2d2plot<tools::histo::h2d>(a_histo);
0029     tools::sg::plottable* p = new tools::sg::h2d2plot(a_histo);
0030     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0031     return p;
0032   }
0033 
0034   tools::sg::plottable* plot(const tools::histo::p1d& a_histo) {
0035     tools::sg::plottable* p = new tools::sg::p1d2plot(a_histo);
0036     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0037     return p;
0038   }
0039 
0040   tools::sg::plottable* plot(const tools::histo::c2d& a_cloud) {
0041     tools::sg::plottable* p = new tools::sg::c2d2plot(a_cloud);
0042     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0043     return p;
0044   }
0045 
0046   tools::sg::plottable* plot(const tools::histo::c3d& a_cloud) {
0047     tools::sg::plottable* p = new tools::sg::c3d2plot(a_cloud);
0048     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0049     return p;
0050   }
0051 
0052   tools::sg::plottable* plot_cp(const tools::histo::h1d& a_histo) {
0053   //tools::sg::plottable* p = new tools::sg::h1d2plot_cp<tools::histo::h1d>(a_histo);
0054     tools::sg::plottable* p = new tools::sg::h1d2plot_cp(a_histo);
0055     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0056     return p;
0057   }
0058 
0059   tools::sg::plottable* plot_cp(const tools::histo::h2d& a_histo) {
0060   //tools::sg::plottable* p = new tools::sg::h2d2plot_cp<tools::histo::h2d>(a_histo);
0061     tools::sg::plottable* p = new tools::sg::h2d2plot_cp(a_histo);
0062     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0063     return p;
0064   }
0065 
0066   tools::sg::plottable* plot_cp(const tools::histo::p1d& a_histo) {
0067     tools::sg::plottable* p = new tools::sg::p1d2plot_cp(a_histo);
0068     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0069     return p;
0070   }
0071 
0072 
0073   //tools::sg::plottable* plot(const tools::histo::p2d& a_histo) {
0074   //  tools::sg::plottable* p = new tools::sg::p2d2plot(a_histo);
0075   //  m_plots.current_plotter().add_plottable(p); //it takes ownership.
0076   //  return p;
0077   //}
0078 
0079   tools::sg::plottable* plot_cp(const tools::histo::c2d& a_cloud) {
0080     tools::sg::plottable* p = new tools::sg::c2d2plot_cp(a_cloud);
0081     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0082     return p;
0083   }
0084 
0085   tools::sg::plottable* plot_cp(const tools::histo::c3d& a_cloud) {
0086     tools::sg::plottable* p = new tools::sg::c3d2plot_cp(a_cloud);
0087     m_plots.current_plotter().add_plottable(p); //it takes ownership.
0088     return p;
0089   }
0090 
0091   template <class T>
0092   tools::sg::plottable* plot(const T& a_func) {
0093     tools::sg::plottable* p = new tools::sg::f1d2plot<T>(a_func);
0094     m_plots.current_plotter().add_plottable(p);
0095     return p;
0096   }
0097 
0098   template <class T>
0099   tools::sg::plottable* plot(const std::vector<T>& a_xs,const std::vector<T>& a_ys) {
0100     tools::sg::plottable* p = new tools::sg::xy2plot<T>(a_xs,a_ys);
0101     m_plots.current_plotter().add_plottable(p);
0102     return p;
0103   }
0104 
0105   tools::sg::plottable* plot_fit(const std::vector<std::string>& a_names,const std::vector<double>& a_output) {
0106     tools::sg::plottable* p = new tools::sg::fit2plot(a_names,a_output);
0107     m_plots.current_plotter().add_plottable(p);
0108     return p;
0109   }
0110