Belle II Software  release-08-01-10
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 25 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 28 of file averageQE.py.

28  def initialize(self):
29  ''' run the procedure, store the results in a root file and print in xml format '''
30 
31  dbarray = Belle2.PyDBArray('TOPPmtQEs')
32  if dbarray.getEntries() == 0:
33  b2.B2ERROR("No entries in TOPPmtQEs")
34  return
35 
36  geo = Belle2.PyDBObj('TOPGeometry')
37  if not geo:
38  b2.B2ERROR("No TOPGeometry")
39  return
40 
41  Bfield_on = True # use collection efficiencies for 1.5 T
42 
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)
48  if Bfield_on:
49  Bfield = '(1.5 T)'
50  else:
51  Bfield = '(0 T)'
52 
53  pde_2d = TH2F("pde_2d", "quantum times collection efficiencies " + Bfield,
54  n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
55  300, 0.0, 1.0)
56  pde_prof = TProfile("pde_prof", "quantum times collection efficiencies " + Bfield,
57  n, lambdaFirst - lambdaStep / 2, lambdaLast + lambdaStep / 2,
58  0.0, 1.0)
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)
62 
63  ce = 0
64  for pmtQE in dbarray:
65  ce_1d.Fill(pmtQE.getCE(Bfield_on))
66  ce += pmtQE.getCE(Bfield_on)
67  for pmtPixel in range(1, 17):
68  for i in range(n):
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)
73 
74  nominalQE = geo.getNominalQE()
75  for i in range(n):
76  lam = lambdaFirst + lambdaStep * i
77  effi = nominalQE.getEfficiency(lam)
78  pde_nom.SetBinContent(i+1, effi)
79 
80  ce /= dbarray.getEntries()
81  print('average CE =', ce)
82  file = TFile('averageQE.root', 'recreate')
83  pde_2d.Write()
84  pde_prof.Write()
85  pde_nom.Write()
86  ce_1d.Write()
87  file.Close()
88 
89  print()
90  if Bfield_on:
91  print('<ColEffi descr="average over all PMTs for 1.5 T">' + str(round(ce, 4)) + '</ColEffi>')
92  else:
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>')
96  for i in range(n):
97  qe = pde_prof.GetBinContent(i+1) / ce
98  print('<Qeffi>' + str(round(qe, 3)) + '</Qeffi>')
99  print()
100 
101 
102 # Central database
Class to access a DB Array from Python.
Definition: PyDBArray.h:43
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50

The documentation for this class was generated from the following file: