Belle II Software  release-05-02-19
AverageQE Class Reference
Inheritance diagram for AverageQE:
Collaboration diagram for AverageQE:

Public Member Functions

def initialize (self)
 

Detailed Description

determination of average quantum and collection efficiency from TOPPmtQEs 

Definition at line 17 of file averageQE.py.

Member Function Documentation

◆ initialize()

def initialize (   self)
run the procedure, store the results in a root file and print in xml format 

Definition at line 20 of file averageQE.py.

20  def initialize(self):
21  ''' run the procedure, store the results in a root file and print in xml format '''
22 
23  dbarray = Belle2.PyDBArray('TOPPmtQEs')
24  if dbarray.getEntries() == 0:
25  B2ERROR("No entries in TOPPmtQEs")
26  return
27 
28  geo = Belle2.PyDBObj('TOPGeometry')
29  if not geo:
30  B2ERROR("No TOPGeometry")
31  return
32 
33  Bfield_on = True # use collection efficiencies for 1.5 T
34 
35  lambdaStep = dbarray[0].getLambdaStep()
36  lambdaFirst = dbarray[0].getLambdaFirst()
37  lambdaLast = dbarray[0].getLambdaLast()
38  n = int((lambdaLast - lambdaFirst) / lambdaStep) + 1
39  print(lambdaFirst, lambdaLast, lambdaStep, n)
40  if Bfield_on:
41  Bfield = '(1.5 T)'
42  else:
43  Bfield = '(0 T)'
44 
45  pde_2d = TH2F("pde_2d", "quantum times collection efficiencies " + Bfield,
46  n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
47  300, 0.0, 1.0)
48  pde_prof = TProfile("pde_prof", "quantum times collection efficiencies " + Bfield,
49  n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
50  0.0, 1.0)
51  pde_nom = TH1F("pde_nom", "nominal quantum times collection efficiency (as found in DB)",
52  n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2)
53  ce_1d = TH1F("ce_1d", "collection efficiencies " + Bfield, 100, 0.0, 1.0)
54 
55  ce = 0
56  for pmtQE in dbarray:
57  ce_1d.Fill(pmtQE.getCE(Bfield_on))
58  ce += pmtQE.getCE(Bfield_on)
59  for pmtPixel in range(1, 17):
60  for i in range(n):
61  lam = lambdaFirst + lambdaStep * i
62  effi = pmtQE.getEfficiency(pmtPixel, lam, Bfield_on)
63  pde_2d.Fill(lam, effi)
64  pde_prof.Fill(lam, effi)
65 
66  nominalQE = geo.getNominalQE()
67  for i in range(n):
68  lam = lambdaFirst + lambdaStep * i
69  effi = nominalQE.getEfficiency(lam)
70  pde_nom.SetBinContent(i+1, effi)
71 
72  ce /= dbarray.getEntries()
73  print('average CE =', ce)
74  file = TFile('averageQE.root', 'recreate')
75  pde_2d.Write()
76  pde_prof.Write()
77  pde_nom.Write()
78  ce_1d.Write()
79  file.Close()
80 
81  print()
82  if Bfield_on:
83  print('<ColEffi descr="average over all PMTs for 1.5 T">' + str(round(ce, 4)) + '</ColEffi>')
84  else:
85  print('<ColEffi descr="average over all PMTs for 0 T">' + str(round(ce, 4)) + '</ColEffi>')
86  print('<LambdaFirst unit="nm">' + str(lambdaFirst) + '</LambdaFirst>')
87  print('<LambdaStep unit="nm">' + str(lambdaStep) + '</LambdaStep>')
88  for i in range(n):
89  qe = pde_prof.GetBinContent(i+1) / ce
90  print('<Qeffi>' + str(round(qe, 3)) + '</Qeffi>')
91  print()
92 
93 
94 # Central database

The documentation for this class was generated from the following file:
ClusterEfficiency.ClusterEfficiency.initialize
def initialize(self)
Definition: ClusterEfficiency.py:36
Belle2::PyDBObj
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50
Belle2::PyDBArray
Class to access a DB Array from Python.
Definition: PyDBArray.h:43