Belle II Software development
SignalToNoiseOverCut Class Reference
Inheritance diagram for SignalToNoiseOverCut:
Plotter

Public Member Functions

def add (self, data, column, signal_mask, bckgrd_mask, weight_column=None, normed=True)
 
def finish (self)
 

Public Attributes

 xmax
 Maximum x value.
 
 ymax
 Maximum y value.
 

Detailed Description

Plots the signal to noise ratio over the cut value (for cut choosing)

Definition at line 338 of file plotting.py.

Member Function Documentation

◆ add()

def add (   self,
  data,
  column,
  signal_mask,
  bckgrd_mask,
  weight_column = None,
  normed = True 
)
Add a new curve to the plot
@param data pandas.DataFrame containing all data
@param column which is used to calculate signal to noise ratio for different cuts
@param signal_mask boolean numpy.array defining which events are signal events
@param bckgrd_mask boolean numpy.array defining which events are background events
@param weight_column column in data containing the weights for each event

Reimplemented from Plotter.

Definition at line 347 of file plotting.py.

347 def add(self, data, column, signal_mask, bckgrd_mask, weight_column=None, normed=True):
348 """
349 Add a new curve to the plot
350 @param data pandas.DataFrame containing all data
351 @param column which is used to calculate signal to noise ratio for different cuts
352 @param signal_mask boolean numpy.array defining which events are signal events
353 @param bckgrd_mask boolean numpy.array defining which events are background events
354 @param weight_column column in data containing the weights for each event
355 """
356
357 hists = histogram.Histograms(data, column, {'Signal': signal_mask, 'Background': bckgrd_mask}, weight_column=weight_column)
358
359 signal2noise, signal2noise_error = hists.get_signal_to_noise(['Signal'], ['Background'])
360
361 cuts = hists.bin_centers
362
363 self.xmin, self.xmax = numpy.nanmin([numpy.nanmin(cuts), self.xmin]), numpy.nanmax([numpy.nanmax(cuts), self.xmax])
364 self.ymin, self.ymax = numpy.nanmin([numpy.nanmin(signal2noise), self.ymin]), \
365 numpy.nanmax([numpy.nanmax(signal2noise), self.ymax])
366
367 self.plots.append(self._plot_datapoints(self.axis, cuts, signal2noise, xerr=0, yerr=signal2noise_error))
368
369 self.labels.append(column)
370
371 return self
372

◆ finish()

def finish (   self)
Sets limits, title, axis-labels and legend of the plot

Reimplemented from Plotter.

Definition at line 373 of file plotting.py.

373 def finish(self):
374 """
375 Sets limits, title, axis-labels and legend of the plot
376 """
377 self.axis.set_xlim((self.xmin, self.xmax))
378 self.axis.set_ylim((self.ymin, self.ymax))
379 self.axis.set_title("Signal to Noise Plot")
380 self.axis.get_xaxis().set_label_text('Cut Value')
381 self.axis.legend([x[0] for x in self.plots], self.labels, loc='best', fancybox=True, framealpha=0.5)
382 return self
383
384

Member Data Documentation

◆ xmax

xmax

Maximum x value.

Definition at line 363 of file plotting.py.

◆ ymax

ymax

Maximum y value.

Definition at line 364 of file plotting.py.


The documentation for this class was generated from the following file: