Belle II Software light-2406-ragdoll
SignalToNoiseOverCut Class Reference
Inheritance diagram for SignalToNoiseOverCut:
Collaboration diagram for SignalToNoiseOverCut:

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 339 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 348 of file plotting.py.

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

◆ finish()

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

Reimplemented from Plotter.

Definition at line 374 of file plotting.py.

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

Member Data Documentation

◆ xmax

xmax

Maximum x value.

Definition at line 364 of file plotting.py.

◆ ymax

ymax

Maximum y value.

Definition at line 365 of file plotting.py.


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