Functions | Variables
make_xsec_tuning_stage_plots Namespace Reference

Functions

def FormatPadHists (pad, y_fraction)
 
def PrepHist (hist, scale, ytitle, color, line_style)
 
def GetSummedHist (mc_file, var, mc_comps)
 

Variables

int line_width = 3
 
float top_margin = 0.08
 
float bottom_margin = 0.12
 
float left_margin = 0.15
 
float right_margin = 0.05
 
float axis_title_size = 0.05
 
float axis_label_size = 0.035
 
float axis_title_offset_y = 1.3
 
string default_outdir = '/nova/app/users/mislivec/scripts_xs_tuning_blessed_plots/plots_xsec_tuning_stages/plots/'
 Parse Options. More...
 
 parser = OptionParser()
 
 dest
 
 default
 
 None
 
 help
 
 action
 
 False
 
 opts
 
 args
 
string indir = "/pnfs/nova/persistent/users/mislivec/xsec_tuning_paper/"
 
 hists_file_name_data = os.path.join( indir, "hists_2018_%s_data_full.root" % opts.beam )
 
 hists_file_name_mc = os.path.join( indir, "hists_2018_%s_mc_full.root" % opts.beam )
 
 hists_file_data = TFile( hists_file_name_data )
 
 hists_file_mc = TFile( hists_file_name_mc )
 
 tree_pot_data = hists_file_data.Get( 'pot' )
 
float pot_data = 0.0
 
 tree_pot_mc = hists_file_mc.Get( 'pot' )
 
float pot_mc = 0.0
 
 mc_pot_scale = pot_data/pot_mc
 
int event_scale_power = 4
 
float event_scale = 1.0
 
string text_events = '10^{%d} Events'
 
string isRHC = 'RHC'
 
string plots_dir = "./plots/tuning_stages"
 
float label_text_size = 0.04
 
int text_font = 42
 
float text_angle = 0.0
 
bool setNDC = True
 
float ypos_top = 1.0
 
string text_beam = "Neutrino Beam"
 
 label_beam = root_style.GetLabel( text_beam, left_margin + label_text_size, ypos_top, label_text_size, kBlack, text_font, 13, text_angle, setNDC )
 
string text_nova = "NOvA"
 
 label_prelim = root_style.GetLabel( text_nova + " Preliminary", 1.0 - right_margin, 1.0 - top_margin + 0.02, 0.06, kBlue, text_font, 31, text_angle, setNDC )
 
 hist_data = hists_file_data.Get( '%s_Data' % var )
 
list hists_mc_stages = []
 
list names_mc_stages = []
 
list colors_mc_stages = []
 
list line_styles_mc_stages = []
 
 mc_scale = event_scale*mc_pot_scale
 
list hists_mc_stages_ratio = []
 
 hist_data_ratio = hist_data.Clone( "%s_Data_Ratio" % var )
 
 ymax = hist_data.GetBinContent( hist_data.GetMaximumBin() )
 
float xmin = 0.0
 
float ymin_ratio = 0.0
 
float ymax_ratio = 2.0
 
 yndiv_ratio = hist_data_ratio.GetYaxis().GetNdivisions()
 
 xmax = hist_data.GetXaxis().GetXmax()
 
 xndiv = hist_data.GetXaxis().GetNdivisions()
 
float ymax_scale = 1.5
 
string canvas_name = "Canvas_"
 
 canvas = TCanvas( canvas_name, canvas_name, 300, 300 )
 
float lower_fraction = 0.35
 
float upper_fraction = 1.0
 
 pad_upper = canvas.GetPad( 1 )
 
 pad_lower = canvas.GetPad( 2 )
 
 legend = root_style.GetLegend()
 
string mc_draw_option = "hist ]["
 
string plot_name = "%s_%s_XSec_Tuning_Stage%d"
 

Function Documentation

def make_xsec_tuning_stage_plots.FormatPadHists (   pad,
  y_fraction 
)

Definition at line 22 of file make_xsec_tuning_stage_plots.py.

