Functions | Variables
drawSensitivitySummaries_simplevars_improved Namespace Reference

Functions

def myfunc (x, par)
 
def GetPercentile (histo, X)
 
def GetMedian (histo)
 
def GetMinimum (histo)
 
def GetFractionAtMoreThanXSigma (histo, X)
 

Variables

bool use_realistic_powers = True
 
bool use_fixed_scale = True
 
list tempgraphs = []
 
list amounts_varied = [0,50,90,110,200,500]
 
list modes = ["fhc","rhc"]
 
list nus = ["numu","numubar","nuenuebar"]
 
list vars = ["0to0p5GeVPlus10per","0p5to1GeVPlus10per","1to2GeVPlus10per","2to3GeVPlus10per","3to4GeVPlus10per","4to5GeVPlus10per","5to6GeVPlus10per","6to7GeVPlus10per","7to8GeVPlus10per","8to9GeVPlus10per","9to10GeVPlus10per","10to15GeVPlus10per","15to20GeVPlus10per","20to120GeVPlus10per"]
 
list bin_centers = [0.25,0.75,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,12.5,17.5,70.0]
 
 bin_centers_array = array.array('d',bin_centers)
 
list hierarchies = ["nh","ih"]
 
list plotvars = ["cp_75thpercentile","mh_minimum"]
 
 outfile = ROOT.TFile("/lbne/data/users/ljf26/fluxfiles/sensitivity_comps_"+str(amount_varied)+"_improved.root","RECREATE");
 
list medians = [[],[],[]]
 
list baseline_medians = []
 
 mixing_param = plotvar[0:2]
 
 baseline_file = ROOT.TFile("/lbne/data/users/lblpwg_tools/FastMC_Data/outputs/ljf26/Sensitivity_Plots/ProtonP120GeV_"+hierarchy+"_"+mixing_param+"_histos.root");
 
 var = vars[i]+str(amount_varied)
 
string file_prefix = mode+nu+var+"_"
 
 t_file = ROOT.TFile("/lbne/data/users/lblpwg_tools/FastMC_Data/outputs/ljf26/Sensitivity_Plots/"+file_prefix+"_histos.root");
 
 c1 = ROOT.TCanvas(file_prefix);
 
list t_graphs = []
 
list line_styles = [1,2,3]
 
list line_colors = [1,2,4]
 
 temp = ROOT.TGraph(len(bin_centers_array),bin_centers_array,array.array('d',medians[i]));
 
string nu_string = "#nu_{#mu}"
 
 leg = ROOT.TLegend(0.45,0.3,0.85,0.55);
 
list sensitivity_changes = []
 
list flux_changes = []
 
 variation = amounts_varied[variation_iter]
 
 temp_file = ROOT.TFile("/lbne/data/users/ljf26/fluxfiles/sensitivity_comps_"+str(variation)+"_improved.root");
 
 mygraph = temp_file.Get(plotvar+"_"+mode+"_"+nu+"_"+hierarchy)
 
list temps = []
 
list lines = []
 
list tempfuncs = []
 
int xlow = -20
 
int xhigh = 1000
 
float maximum = 0.6
 
float minimum = -0.6
 
 myrange = ROOT.TMath.Max(ROOT.TMath.Abs(maximum),ROOT.TMath.Abs(minimum));
 
 title = ROOT.gPad.GetPrimitive("title");
 
int iter_100 = -1
 
int iter_110 = -1
 
tuple slope = (sensitivity_changes[bin_iter][iter_110]-sensitivity_changes[bin_iter][iter_100])/(flux_changes[bin_iter][iter_110]-flux_changes[bin_iter][iter_100]);
 
 y_int = sensitivity_changes[bin_iter][iter_110]-slope*flux_changes[bin_iter][iter_110];
 
 ylow_line = slope*xlow+y_int
 
 yhigh_line = slope*xhigh+y_int
 
 xlow_line = xlow
 
 xhigh_line = xhigh
 
string scale_string = "fixedScale"
 

Function Documentation

def drawSensitivitySummaries_simplevars_improved.GetFractionAtMoreThanXSigma (   histo,
  X 
)

