16from ROOT.Belle2
import ARICHDatabaseImporter
18from optparse
import OptionParser
24 xlow = h.GetBinLowEdge(1)
25 xup = h.GetBinLowEdge(nbins + 1)
26 mf = ROOT.TF1(
'mf',
'pol0')
29 hmask = ROOT.TH1S(
"ARICHChannelMask",
"ARICHChannelMask", nbins, xlow, xup)
32 maxHits = int(mf.GetParameter(0) * 20)
34 for bin
in range(nbins + 1):
36 if (h.GetBinContent(bin) > maxHits):
39 if (h.GetBinContent(bin) < minHits):
42 hmask.SetBinContent(bin, value)
43 print(
'<mean>{}</mean>'.format(mf.GetParameter(0)))
44 print(
'<max>{}</max>'.format(h.GetMaximum()))
45 print(
'<rms>{}</rms>'.format(h.GetRMS()))
46 print(
'<maxHits>{}<maxHits>'.format(maxHits))
47 print(
'<minHits>{}</minHits>'.format(minHits))
48 print(
'<nall>{}</nall>'.format(nbins))
49 print(
'<nhot>{}</nhot>'.format(nhot))
50 print(
'<ndead>{}</ndead>'.format(ndead))
55parser = OptionParser()
56parser.add_option(
'-f',
'--file', dest=
'filename', default=
'DQMhistograms.root')
57parser.add_option(
'--hname', dest=
'hname', default=
'ARICHDQM/chHit')
58parser.add_option(
'-e',
'--firstexp', dest=
'firstexp', default=0, type=
"int", help=
"IntevalOfValidity first experiment")
59parser.add_option(
'--lastexp', dest=
'lastexp', default=-1, type=
"int", help=
"IntevalOfValidity last experiment")
60parser.add_option(
'-r',
'--firstrun', dest=
'firstrun', default=0, type=
"int", help=
"IntevalOfValidity first run")
61parser.add_option(
'--lastrun', dest=
'lastrun', default=-1, type=
"int", help=
"IntevalOfValidity last run")
62parser.add_option(
'-d',
'--dryrun', dest=
'dryrun', default=0, type=
"int", help=
"do not export to database")
63(options, args) = parser.parse_args()
66b2.use_local_database(
"localdb/database.txt",
"localdb", 0, b2.LogLevel.INFO)
69print(
'<run>{}</run>'.format(options.firstrun))
70print(
'<exp>{}</exp>'.format(options.firstexp))
71print(
'<fname>{}</fname>'.format(options.filename))
75f = ROOT.TFile(options.filename)
76h = f.Get(options.hname)
80hmask = GetChannelMask(h)
83if (options.dryrun == 0):
84 ARICHDatabaseImporter().
importChannelMask(hmask, options.firstexp, options.firstrun, options.lastexp, options.lastrun)