22 def FormatPadHists( pad, y_fraction ) :
23 
24  for obj in pad.GetListOfPrimitives() :
25  if not obj.InheritsFrom( "TH1" ) : continue
26 
27  obj.GetYaxis().SetTitleSize( axis_title_size / y_fraction )
28  obj.GetYaxis().SetTitleOffset( axis_title_offset_y * y_fraction )
29  obj.GetYaxis().SetLabelSize( axis_label_size / y_fraction )
30  obj.GetXaxis().SetLabelSize( axis_label_size / y_fraction )
31  obj.GetXaxis().SetLabelOffset( 0.005 / y_fraction )
32  obj.GetXaxis().SetTitleSize( axis_title_size / y_fraction )
33  obj.GetXaxis().SetTitleOffset( 0.0 )
34 
def make_xsec_tuning_stage_plots.GetSummedHist (   mc_file,
  var,
  mc_comps 
)

Definition at line 45 of file make_xsec_tuning_stage_plots.py.

45 def GetSummedHist( mc_file, var, mc_comps ) :
46 
47  hist_sum_name = var
48  for c in mc_comps :
49  hist_sum_name += "_%s" % c
50 
51  hist_sum = None
52  for c in mc_comps :
53  hist_name = '%s_%s' % ( var, c )
54  #print 'hist_name =', hist_name
55  hist_comp = mc_file.Get( hist_name )
56  if hist_sum == None : hist_sum = hist_comp.Clone( hist_sum_name )
57  else : hist_sum.Add( hist_comp )
58 
59  return hist_sum
60 
def GetSummedHist(mc_file, var, mc_comps)
def make_xsec_tuning_stage_plots.PrepHist (   hist,
  scale,
  ytitle,
  color,
  line_style 
)

Definition at line 35 of file make_xsec_tuning_stage_plots.py.

References SetTitle().

35 def PrepHist( hist, scale, ytitle, color, line_style ) :
36 
37  root_style.ApplyAxisStyleAll( hist )
38  hist.Scale( scale )
39  hist.GetYaxis().SetTitle( ytitle )
40  hist.SetLineColor( color )
41  hist.SetMarkerColor( color )
42  hist.SetLineWidth( line_width )
43  hist.SetLineStyle( line_style )
44 
gargamelle SetTitle("Gargamelle #nu_{e} CC data")
def PrepHist(hist, scale, ytitle, color, line_style)

Variable Documentation

make_xsec_tuning_stage_plots.action

Definition at line 71 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.args

Definition at line 75 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.axis_label_size = 0.035

Definition at line 19 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.axis_title_offset_y = 1.3

Definition at line 20 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.axis_title_size = 0.05

Definition at line 18 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.bottom_margin = 0.12

Definition at line 15 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.canvas = TCanvas( canvas_name, canvas_name, 300, 300 )

Definition at line 240 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.canvas_name = "Canvas_"

Definition at line 239 of file make_xsec_tuning_stage_plots.py.

list make_xsec_tuning_stage_plots.colors_mc_stages = []

Definition at line 164 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.default

Definition at line 69 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.default_outdir = '/nova/app/users/mislivec/scripts_xs_tuning_blessed_plots/plots_xsec_tuning_stages/plots/'

Parse Options.

Definition at line 67 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.dest

Definition at line 69 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.event_scale = 1.0

Definition at line 112 of file make_xsec_tuning_stage_plots.py.

int make_xsec_tuning_stage_plots.event_scale_power = 4

Definition at line 111 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.False

Definition at line 71 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.help

Definition at line 69 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.hist_data = hists_file_data.Get( '%s_Data' % var )

Definition at line 147 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.hist_data_ratio = hist_data.Clone( "%s_Data_Ratio" % var )

Definition at line 192 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.hists_file_data = TFile( hists_file_name_data )

Definition at line 90 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.hists_file_mc = TFile( hists_file_name_mc )

Definition at line 91 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.hists_file_name_data = os.path.join( indir, "hists_2018_%s_data_full.root" % opts.beam )

Definition at line 83 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.hists_file_name_mc = os.path.join( indir, "hists_2018_%s_mc_full.root" % opts.beam )

Definition at line 84 of file make_xsec_tuning_stage_plots.py.

list make_xsec_tuning_stage_plots.hists_mc_stages = []

