Belle II Software  release-06-01-15
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, logy=False)
 
def save_canvas (self, canvas, cname, 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 50 of file condition_checker.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 53 of file condition_checker.py.

53  def __init__(self, name, objType, tfile, rundir="", use_hist=False):
54  """
55  """
56  super().__init__()
57 
58  self.name = name
59 
60  self._objType = objType
61 
62  self.dbObj = Belle2.PyDBObj(self.name, self.objType.Class())
63 
64  self.eventMetaData = Belle2.PyStoreObj("EventMetaData")
65 
66  self.tfile = tfile
67 
68  self.rundir = rundir # empty means skipping self.hists
69  if self.rundir != "":
70  self.tfile.cd()
71  self.tfile.mkdir(self.rundir)
72 
73  self.graphs = {}
74 
75  self.hists = {}
76 
77  self.hist_title_suffix = ""
78 
79  self.runstart = 999999 # a big number that will never be used
80 
81  self.runend = -1
82 
83  self.expstart = 999999
84 
85  self.use_hist = use_hist
86 
87  self.define_graphs()
88 
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:48
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

Member Function Documentation

◆ beginRun()

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

Definition at line 110 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 117 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 126 of file condition_checker.py.

◆ draw_plots()

def draw_plots (   self,
  canvas = None,
  cname = "",
  ymin = 0.,
  ymax = None,
  logy = False 
)
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
  logy (bool): Flag to use log scale for y-axis

Definition at line 213 of file condition_checker.py.

◆ exp()

def exp (   self)
Experiment number

Definition at line 104 of file condition_checker.py.

◆ fill_plots()

def fill_plots (   self)
Method to fill plot objects

Definition at line 171 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 140 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 147 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 154 of file condition_checker.py.

◆ objType()

def objType (   self)
DBObj type (read only)

Definition at line 90 of file condition_checker.py.

◆ run()

def run (   self)
Run number

Definition at line 97 of file condition_checker.py.

◆ save_canvas()

def save_canvas (   self,
  canvas,
  cname,
  logy = False 
)
Save TCanvas to png/pdf format and do not write it to the ROOT file by default
Parameters:
  canvas (TCanvas): ROOT TCanvas for plotting
  canme (str): Name of the canvas
  logy (bool): Flag to use log scale for y-axis

Definition at line 247 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 162 of file condition_checker.py.


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