13from ROOT
import Belle2, TFile
24 print(
"usage: basf2", sys.argv[0],
"expNo runNo [globalTag/localDB]")
27expNo = int(sys.argv[1])
28runNo = int(sys.argv[2])
29globalTag =
"data_reprocessing_prompt"
31 globalTag = sys.argv[3]
35 ''' Saving histograms from the payload to a root file'''
38 ''' initialize: saving histograms implemented here '''
44 fileName =
"photonYields-" + time.strftime(
"%Y-%m-%d", time.localtime(db.getTimeStamp())) +
".root"
45 f = TFile.Open(fileName,
"recreate")
47 print(
"- global tag:", globalTag)
48 print(
"- time of measurement:",
49 time.strftime(
"%d %b %Y %H:%M:%S", time.localtime(db.getTimeStamp())),
"(mean), ",
50 round(db.getTimeStampStd() / 3600 / 24, 2),
"days (rms)")
51 for slot
in range(1, 17):
52 h = db.getPhotonYields(slot)
55 h = db.getBackgroundYields(slot)
58 h = db.getAlphaRatio(slot)
61 h = db.getActivePixels(slot)
64 h = db.getPulseHeights(slot)
71 print(
"--> histograms saved to:", fileName)
74b2.set_log_level(b2.LogLevel.ERROR)
76if '.txt' in globalTag:
77 b2.conditions.append_testing_payloads(globalTag)
79 b2.conditions.append_globaltag(globalTag)
81main = b2.create_path()
82main.add_module(
'EventInfoSetter', evtNumList=[1], runList=[runNo], expList=[expNo])
Class to access a DBObjPtr from Python.