Definition at line 151 of file make_xsec_tuning_stage_plots.py.

list make_xsec_tuning_stage_plots.hists_mc_stages_ratio = []

Definition at line 186 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.indir = "/pnfs/nova/persistent/users/mislivec/xsec_tuning_paper/"

Definition at line 81 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.isRHC = 'RHC'

Definition at line 124 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.label_beam = root_style.GetLabel( text_beam, left_margin + label_text_size, ypos_top, label_text_size, kBlack, text_font, 13, text_angle, setNDC )

Definition at line 139 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.label_prelim = root_style.GetLabel( text_nova + " Preliminary", 1.0 - right_margin, 1.0 - top_margin + 0.02, 0.06, kBlue, text_font, 31, text_angle, setNDC )

Definition at line 143 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.label_text_size = 0.04

Definition at line 130 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.left_margin = 0.15

Definition at line 16 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.legend = root_style.GetLegend()

Definition at line 266 of file make_xsec_tuning_stage_plots.py.

list make_xsec_tuning_stage_plots.line_styles_mc_stages = []

Definition at line 179 of file make_xsec_tuning_stage_plots.py.

int make_xsec_tuning_stage_plots.line_width = 3

Definition at line 13 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.lower_fraction = 0.35

Definition at line 247 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.mc_draw_option = "hist ]["

Definition at line 283 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.mc_pot_scale = pot_data/pot_mc

Definition at line 105 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.mc_scale = event_scale*mc_pot_scale

Definition at line 185 of file make_xsec_tuning_stage_plots.py.

list make_xsec_tuning_stage_plots.names_mc_stages = []

Definition at line 158 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.None

Definition at line 69 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.opts

Definition at line 75 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.pad_lower = canvas.GetPad( 2 )

Definition at line 258 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.pad_upper = canvas.GetPad( 1 )

Definition at line 250 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.parser = OptionParser()

Definition at line 68 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.plot_name = "%s_%s_XSec_Tuning_Stage%d"

Definition at line 317 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.plots_dir = "./plots/tuning_stages"

Definition at line 127 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.pot_data = 0.0

Definition at line 94 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.pot_mc = 0.0

Definition at line 100 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.right_margin = 0.05

Definition at line 17 of file make_xsec_tuning_stage_plots.py.

bool make_xsec_tuning_stage_plots.setNDC = True

Definition at line 133 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.text_angle = 0.0

Definition at line 132 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.text_beam = "Neutrino Beam"

Definition at line 137 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.text_events = '10^{%d} Events'

Definition at line 113 of file make_xsec_tuning_stage_plots.py.

int make_xsec_tuning_stage_plots.text_font = 42

Definition at line 131 of file make_xsec_tuning_stage_plots.py.

string make_xsec_tuning_stage_plots.text_nova = "NOvA"

Definition at line 141 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.top_margin = 0.08

Definition at line 14 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.tree_pot_data = hists_file_data.Get( 'pot' )

Definition at line 93 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.tree_pot_mc = hists_file_mc.Get( 'pot' )

Definition at line 99 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.upper_fraction = 1.0

Definition at line 248 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.xmax = hist_data.GetXaxis().GetXmax()

Definition at line 205 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.xmin = 0.0

Definition at line 201 of file make_xsec_tuning_stage_plots.py.

int make_xsec_tuning_stage_plots.xndiv = hist_data.GetXaxis().GetNdivisions()

Definition at line 206 of file make_xsec_tuning_stage_plots.py.

make_xsec_tuning_stage_plots.ymax = hist_data.GetBinContent( hist_data.GetMaximumBin() )

Definition at line 200 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.ymax_ratio = 2.0
float make_xsec_tuning_stage_plots.ymax_scale = 1.5

Definition at line 207 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.ymin_ratio = 0.0

Definition at line 202 of file make_xsec_tuning_stage_plots.py.

int make_xsec_tuning_stage_plots.yndiv_ratio = hist_data_ratio.GetYaxis().GetNdivisions()

Definition at line 204 of file make_xsec_tuning_stage_plots.py.

float make_xsec_tuning_stage_plots.ypos_top = 1.0

Definition at line 135 of file make_xsec_tuning_stage_plots.py.