Belle II Software  release-08-01-10
SaveCanvases Class Reference
Inheritance diagram for SaveCanvases:
Collaboration diagram for SaveCanvases:

Public Member Functions

def makePlot (self, h, slot, pmt)
 
def initialize (self)
 

Detailed Description

 Extract pulse height distributions from TOPCalPhotonYields and save canvases into a root file 

Definition at line 34 of file pmtPulseHeights.py.

Member Function Documentation

◆ initialize()

def initialize (   self)
 initialize: implementation 

Definition at line 69 of file pmtPulseHeights.py.

69  def initialize(self):
70  ''' initialize: implementation '''
71 
72  gROOT.SetBatch(True)
73 
74  db = Belle2.PyDBObj("TOPCalPhotonYields")
75  if not db:
76  return
77 
78  fileName = "pmtPulseHeights-" + time.strftime("%Y-%m-%d", time.localtime(db.getTimeStamp())) + ".root"
79  f = TFile.Open(fileName, "recreate")
80 
81  print("- global tag:", globalTag)
82  print("- time of measurement:",
83  time.strftime("%d %b %Y %H:%M:%S", time.localtime(db.getTimeStamp())), "(mean), ",
84  round(db.getTimeStampStd() / 3600 / 24, 2), "days (rms)")
85  oldDir = gDirectory
86  histos = []
87  for slot in range(1, 17):
88  oldDir.mkdir("slot" + f'{slot:02d}').cd()
89  h = db.getPulseHeights(slot)
90  if not h:
91  continue
92  hmean = TH1F('meanPH', 'slot ' + str(slot) + '; PMT number; mean pulse-height', 32, 0.5, 32.5)
93  for pmt in range(1, 33):
94  meanPH = self.makePlot(h, slot, pmt)
95  hmean.SetBinContent(pmt, meanPH)
96  histos.append(hmean)
97  oldDir.cd("..")
98 
99  canvas = TCanvas("meanPH", "Mean pulse-heights", 1000, 1000)
100  canvas.Divide(4, 4)
101  for i, h in enumerate(histos):
102  canvas.cd(i + 1)
103  h.Draw()
104  canvas.Write()
105  f.Close()
106  print("--> canvases saved to:", fileName)
107 
108 
109 b2.set_log_level(b2.LogLevel.ERROR)
110 
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50

◆ makePlot()

def makePlot (   self,
  h,
  slot,
  pmt 
)
Makes a plot of pulse-height distributions of pixels of a single PMT and saves the canvas
:param h: a 2D histogram of pulse-height vs. pixel
:param slot: slot number
:param pmt: PMT number

Definition at line 37 of file pmtPulseHeights.py.


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