Definition at line 49 of file drawSensitivitySummaries_simplevars_improved.py.

50  n = histo.GetNbinsX();
51 
52  greaterThanX = 0.0;
53  total = 0.0;
54 
55  for i in range(0,n):
56  total = total + float(histo.GetBinWidth(i+1));
57  if(histo.GetBinContent(i+1)>=X):
58  greaterThanX = greaterThanX + float(histo.GetBinWidth(i+1));
59 
60 
61  return greaterThanX/total
62 
if(!yymsg) yymsg
def drawSensitivitySummaries_simplevars_improved.GetMedian (   histo)

Definition at line 30 of file drawSensitivitySummaries_simplevars_improved.py.

30 def GetMedian(histo):
31  n = histo.GetNbinsX();
32  x = []
33  y = []
34 
35  for i in range(0,n):
36  x.append(histo.GetBinCenter(i+1));
37  y.append(histo.GetBinContent(i+1));
38  y_array = array.array('d',y)
39 
40  return ROOT.TMath.Median(n,y_array);
41 
def drawSensitivitySummaries_simplevars_improved.GetMinimum (   histo)

Definition at line 42 of file drawSensitivitySummaries_simplevars_improved.py.

42 def GetMinimum(histo):
43  min = 99999
44  for i in range(0,histo.GetNbinsX()):
45  if histo.GetBinContent(i+1) < min:
46  min = histo.GetBinContent(i+1)
47  return min
48 
def drawSensitivitySummaries_simplevars_improved.GetPercentile (   histo,
  X 
)

Definition at line 13 of file drawSensitivitySummaries_simplevars_improved.py.

13 def GetPercentile(histo,X):
14  n = histo.GetNbinsX();
15  x = []
16  y = []
17 
18  for i in range(0,n):
19  x.append(histo.GetBinCenter(i+1));
20  y.append(histo.GetBinContent(i+1));
21  y_array = array.array('d',y)
22 
23  percentiles = array.array('d',[0.0]);
24  probs = array.array('d',[1-float(X)/100.0])
25 
26  ROOT.TMath.Quantiles(n,1,y_array,percentiles,probs,False);
27  return percentiles[0]
28 
29 
def drawSensitivitySummaries_simplevars_improved.myfunc (   x,
  par 
)

Definition at line 10 of file drawSensitivitySummaries_simplevars_improved.py.

10 def myfunc(x, par):
11  return tempgraphs[int(par[0])].Eval(x[0]);
12 

Variable Documentation

