Functions | Variables
styles Namespace Reference

Functions

def parseDrawingConfig (plot_name, components, verbose=False)
 parse drawing configuration options from the name of a histogram and a list of components More...
 
def parseAxisLabels (name)
 parse the axis labels from a plot name More...
 

Variables

list truth_colours = [ROOT.kRed, ROOT.kMagenta+2,ROOT.kBlue+2,ROOT.kCyan+2, ROOT.kGreen+2, ROOT.kGray, ROOT.kOrange]
 
list data_colours = [ROOT.kBlack, ROOT.kBlue, ROOT.kGreen, ROOT.kRed]
 
list lines = [0,1,2,3,0,1,2,3]
 
list markers = [20,21,22,23,24,25,26]
 

Function Documentation

def styles.parseAxisLabels (   name)

parse the axis labels from a plot name

Definition at line 66 of file styles.py.

References naming_schema.observableName(), and split().

Referenced by parseDrawingConfig().

66 def parseAxisLabels(name):
67  import naming_schema
68  import common_tools as tools
69  # histograms should follow a logical naming convention:
70  # <category>/<observable>_<reconstruction level>_<truth level>
71  # category = reco, true, mixed
72  if (not tools.isLogicalHistogramName(name)):
73  print "style: Histogram name: %s does not follow expected naming conventions"%name
74  return "x;y;"
75  if "_vs_" in name:
76  tokens = tools.getHistogramObservable(name).split("_vs_")
77  labels = "%s;%s"%(naming_schema.observableName(tokens[0]),naming_schema.observableName(tokens[1]))
78  else:
79  labels = "%s;Entries"%naming_schema.observableName(tools.getHistogramObservable(name))
80  return labels
81 
void split(double tt, double *fr)
def observableName(name)
get a histogram observable name
def parseAxisLabels(name)
parse the axis labels from a plot name
Definition: styles.py:66
def styles.parseDrawingConfig (   plot_name,
  components,
  verbose = False 
)

parse drawing configuration options from the name of a histogram and a list of components

Definition at line 10 of file styles.py.

References naming_schema.datasetToLabel(), and parseAxisLabels().

Referenced by ControllerView.ControllerView.draw_plots().

10 def parseDrawingConfig(plot_name, components, verbose=False):
11  import naming_schema
12  suffixes = naming_schema.standard_truth_components[1:]
13  i_truth = 0
14  # lazy man's object
15  draw_config = type('draw_config', (object,), {})()
16  draw_config.labels = []
17  draw_config.axis_labels = parseAxisLabels(plot_name)
18  draw_config.colours = []
19  draw_config.lines = []
20  draw_config.markers = []
21  draw_config.draw_options = []
22  for i,component in enumerate(components):
23  if hasattr(component, "label"):
24  label = naming_schema.datasetToLabel(component.label)
25  else:
26  label = naming_schema.datasetToLabel(component.dataset)
27  if ("-truth_components" in plot_name) and (label in draw_config.labels):
28  label = suffixes[i_truth]
29  i_truth +=1
30  if i_truth >= len(suffixes): i_truth = 0
31  draw_config.labels.append(label)
32  draw_config.lines.append(lines[i])
33  draw_config.markers.append(markers[i])
34 
35  if ("data" in draw_config.labels[-1]):
36  if ("surface" in plot_name) or ("_vs_" in plot_name):
37  if len(components) == 1:
38  draw_config.draw_options.append("COLZ")
39  else:
40  draw_config.draw_options.append("BOX")
41  elif ("contour" in plot_name):
42  draw_config.draw_options.append("L")
43  elif ("sensitivity_bestfit" in plot_name):
44  draw_config.draw_options.append("P")
45  else:
46  draw_config.draw_options.append("EX09")
47  draw_config.colours.append(data_colours[i])
48 
49  else:
50  if ("surface" in plot_name) or ("_vs_" in plot_name):
51  if len(components) == 1:
52  draw_config.draw_options.append("COLZ")
53  else:
54  draw_config.draw_options.append("BOX")
55  elif ("contour" in plot_name):
56  draw_config.draw_options.append("L")
57  elif ("sensitivity_bestfit" in plot_name):
58  draw_config.draw_options.append("P")
59  else:
60  draw_config.draw_options.append("hist9")
61  draw_config.colours.append(truth_colours[i])
62 
63  return draw_config
def parseDrawingConfig(plot_name, components, verbose=False)
parse drawing configuration options from the name of a histogram and a list of components ...
Definition: styles.py:10
def datasetToLabel(name)
convert the dataset name to a label
def parseAxisLabels(name)
parse the axis labels from a plot name
Definition: styles.py:66

Variable Documentation

list styles.data_colours = [ROOT.kBlack, ROOT.kBlue, ROOT.kGreen, ROOT.kRed]

Definition at line 5 of file styles.py.

list styles.lines = [0,1,2,3,0,1,2,3]

Definition at line 6 of file styles.py.

list styles.truth_colours = [ROOT.kRed, ROOT.kMagenta+2,ROOT.kBlue+2,ROOT.kCyan+2, ROOT.kGreen+2, ROOT.kGray, ROOT.kOrange]

Definition at line 4 of file styles.py.