14 from ROOT
import Belle2
15 from ROOT
import TH1F, TH2F, TFile, TProfile
26 ''' determination of average quantum and collection efficiency from TOPPmtQEs '''
29 ''' run the procedure, store the results in a root file and print in xml format '''
32 if dbarray.getEntries() == 0:
33 b2.B2ERROR(
"No entries in TOPPmtQEs")
38 b2.B2ERROR(
"No TOPGeometry")
43 lambdaStep = dbarray[0].getLambdaStep()
44 lambdaFirst = dbarray[0].getLambdaFirst()
45 lambdaLast = dbarray[0].getLambdaLast()
46 n = int((lambdaLast - lambdaFirst) / lambdaStep) + 1
47 print(lambdaFirst, lambdaLast, lambdaStep, n)
53 pde_2d = TH2F(
"pde_2d",
"quantum times collection efficiencies " + Bfield,
54 n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
56 pde_prof = TProfile(
"pde_prof",
"quantum times collection efficiencies " + Bfield,
57 n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
59 pde_nom = TH1F(
"pde_nom",
"nominal quantum times collection efficiency (as found in DB)",
60 n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2)
61 ce_1d = TH1F(
"ce_1d",
"collection efficiencies " + Bfield, 100, 0.0, 1.0)
65 ce_1d.Fill(pmtQE.getCE(Bfield_on))
66 ce += pmtQE.getCE(Bfield_on)
67 for pmtPixel
in range(1, 17):
69 lam = lambdaFirst + lambdaStep * i
70 effi = pmtQE.getEfficiency(pmtPixel, lam, Bfield_on)
71 pde_2d.Fill(lam, effi)
72 pde_prof.Fill(lam, effi)
74 nominalQE = geo.getNominalQE()
76 lam = lambdaFirst + lambdaStep * i
77 effi = nominalQE.getEfficiency(lam)
78 pde_nom.SetBinContent(i+1, effi)
80 ce /= dbarray.getEntries()
81 print(
'average CE =', ce)
82 file = TFile(
'averageQE.root',
'recreate')
91 print(
'<ColEffi descr="average over all PMTs for 1.5 T">' + str(round(ce, 4)) +
'</ColEffi>')
93 print(
'<ColEffi descr="average over all PMTs for 0 T">' + str(round(ce, 4)) +
'</ColEffi>')
94 print(
'<LambdaFirst unit="nm">' + str(lambdaFirst) +
'</LambdaFirst>')
95 print(
'<LambdaStep unit="nm">' + str(lambdaStep) +
'</LambdaStep>')
97 qe = pde_prof.GetBinContent(i+1) / ce
98 print(
'<Qeffi>' + str(round(qe, 3)) +
'</Qeffi>')
105 b2.conditions.append_globaltag(argvs[1])
108 main = b2.create_path()
111 eventinfosetter = b2.register_module(
'EventInfoSetter')
112 eventinfosetter.param({
'evtNumList': [1]})
113 main.add_module(eventinfosetter)
Class to access a DB Array from Python.
Class to access a DBObjPtr from Python.