list drawSensitivitySummaries_simplevars_improved.amounts_varied = [0,50,90,110,200,500]
drawSensitivitySummaries_simplevars_improved.baseline_file = ROOT.TFile("/lbne/data/users/lblpwg_tools/FastMC_Data/outputs/ljf26/Sensitivity_Plots/ProtonP120GeV_"+hierarchy+"_"+mixing_param+"_histos.root");
list drawSensitivitySummaries_simplevars_improved.baseline_medians = []
list drawSensitivitySummaries_simplevars_improved.bin_centers = [0.25,0.75,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,12.5,17.5,70.0]
drawSensitivitySummaries_simplevars_improved.bin_centers_array = array.array('d',bin_centers)
drawSensitivitySummaries_simplevars_improved.c1 = ROOT.TCanvas(file_prefix);
string drawSensitivitySummaries_simplevars_improved.file_prefix = mode+nu+var+"_"
list drawSensitivitySummaries_simplevars_improved.flux_changes = []
list drawSensitivitySummaries_simplevars_improved.hierarchies = ["nh","ih"]
drawSensitivitySummaries_simplevars_improved.iter_100 = -1
drawSensitivitySummaries_simplevars_improved.iter_110 = -1
drawSensitivitySummaries_simplevars_improved.leg = ROOT.TLegend(0.45,0.3,0.85,0.55);
list drawSensitivitySummaries_simplevars_improved.line_colors = [1,2,4]
list drawSensitivitySummaries_simplevars_improved.line_styles = [1,2,3]
list drawSensitivitySummaries_simplevars_improved.lines = []
drawSensitivitySummaries_simplevars_improved.maximum = 0.6
list drawSensitivitySummaries_simplevars_improved.medians = [[],[],[]]
drawSensitivitySummaries_simplevars_improved.minimum = -0.6
drawSensitivitySummaries_simplevars_improved.mixing_param = plotvar[0:2]
list drawSensitivitySummaries_simplevars_improved.modes = ["fhc","rhc"]
drawSensitivitySummaries_simplevars_improved.mygraph = temp_file.Get(plotvar+"_"+mode+"_"+nu+"_"+hierarchy)
drawSensitivitySummaries_simplevars_improved.myrange = ROOT.TMath.Max(ROOT.TMath.Abs(maximum),ROOT.TMath.Abs(minimum));
string drawSensitivitySummaries_simplevars_improved.nu_string = "#nu_{#mu}"
list drawSensitivitySummaries_simplevars_improved.nus = ["numu","numubar","nuenuebar"]
drawSensitivitySummaries_simplevars_improved.outfile = ROOT.TFile("/lbne/data/users/ljf26/fluxfiles/sensitivity_comps_"+str(amount_varied)+"_improved.root","RECREATE");
list drawSensitivitySummaries_simplevars_improved.plotvars = ["cp_75thpercentile","mh_minimum"]
string drawSensitivitySummaries_simplevars_improved.scale_string = "fixedScale"
list drawSensitivitySummaries_simplevars_improved.sensitivity_changes = []
tuple drawSensitivitySummaries_simplevars_improved.slope = (sensitivity_changes[bin_iter][iter_110]-sensitivity_changes[bin_iter][iter_100])/(flux_changes[bin_iter][iter_110]-flux_changes[bin_iter][iter_100]);
drawSensitivitySummaries_simplevars_improved.t_file = ROOT.TFile("/lbne/data/users/lblpwg_tools/FastMC_Data/outputs/ljf26/Sensitivity_Plots/"+file_prefix+"_histos.root");
list drawSensitivitySummaries_simplevars_improved.t_graphs = []
drawSensitivitySummaries_simplevars_improved.temp = ROOT.TGraph(len(bin_centers_array),bin_centers_array,array.array('d',medians[i]));
drawSensitivitySummaries_simplevars_improved.temp_file = ROOT.TFile("/lbne/data/users/ljf26/fluxfiles/sensitivity_comps_"+str(variation)+"_improved.root");
list drawSensitivitySummaries_simplevars_improved.tempfuncs = []
list drawSensitivitySummaries_simplevars_improved.tempgraphs = []
list drawSensitivitySummaries_simplevars_improved.temps = []
drawSensitivitySummaries_simplevars_improved.title = ROOT.gPad.GetPrimitive("title");
bool drawSensitivitySummaries_simplevars_improved.use_fixed_scale = True
bool drawSensitivitySummaries_simplevars_improved.use_realistic_powers = True
drawSensitivitySummaries_simplevars_improved.var = vars[i]+str(amount_varied)
drawSensitivitySummaries_simplevars_improved.variation = amounts_varied[variation_iter]
list drawSensitivitySummaries_simplevars_improved.vars = ["0to0p5GeVPlus10per","0p5to1GeVPlus10per","1to2GeVPlus10per","2to3GeVPlus10per","3to4GeVPlus10per","4to5GeVPlus10per","5to6GeVPlus10per","6to7GeVPlus10per","7to8GeVPlus10per","8to9GeVPlus10per","9to10GeVPlus10per","10to15GeVPlus10per","15to20GeVPlus10per","20to120GeVPlus10per"]
int drawSensitivitySummaries_simplevars_improved.xhigh = 1000
tuple drawSensitivitySummaries_simplevars_improved.xhigh_line = xhigh
int drawSensitivitySummaries_simplevars_improved.xlow = -20
tuple drawSensitivitySummaries_simplevars_improved.xlow_line = xlow
drawSensitivitySummaries_simplevars_improved.y_int = sensitivity_changes[bin_iter][iter_110]-slope*flux_changes[bin_iter][iter_110];
float drawSensitivitySummaries_simplevars_improved.yhigh_line = slope*xhigh+y_int
float drawSensitivitySummaries_simplevars_improved.ylow_line = slope*xlow+y_int