set term pdf fontscale 0.75 size 6in,4in outfile = 'BetaCrossE.pdf' set output outfile set timestamp offset graph 1.04,0.7 rotate font 'Verdana,6' set label 5 at graph 0.06,0.9 dir noenhance font ',10' set label 3 'plotting_scripts/BetaCrossE.gnu' at graph 1.02,0.02 rotate left font 'Verdana,6' noenhance set xlabel 'x [mm]' set ylabel 'p_x [mrad]' plot dir.'/EndOfTracking_phase_space.dat' u ($4*1000):($5*1000) pt 5 ps .5 not max=0.5 #max value microseconds min=-0.5 width=(max-min)/n #interval width #function used to map a value to the intervals hist(x,width)=width*floor(x/width)+width/2.0 set xrange [min:max] set xtics min,(max-min)/10,max set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror set xlabel "{/Symbol D}p/p [%]" set ylabel "Frequency" #set ytics 50 #count and plot stats dir.'/EndOfTracking_phase_space.dat' u 9 avee =sprintf("%4.3f",STATS_mean*100) set label 1 '<{/Symbol D}p/p>= '.avee.'%' at graph 0.6,0.9 stddev =sprintf("%4.3f",STATS_stddev*100) set label 2 '{/Symbol s}_p/p= '.stddev.'%' at graph 0.6,0.8 #set title 'Energy at End of Tracking' noenhance plot dir.'/EndOfTracking_phase_space.dat' u (hist(($9*100),width)):(1.0) smooth freq w boxes lc rgb"green" not unset xtics set xtics auto set autoscale set xlabel "amplitude [mm-mrad]" set ylabel "C_e [ppm]" betax = 7.8 gamma = 1./betax eta = 8.8 etap=0. f = 2/3.e8/1.45*1.e6 stats dir.'/EndOfTracking_phase_space.dat' u (($4-$9*eta)**2*gamma + ($5-$9*etap)**2*betax)*1.e6:($17/$19*$9)*f avece =sprintf("%3.3f",STATS_mean_y) set label 1 '= '.avece.' ppm' at graph 0.6,0.9 unset label 2 set label 5 at graph 0.06,0.05 dir noenhance font ',10' plot dir.'/EndOfTracking_phase_space.dat' u (($4-$9*eta)**2*gamma + ($5-$9*etap)**2*betax)*1.e6:($17/$19*$9)*f pt 5 ps .5 not set xlabel '{/Symbol D}p/p [%]' plot dir.'/EndOfTracking_phase_space.dat' u ($9*100):($17/$19*$9)*f pt 5 ps .5 not print outfile