Belle II Software  release-05-02-19
ConditionCheckerBase Class Reference
Inheritance diagram for ConditionCheckerBase:
Collaboration diagram for ConditionCheckerBase:

Public Member Functions

def __init__ (self, name, objType, tfile, rundir="", use_hist=False)
 
def objType (self)
 
def run (self)
 
def exp (self)
 
def beginRun (self)
 
def define_graphs (self, ytitle="")
 
def define_hists (self, name=None, title=None, ztitle=None, **kwargs)
 
def get_db_content (self)
 
def get_graph_value (self, sensor_db_content)
 
def get_graph_value_from_hist (self, h2=None)
 
def set_hist_content (self, h2, sensor_db_content)
 
def fill_plots (self)
 
def draw_plots (self, canvas=None, cname="", ymin=0., ymax=None)
 
def save_canvas (self, canvas, cname, with_logy=False)
 

Public Attributes

 name
 DBObj name.
 
 dbObj
 DBObjPtr for the condition.
 
 eventMetaData
 pointer to the event metadata
 
 tfile
 TFile for saving plots.
 
 rundir
 Directory for writing histograms of each run.
 
 graphs
 Dictionary of plots (TGraph) summarizing variables vs run.
 
 hists
 Dictionary of plots (TH1) to be saved for each run.
 
 hist_title_suffix
 Hist title suffix.
 
 runstart
 The 1st run.
 
 runend
 The last run.
 
 expstart
 The 1st exp.
 
 use_hist
 Flag to get TGraph values from a histogram (TH2F)
 

Private Attributes

 _objType
 DBObj type.
 

Detailed Description

Abstract base class describing interfaces to make plots from condition db.

Definition at line 43 of file condition_checker.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  objType,
  tfile,
  rundir = "",
  use_hist = False 
)
 

Definition at line 46 of file condition_checker.py.

46  def __init__(self, name, objType, tfile, rundir="", use_hist=False):
47  """
48  """
49  super().__init__()
50 
51  self.name = name
52 
53  self._objType = objType
54 
55  self.dbObj = Belle2.PyDBObj(self.name, self.objType.Class())
56 
57  self.eventMetaData = Belle2.PyStoreObj("EventMetaData")
58 
59  self.tfile = tfile
60 
61  self.rundir = rundir # empty means skipping self.hists
62  if self.rundir != "":
63  self.tfile.cd()
64  self.tfile.mkdir(self.rundir)
65 
66  self.graphs = {}
67 
68  self.hists = {}
69 
70  self.hist_title_suffix = ""
71 
72  self.runstart = 999999 # a big number that will never be used
73 
74  self.runend = -1
75 
76  self.expstart = 999999
77 
78  self.use_hist = use_hist
79 
80  self.define_graphs()
81 

Member Function Documentation

◆ beginRun()

def beginRun (   self)
Call functions at beginning of a run

Definition at line 103 of file condition_checker.py.

◆ define_graphs()

def define_graphs (   self,
  ytitle = "" 
)
Method to define TGraph
Parameters:
  ytitle (str): Label for TGraph y-axis

Definition at line 110 of file condition_checker.py.

◆ define_hists()

def define_hists (   self,
  name = None,
  title = None,
  ztitle = None,
**  kwargs 
)
Method to define TH2
Parameters:
  name (str): name for TH2, to which sensor name will be attached
  title (str): title for TH2
  ztitle (str): title for z-axis (color bar)
  kwargs: additional arguments

Definition at line 119 of file condition_checker.py.

◆ draw_plots()

def draw_plots (   self,
  canvas = None,
  cname = "",
  ymin = 0.,
  ymax = None 
)
Method to draw plots on a TCanvas
Parameters:
  canvas (TCanvas): ROOT TCanvas for plotting
  canme (str): Name of the canvas
  ymin (float): minimum value of y-axis for plotting
  ymax (float): maximum of y-axis for plotting

Reimplemented in PXDMaskedPixelsChecker, PXDGainMapChecker, and PXDDeadPixelsChecker.

Definition at line 206 of file condition_checker.py.

◆ exp()

def exp (   self)
Experiment number

Definition at line 97 of file condition_checker.py.

◆ fill_plots()

def fill_plots (   self)
Method to fill plot objects

Definition at line 164 of file condition_checker.py.

◆ get_db_content()

def get_db_content (   self)
Abstract method to get content of a payload
Should return a Dictionary with sensorID.getID() as key and relaated calibration results as value

Reimplemented in PXDGainMapChecker, PXDDeadPixelsChecker, PXDMaskedPixelsChecker, and PXDOccupancyInfoChecker.

Definition at line 133 of file condition_checker.py.

◆ get_graph_value()

def get_graph_value (   self,
  sensor_db_content 
)
Abstract method to get a value for each TGraph
Parameters:
  sensor_db_content (Any): Calibration results of a module

Reimplemented in PXDGainMapChecker, PXDDeadPixelsChecker, PXDMaskedPixelsChecker, and PXDOccupancyInfoChecker.

Definition at line 140 of file condition_checker.py.

◆ get_graph_value_from_hist()

def get_graph_value_from_hist (   self,
  h2 = None 
)
Method to get a value for each TGraph
Parameters:
  h2 (TH2): If not none, get value from h2

Reimplemented in PXDDeadPixelsChecker.

Definition at line 147 of file condition_checker.py.

◆ objType()

def objType (   self)
DBObj type (read only)

Definition at line 83 of file condition_checker.py.

◆ run()

def run (   self)
Run number

Definition at line 90 of file condition_checker.py.

◆ save_canvas()

def save_canvas (   self,
  canvas,
  cname,
  with_logy = False 
)
Save TCanvas to png/pdf format and write it to the default ROOT file

Definition at line 237 of file condition_checker.py.

◆ set_hist_content()

def set_hist_content (   self,
  h2,
  sensor_db_content 
)
Method to set TH2 bins
Parameters:
  h2 (TH2): TH2F object for handling values of a pixel matrix
  sensor_db_content (Any): Calibration results of a module

Reimplemented in PXDGainMapChecker, PXDDeadPixelsChecker, and PXDMaskedPixelsChecker.

Definition at line 155 of file condition_checker.py.


The documentation for this class was generated from the following file:
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:69
Belle2::PyDBObj
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50