2323from ROOT import TFile , TLatex , TLine , TGaxis , gROOT , gStyle
2424from machine_learning_hep .utilities import make_message_notfound
2525from machine_learning_hep .utilities import get_colour , get_marker , draw_latex
26- from machine_learning_hep .utilities import make_plot
26+ from machine_learning_hep .utilities import make_plot , get_y_window_his , get_y_window_gr , get_plot_range
2727from machine_learning_hep .logger import get_logger
2828
2929def main (): # pylint: disable=too-many-locals, too-many-statements, too-many-branches
@@ -461,6 +461,16 @@ def main(): # pylint: disable=too-many-locals, too-many-statements, too-many-bra
461461
462462 # PYTHIA, HF, inclusive, quark, gluon
463463
464+ incl_pythia_syst_cl = incl_pythia_syst .Clone ()
465+
466+ y_min_h , y_max_h = get_y_window_his ([hf_pythia_stat , incl_pythia_stat , quark_pythia_stat , gluon_pythia_stat ])
467+ y_min_g , y_max_g = get_y_window_gr ([incl_pythia_syst , quark_pythia_syst , gluon_pythia_syst ])
468+ y_min = min (y_min_h , y_min_g )
469+ y_max = max (y_max_h , y_max_g )
470+ y_margin_up = 0.46
471+ y_margin_down = 0.05
472+ y_min_plot , y_max_plot = get_plot_range (y_min , y_max , y_margin_down , y_margin_up )
473+
464474 #leg_pos = [.6, .65, .75, .85]
465475 leg_pos = [.72 , .55 , .85 , .85 ]
466476 list_obj = [incl_pythia_syst , quark_pythia_syst , gluon_pythia_syst , hf_pythia_stat , incl_pythia_stat , quark_pythia_stat , gluon_pythia_stat ]
@@ -471,7 +481,7 @@ def main(): # pylint: disable=too-many-locals, too-many-statements, too-many-bra
471481 y_margin_down = 0.05
472482 cshape_mc , list_obj_mc_new = make_plot ("cshape_mc_" + suffix , size = size_can , \
473483 list_obj = list_obj , labels_obj = labels_obj , opt_leg_g = opt_leg_g , opt_plot_g = opt_plot_g , offsets_xy = offsets_axes , \
474- colours = colours , markers = markers , leg_pos = leg_pos , margins_y = [ y_margin_down , y_margin_up ], margins_c = margins_can , \
484+ colours = colours , markers = markers , leg_pos = leg_pos , range_y = [ y_min_plot , y_max_plot ], margins_c = margins_can , \
475485 title = title_full )
476486 cshape_ratio .Update ()
477487 for gr , c in zip ((incl_pythia_syst , quark_pythia_syst , gluon_pythia_syst ), (c_incl_mc , c_quark_mc , c_gluon_mc )):
@@ -511,4 +521,107 @@ def main(): # pylint: disable=too-many-locals, too-many-statements, too-many-bra
511521 cshape_mc .Update ()
512522 cshape_mc .SaveAs ("%s/%s_mc_%s.pdf" % (rootpath , shape , suffix ))
513523
524+ # PYTHIA, HF, quark, gluon
525+
526+ #leg_pos = [.6, .65, .75, .85]
527+ leg_pos = [.72 , .61 , .85 , .85 ]
528+ list_obj = [quark_pythia_syst , gluon_pythia_syst , hf_pythia_stat , quark_pythia_stat , gluon_pythia_stat ]
529+ labels_obj = ["quark" , "gluon" , "%s-tagged" % p_latexnhadron ]
530+ colours = [get_colour (i , j ) for i , j in zip ((c_quark_mc , c_gluon_mc , c_hf_mc , c_quark_mc , c_gluon_mc ), (2 , 2 , 1 , 1 , 1 ))]
531+ markers = [get_marker (i ) for i in (c_quark_mc , c_gluon_mc , c_hf_mc , c_quark_mc , c_gluon_mc )]
532+ y_margin_up = 0.46
533+ y_margin_down = 0.05
534+ cshape_mc , list_obj_mc_new = make_plot ("cshape_mc_qgd_" + suffix , size = size_can , \
535+ list_obj = list_obj , labels_obj = labels_obj , opt_leg_g = opt_leg_g , opt_plot_g = opt_plot_g , offsets_xy = offsets_axes , \
536+ colours = colours , markers = markers , leg_pos = leg_pos , range_y = [y_min_plot , y_max_plot ], margins_c = margins_can , \
537+ title = title_full )
538+ cshape_ratio .Update ()
539+ for gr , c in zip ((quark_pythia_syst , gluon_pythia_syst ), (c_quark_mc , c_gluon_mc )):
540+ gr .SetMarkerColor (get_colour (c ))
541+ leg_mc = list_obj_mc_new [0 ]
542+ leg_mc .SetTextSize (fontsize )
543+ leg_mc .SetHeader (text_pythia_split )
544+ if shape == "nsd" :
545+ quark_pythia_syst .GetXaxis ().SetNdivisions (5 )
546+ cshape_mc .Update ()
547+ if shape == "rg" :
548+ # plot the theta_g axis
549+ axis_rg = hf_pythia_stat .GetXaxis ()
550+ rg_min = axis_rg .GetBinLowEdge (axis_rg .GetFirst ())
551+ rg_max = axis_rg .GetBinUpEdge (axis_rg .GetLast ())
552+ thetag_min = rg_min / radius_jet
553+ thetag_max = rg_max / radius_jet
554+ y_axis = cshape_mc .GetUymax ()
555+ axis_thetag = TGaxis (rg_min , y_axis , rg_max , y_axis , thetag_min , thetag_max , 510 , "-" )
556+ axis_thetag .SetTitle (title_thetag )
557+ axis_thetag .SetTitleSize (size_thg )
558+ axis_thetag .SetLabelSize (0.036 )
559+ axis_thetag .SetTitleFont (42 )
560+ axis_thetag .SetLabelFont (42 )
561+ axis_thetag .SetLabelOffset (0 )
562+ axis_thetag .SetTitleOffset (offset_thg )
563+ cshape_mc .SetTickx (0 )
564+ axis_thetag .Draw ("same" )
565+ # Draw LaTeX
566+ y_latex = y_latex_top
567+ list_latex_mc = []
568+ for text_latex in [text_alice , text_jets , text_ptjet , text_pth , text_ptcut , text_sd ]:
569+ latex = TLatex (x_latex , y_latex , text_latex )
570+ list_latex_mc .append (latex )
571+ draw_latex (latex , textsize = fontsize )
572+ y_latex -= y_step
573+ cshape_mc .Update ()
574+ cshape_mc .SaveAs ("%s/%s_mc_qgd_%s.pdf" % (rootpath , shape , suffix ))
575+
576+ # PYTHIA, HF, inclusive
577+
578+ #leg_pos = [.6, .65, .75, .85]
579+ leg_pos = [.72 , .67 , .85 , .85 ]
580+ list_obj = [incl_pythia_syst_cl , hf_pythia_stat , incl_pythia_stat ]
581+ labels_obj = ["inclusive" , "%s-tagged" % p_latexnhadron ]
582+ colours = [get_colour (i , j ) for i , j in zip ((c_incl_mc , c_hf_mc , c_incl_mc ), (2 , 1 , 1 ))]
583+ markers = [get_marker (i ) for i in (c_incl_mc , c_hf_mc , c_incl_mc )]
584+ y_margin_up = 0.46
585+ y_margin_down = 0.05
586+ cshape_mc , list_obj_mc_new = make_plot ("cshape_mc_id_" + suffix , size = size_can , \
587+ list_obj = list_obj , labels_obj = labels_obj , opt_leg_g = opt_leg_g , opt_plot_g = opt_plot_g , offsets_xy = offsets_axes , \
588+ colours = colours , markers = markers , leg_pos = leg_pos , range_y = [y_min_plot , y_max_plot ], margins_c = margins_can , \
589+ title = title_full )
590+ cshape_ratio .Update ()
591+ incl_pythia_syst_cl .SetMarkerColor (get_colour (c_incl_mc ))
592+ leg_mc = list_obj_mc_new [0 ]
593+ leg_mc .SetTextSize (fontsize )
594+ leg_mc .SetHeader (text_pythia_split )
595+ if shape == "nsd" :
596+ incl_pythia_syst_cl .GetXaxis ().SetNdivisions (5 )
597+ cshape_mc .Update ()
598+ if shape == "rg" :
599+ # plot the theta_g axis
600+ axis_rg = hf_pythia_stat .GetXaxis ()
601+ rg_min = axis_rg .GetBinLowEdge (axis_rg .GetFirst ())
602+ rg_max = axis_rg .GetBinUpEdge (axis_rg .GetLast ())
603+ thetag_min = rg_min / radius_jet
604+ thetag_max = rg_max / radius_jet
605+ y_axis = cshape_mc .GetUymax ()
606+ axis_thetag = TGaxis (rg_min , y_axis , rg_max , y_axis , thetag_min , thetag_max , 510 , "-" )
607+ axis_thetag .SetTitle (title_thetag )
608+ axis_thetag .SetTitleSize (size_thg )
609+ axis_thetag .SetLabelSize (0.036 )
610+ axis_thetag .SetTitleFont (42 )
611+ axis_thetag .SetLabelFont (42 )
612+ axis_thetag .SetLabelOffset (0 )
613+ axis_thetag .SetTitleOffset (offset_thg )
614+ cshape_mc .SetTickx (0 )
615+ axis_thetag .Draw ("same" )
616+ # Draw LaTeX
617+ y_latex = y_latex_top
618+ list_latex_mc = []
619+ for text_latex in [text_alice , text_jets , text_ptjet , text_pth , text_ptcut , text_sd ]:
620+ latex = TLatex (x_latex , y_latex , text_latex )
621+ list_latex_mc .append (latex )
622+ draw_latex (latex , textsize = fontsize )
623+ y_latex -= y_step
624+ cshape_mc .Update ()
625+ cshape_mc .SaveAs ("%s/%s_mc_id_%s.pdf" % (rootpath , shape , suffix ))
626+
514627main ()
0 commit comments