13from ROOT
import Belle2
14from ROOT
import TH1F, TH2F, TFile, TProfile
25 ''' determination of average quantum and collection efficiency from TOPPmtQEs '''
28 ''' run the procedure, store the results in a root file and print in xml format '''
31 if dbarray.getEntries() == 0:
32 b2.B2ERROR(
"No entries in TOPPmtQEs")
37 b2.B2ERROR(
"No TOPGeometry")
42 lambdaStep = dbarray[0].getLambdaStep()
43 lambdaFirst = dbarray[0].getLambdaFirst()
44 lambdaLast = dbarray[0].getLambdaLast()
45 n = int((lambdaLast - lambdaFirst) / lambdaStep) + 1
46 print(lambdaFirst, lambdaLast, lambdaStep, n)
52 pde_2d = TH2F(
"pde_2d",
"quantum times collection efficiencies " + Bfield,
53 n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
55 pde_prof = TProfile(
"pde_prof",
"quantum times collection efficiencies " + Bfield,
56 n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
58 pde_nom = TH1F(
"pde_nom",
"nominal quantum times collection efficiency (as found in DB)",
59 n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2)
60 ce_1d = TH1F(
"ce_1d",
"collection efficiencies " + Bfield, 100, 0.0, 1.0)
64 ce_1d.Fill(pmtQE.getCE(Bfield_on))
65 ce += pmtQE.getCE(Bfield_on)
66 for pmtPixel
in range(1, 17):
68 lam = lambdaFirst + lambdaStep * i
69 effi = pmtQE.getEfficiency(pmtPixel, lam, Bfield_on)
70 pde_2d.Fill(lam, effi)
71 pde_prof.Fill(lam, effi)
73 nominalQE = geo.getNominalQE()
75 lam = lambdaFirst + lambdaStep * i
76 effi = nominalQE.getEfficiency(lam)
77 pde_nom.SetBinContent(i+1, effi)
79 ce /= dbarray.getEntries()
80 print(
'average CE =', ce)
81 file = TFile(
'averageQE.root',
'recreate')
90 print(
'<ColEffi descr="average over all PMTs for 1.5 T">' + str(round(ce, 4)) +
'</ColEffi>')
92 print(
'<ColEffi descr="average over all PMTs for 0 T">' + str(round(ce, 4)) +
'</ColEffi>')
93 print(
'<LambdaFirst unit="nm">' + str(lambdaFirst) +
'</LambdaFirst>')
94 print(
'<LambdaStep unit="nm">' + str(lambdaStep) +
'</LambdaStep>')
96 qe = pde_prof.GetBinContent(i+1) / ce
97 print(
'<Qeffi>' + str(round(qe, 3)) +
'</Qeffi>')
104 b2.conditions.append_globaltag(argvs[1])
107main = b2.create_path()
110eventinfosetter = b2.register_module(
'EventInfoSetter')
111eventinfosetter.param({
'evtNumList': [1]})
112main.add_module(eventinfosetter)
Class to access a DB Array from Python.
Class to access a DBObjPtr from Python.