#ifndef _PLOTTING2_H #define _PLOTTING2_H #include "arrays.h" #include "charString.h" #include using namespace std; // convenient constants const int su3=1; const int su2=2; const int u1=3; const int none=0; const int solid_fill=1; const int no_symbol=0; const int circle=1; const int square=2; const int diamond=3; const int triangle_up=4; const int triangle_left=5; const int triangle_down=6; const int triangle_right=7; const int plus_sign=8; const int cross_sign=9; const int star_sign=10; const int char_sign=11; const int white=0; const int black=1; const int red=2; const int green=3; const int blue=4; const int yellow=5; const int brown=6; const int grey=7; const int violet=8; const int cyan=9; const int magenta=10; const int orange=11; const int indigo=12; const int maroon=13; const int turquoise=14; const int green4=15; const int no_line=0; const int solid_line=1; const int dotted_line=2; const int dashed_line=3; const int long_dashed_line=4; const int dot_dashed_line=5; const int dot_long_dashed_line=6; const int dot_dot_dashed_line=7; const int dash_dash_dotted_line=8; // ************************************************************ #define WEBPAGE // ************************************************************* // Class containing a string and a location (in frame coordinates) // to put on a plot. The horizontal and vertical frame coordinates // vary between 0 and 1. class plot_label { public: charString label; double label_xloc, label_yloc; // frame coordinates plot_label(){} ~plot_label(){} void assign(const charString& label_string, double xloc, double yloc); }; // An array of plot_label variables. Indices are checked. class plot_labels { protected: plot_label *m; int n; public: plot_labels(); plot_labels(int dim); plot_labels(const plot_labels &pvec); ~plot_labels(); void assign(int index, const charString& label_string, double xloc, double yloc); int dim() const; void reset(int dim); plot_label& operator()(int i) const; }; // ******************************************************************* class level_info { public: int Ncurves; int string_level; Svector datafiles; Svector gapdatafiles; Svector pattern_search; Svector legend_strings; level_info(); ~level_info(){} void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6, const charString& stub7, const charString& patt7, const charString &legend7); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6, const charString& stub7, const charString& patt7, const charString &legend7, const charString& stub8, const charString& patt8, const charString &legend8); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6, const charString& stub7, const charString& patt7, const charString &legend7, const charString& stub8, const charString& patt8, const charString &legend8, const charString& stub9, const charString& patt9, const charString &legend9); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6, const charString& stub7, const charString& patt7, const charString &legend7, const charString& stub8, const charString& patt8, const charString &legend8, const charString& stub9, const charString& patt9, const charString &legend9, const charString& stub10,const charString& patt10,const charString &legend10); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6, const charString& stub7, const charString& patt7, const charString &legend7, const charString& stub8, const charString& patt8, const charString &legend8, const charString& stub9, const charString& patt9, const charString &legend9, const charString& stub10,const charString& patt10,const charString &legend10, const charString& stub11,const charString& patt11,const charString &legend11); void assign(int string_N, const charString& rundir, const charString& stub1, const charString& patt1, const charString &legend1, const charString& stub2, const charString& patt2, const charString &legend2, const charString& stub3, const charString& patt3, const charString &legend3, const charString& stub4, const charString& patt4, const charString &legend4, const charString& stub5, const charString& patt5, const charString &legend5, const charString& stub6, const charString& patt6, const charString &legend6, const charString& stub7, const charString& patt7, const charString &legend7, const charString& stub8, const charString& patt8, const charString &legend8, const charString& stub9, const charString& patt9, const charString &legend9, const charString& stub10,const charString& patt10,const charString &legend10, const charString& stub11,const charString& patt11,const charString &legend11, const charString& stub12,const charString& patt12,const charString &legend12); }; // ******************************************************************** // This class contains a given curve to plot consisting // of data points (x, y, y_err) and other self-explanatory // information. The location of the label is specified // as follows: // // HORIZONTAL SPECIFICATION // // xloc_of_label < 0 => left of smallest-x point // xloc_of_label > 1 => right of largest-x point // 0 < xloc_of_label < 1 => fractional distance between // smallest and largest x-values // // VERTICAL SPECIFICATION // // yloc_of_label > 0 => above the curve // yloc_of_label = 0 => on the curve // yloc_of_label < 0 => below the curve // class plot_curve { public: int Npoints; dvector xvals,dxvals,yvals,dyvals; int line_color,line_type,line_thickness; int symbol_type,symbol_color,symbol_fill; double symbol_size; charString label; plot_curve(){} ~plot_curve(){} int setup_from_file(const charString& datafile, const charString& channel_string, int Rplot_type, int type_of_line, int color_of_line, int thickness_of_line, int type_of_symbol, int color_of_symbol, int fill_of_symbol, double size_of_symbol, const charString& label_string ); void wipeout(); }; // An array of plot_curve objects. class plot_curves { protected: plot_curve *m; int n; public: plot_curves(); plot_curves(int dim); plot_curves(const plot_curves &pvec); ~plot_curves(); int setup_from_file(int index, const charString& datafile, const charString& channel_string, int Rplot_type, int type_of_line, int color_of_line, int thickness_of_line, int type_of_symbol, int color_of_symbol, int fill_of_symbol, double size_of_symbol, const charString& label_string ); int dim() const; void reset(int dim); plot_curve& operator()(int i) const; }; // ******************************************************************* // This class contains a given curve to plot consisting // of data points (x, y) and other self-explanatory // information. class xy_curve { public: int Npoints; dvector xvals,yvals; int line_color,line_type,line_thickness; int symbol_type,symbol_color,symbol_fill; double symbol_size; charString label; xy_curve(){} ~xy_curve(){} void setup(int number_of_points, double *xvalues, double *yvalues, int type_of_line, int color_of_line, int thickness_of_line, int type_of_symbol, int color_of_symbol, int fill_of_symbol, double size_of_symbol); void setup(int number_of_points, double *xvalues, double *yvalues, int type_of_line, int color_of_line, int thickness_of_line, int type_of_symbol, int color_of_symbol, int fill_of_symbol, double size_of_symbol, const charString& label_string); void wipeout(); }; // An array of xy_curve objects. class xy_curves { protected: xy_curve *m; int n; public: xy_curves(); xy_curves(int dim); xy_curves(const xy_curves &pvec); ~xy_curves(); void setup(int index, int number_of_points, double *xvalues, double *yvalues, int type_of_line, int color_of_line, int thickness_of_line, int type_of_symbol, int color_of_symbol, int fill_of_symbol, double size_of_symbol); void setup(int index, int number_of_points, double *xvalues, double *yvalues, int type_of_line, int color_of_line, int thickness_of_line, int type_of_symbol, int color_of_symbol, int fill_of_symbol, double size_of_symbol, const charString& label_string); int dim() const; void reset(int dim); xy_curve& operator()(int i) const; }; // ******************************************************************* // This routine produces an "xmgrace" plot file. // Output is sent to the file "filename" which can then be // viewed using "xmgrace". The parameters are hopefully // self-explanatory. void produce_plot(const charString& filename, const charString& title, const charString& subtitle, const charString& xlabel, const charString& ylabel, double xmin, double xmax, double ymin, double ymax, double x_major_tick_spacing, int x_minor_tick_num, double y_major_tick_spacing, int y_minor_tick_num, const plot_curves& plot_results, const xy_curves& xy_curves_to_plot, const plot_labels& label_strings); void produce_plot(const charString& filename, const charString& title, const charString& subtitle, const charString& xlabel, const charString& ylabel, double xmin, double xmax, double ymin, double ymax, double x_major_tick_spacing, int x_minor_tick_num, double y_major_tick_spacing, int y_minor_tick_num, const plot_curves& plot_results, const plot_labels& label_strings); void produce_plot(const charString& filename, const charString& title, const charString& subtitle, const charString& xlabel, const charString& ylabel, double xmin, double xmax, double ymin, double ymax, double x_major_tick_spacing, int x_minor_tick_num, double y_major_tick_spacing, int y_minor_tick_num, const xy_curves& xy_curves_to_plot, const plot_labels& label_strings); // ****************************************************************** void pump_out_plot(const charString& outfile, int Nlevels, const Svector& datafiles, const Svector& channel_match, const Svector& legend_strings, int ymin_flag); void pump_out_plot(const charString& outfile, int Nlevels, const Svector& datafiles, const Svector& channel_match, const Svector& legend_strings); void setup_goldstone(int Rplot_type, double xmin, double xmax, int string_level, int dim); void setup_full_nambu_goto(double xmin, double xmax, int string_level, int dim); void setup_one_loop_nambu_goto(double xmin, double xmax, int string_level, int dim); void html_header(const charString filename, const charString& up_filename, const charString title1, const charString title2); void html_footer(const charString& up_filename); void pump_out_string_plot(const charString& outfile, int Nlevels, const Svector& datafiles, const Svector& channel_match, const Svector& legend_strings, int string_level, int dim); // ********************************************************************************* // useful global variables extern int line_thickness,Rplot_type; extern double xmin,xmax,ymin,ymax; extern double x_major_tick_spacing,y_major_tick_spacing; extern int x_minor_tick_num,y_minor_tick_num; extern charString title,subtitle,xlabel,ylabel; extern plot_labels label_strings; extern double legend_xpos,legend_ypos; extern int Nchannels; extern Svector channel_match,channel_label; extern ifstream in; extern ofstream html_out; // **************************************************************************** #endif