ATLAS Offline Software
dqt_zlumi_pandas.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 
4 import numpy as np
5 import csv
6 from array import array
7 import ROOT
8 import sys, os
9 import logging
10 import argparse
11 import math
12 from DQUtils import fetch_iovs
13 from DQUtils.iov_arrangement import inverse_lblb
14 import ZLumiScripts.tools.zlumi_alleff as dq_eff
15 import ZLumiScripts.tools.zlumi_mc_cf as dq_cf
16 
17 
18 from DataQualityUtils import doZLumi
19 
20 # testing toy sampling
21 import ZLumiScripts.tools.toys as toys
22 
23 ROOT.gROOT.SetBatch(ROOT.kTRUE)
24 ROOT.gStyle.SetOptStat(0)
25 
26 logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
27 
28 parser = argparse.ArgumentParser()
29 parser.add_argument('--infile', type=str, help='input HIST file')
30 parser.add_argument('--grl', type=str, help='Specify an input GRL')
31 parser.add_argument('--tag', type=str, help='Lumi tag', default='OflLumiAcct-Run3-003')
32 parser.add_argument('--useofficial', action='store_true', help='Use official lumi folder (otherwise, use OflLumiAcct')
33 parser.add_argument('--lumifolder', type=str, help='Lumi folder', default='/TRIGGER/OFLLUMI/OflPrefLumi')
34 parser.add_argument('--lumitag', type=str, help='Lumi tag', default='OflLumi-Run3-003')
35 parser.add_argument('--outdir', type=str, help='Directory to dump plots', default='plots')
36 parser.add_argument('--update', type=str, help='On = Update current plots, Off = Only create plots from new runs', default = 'off')
37 parser.add_argument('--dblivetime', action='store_true', help='Look up livetime from DB')
38 parser.add_argument('--campaign', type=str, help='mc16a/d/e, mc21, mc23a')
39 
40 args = parser.parse_args()
41 campaign = args.campaign
42 update = args.update
43 
44 BINWIDTH = 10
45 ZPURITYFACTOR = 0.9935
46 if args.campaign in ["mc21", "mc23a"]:
47  ZXSEC = 2.0675
48 else:
49  ZXSEC = 1.929
50 
51 zee_missing_lbs = []
52 zmumu_missing_lbs = []
53 
54 ntoys = 10000000
55 do_toys = False
56 
57 fin = ROOT.TFile.Open(args.infile)
58 runname = None
59 for key in fin.GetListOfKeys():
60  if key.GetName().startswith('run_'):
61  runname = key.GetName()
62  runnumber = runname.replace('run_','')
63  break
64 
65 print("Starting HIST to CSV conversion for Run ", runnumber)
66 exit_string = "CSV file already exists for Run " + runnumber + ". Moving to next run..."
67 
68 if args.outdir:
69  out_dir = args.outdir
70  os.system("mkdir -p " + out_dir)
71  out_dir += "/" + runname + ".csv"
72  if os.path.exists(out_dir) and update == "off":
73  sys.exit(exit_string)
74 else:
75  out_dir = runname + ".csv"
76  if os.path.exists(out_dir) and update == "off":
77  sys.exit(exit_string)
78 
79 if args.campaign in ["mc21", "mc23a"]:
80  lb_length_name = '%s/GLOBAL/DQTGlobalWZFinder/duration_vs_LB' % runname
81  livetime_name = '%s/GLOBAL/DQTGlobalWZFinder/avgLiveFrac_vs_LB' % runname
82 else:
83  lb_length_name = '%s/GLOBAL/DQTGlobalWZFinder/m_lblength_lb' % runname
84  livetime_name = '%s/GLOBAL/DQTGlobalWZFinder/m_livetime_lb' % runname
85 
86 
87 if args.grl:
88  grlReader = ROOT.Root.TGoodRunsListReader(args.grl)
89  grlReader.Interpret()
90  grl = grlReader.GetMergedGRLCollection()
91 else:
92  #grlname = 'grl_'+runnumber+'.xml'
93  #grl_file = doZLumi.makeGRL(int(runnumber), 'PHYS_StandardGRL_All_Good', grlname)
94  grl = None
95 
96 if not runname:
97  logging.critical("Can't find run_* directory in input file %s", args.infile)
98  sys.exit(1)
99 
100 #lb_length_old = fin.Get('%s/GLOBAL/DQTGlobalWZFinder/duration_vs_LB' % runname)
101 lb_length_old = fin.Get(lb_length_name)
102 lbmin, lbmax = lb_length_old.FindFirstBinAbove(0, 1, 0, -1), lb_length_old.FindLastBinAbove(0, 1, 0, -1)
103 lb_length = ROOT.TProfile('lb_length', 'LB length', int(lbmax-lbmin), lbmin, lbmax)
104 
105 for i in range(lbmin, lbmax):
106  lb_length.Fill(i, lb_length_old.GetBinContent(i))
107 
108 logging.info('low, high LBs: %s, %s', lbmin, lbmax)
109 
110 if args.dblivetime:
111  logging.info('Starting livetime lookup ... (remove when we have a proper in-file implementation ...)')
112  livetime = ROOT.TProfile('livetime', 'Livetime', int(lbmax-lbmin), lbmin, lbmax)
113 else:
114  #livetime = fin.Get('%s/GLOBAL/DQTGlobalWZFinder/avgLiveFrac_vs_LB' % runname)
115  livetime = fin.Get(livetime_name)
116 
117 official_lum_zero = ROOT.TProfile('official_lum_zero', 'official inst luminosity', int(lbmax-lbmin), lbmin, lbmax)
118 official_mu = ROOT.TProfile('official_mu', 'official mu', int(lbmax-lbmin), lbmin, lbmax)
119 
120 lblb = fetch_iovs("LBLB", runs=int(runname[4:]))
121 lbtime = inverse_lblb(lblb)
122 iovs_acct = fetch_iovs('COOLOFL_TRIGGER::/TRIGGER/OFLLUMI/LumiAccounting', lbtime.first.since, lbtime.last.until, tag=args.tag)
123 
124 if args.useofficial:
125  print("Using official lumitag", args.lumitag)
126  iovs_lum = fetch_iovs('COOLOFL_TRIGGER::%s' % args.lumifolder, lblb.first.since, lblb.last.until, tag=args.lumitag, channels=[0])
127 
128 lb_start_end = {}
129 lb_lhcfill = {}
130 for iov in lblb:
131  lb_start_end[iov.since & 0xffffffff] = (iov.StartTime/1e9, iov.EndTime/1e9)
132 
133 for iov in iovs_acct:
134  if not lbmin-1 < iov.LumiBlock < lbmax:
135  continue
136  lb_lhcfill[iov.LumiBlock] = iov.FillNumber
137  if args.dblivetime:
138  livetime.Fill(iov.LumiBlock, iov.LiveFraction)
139 
140  if not args.useofficial:
141  official_lum_zero.Fill(iov.LumiBlock, iov.InstLumi/1e3)
142  official_mu.Fill(iov.LumiBlock, iov.AvEvtsPerBX)
143  else:
144  offlumiov = [_ for _ in iovs_lum if _.since.lumi==iov.LumiBlock]
145  if len(offlumiov) != 1:
146  print('MAJOR PROBLEM, LUMI IOV MISMATCH', iov.LumiBlock)
147  continue
148 
149  offlumiov = offlumiov[0]
150  official_lum_zero.Fill(iov.LumiBlock, offlumiov.LBAvInstLumi/1e3)
151  official_mu.Fill(iov.LumiBlock, offlumiov.LBAvEvtsPerBX)
152 
153 lb_full = lb_length.Clone('lb_full').ProjectionX()
154 divisor = lb_length.Clone('divisor').ProjectionX()
155 px = livetime.ProjectionX()
156 divisor.Multiply(px)
157 
158 # Get run-wise electron channel histos outside of loop
159 # Also do the container efficiency bkg fit here as it is done
160 # once per run, then normalised to the ratio of LB/run in the function
161 # container_efficiency
162 hto = fin.Get('%s/GLOBAL/DQTGlobalWZFinder/m_ele_template_os' % (runname))
163 hts = fin.Get('%s/GLOBAL/DQTGlobalWZFinder/m_ele_template_ss' % (runname))
164 hphotontotal = fin.Get("%s/GLOBAL/DQTGlobalWZFinder/m_elContainertp_nomatch" % (runname))
165 hphotontotal.GetXaxis().SetRangeUser(66000, 250000)
166 
167 # ==== Set signal region == 0, then fit ====
168 h_fit = hphotontotal.Clone()
169 for xbin in range(1, h_fit.GetNbinsX()+1):
170  mass = h_fit.GetBinLowEdge(xbin)
171  if mass > 75000 and mass < 100000:
172  h_fit.SetBinContent(xbin, 0)
173  h_fit.SetBinError(xbin, 0)
174 h_fit.Fit("pol2", "q")
175 
176 
177 o_recoeff_fit = {}
178 o_recoerr_fit = {}
179 # Do electron channel reco eff calculation once,
180 # then apply iterative correction to bkg subtraction in the main loop
181 lb_minus_one_reco_eff = [1.0, 1.0, 1.0]
182 for ibin in range(1, int(lbmax-lbmin)+1):
183  this_lb = int(lb_full.GetBinCenter(ibin))
184  lb = "lb_" + str(this_lb)
185  pileup = round(official_mu[ibin])
186 
187  hmo = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_good_os' % (runname, lb))
188  hms = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_good_ss' % (runname, lb))
189  hno = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_bad_os' % (runname, lb))
190  hns = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_bad_ss' % (runname, lb))
191 
192  try:
193  eff, err = dq_eff.template_method(hmo, hms, hno, hns, hto, hts, False, lb_minus_one_reco_eff) # do_scale set to false here as we are calculating it, when applying set True (next loop)
194  lb_minus_one_reco_eff = [eff, err, this_lb]
195  except AttributeError:
196  eff = 0
197  err = 0
198 
199  if err != 0 and eff != 0:
200  weight = 1/pow(err, 2)
201  if pileup not in o_recoeff_fit:
202  o_recoeff_fit[pileup] = weight * eff
203  o_recoerr_fit[pileup] = weight
204  else:
205  o_recoeff_fit[pileup] += weight * eff
206  o_recoerr_fit[pileup] += weight
207 
208 arr_rec_eff = array('d')
209 arr_rec_err = array('d')
210 arr_mu = array('d')
211 
212 for pileup in o_recoeff_fit:
213  arr_mu.append(float(pileup))
214  arr_rec_eff.append(o_recoeff_fit[pileup]/o_recoerr_fit[pileup])
215  arr_rec_err.append(1/pow(o_recoerr_fit[pileup], 0.5))
216 
217 # If no pileup data is available, add dummy entry with all parameters set to 1
218 
219 if len(arr_mu) == 0:
220  arr_mu.append(1)
221  arr_rec_eff.append(1)
222  arr_rec_err.append(1)
223 
224 tg_fit = ROOT.TGraphErrors(len(arr_mu), arr_mu, arr_rec_eff, ROOT.nullptr, arr_rec_err)
225 if len(o_recoeff_fit) == 0 or len(o_recoeff_fit) == 1:
226  fit_type = "pol0"
227 elif len(o_recoeff_fit) == 2:
228  fit_type = "pol1"
229 elif len(o_recoeff_fit) > 2:
230  fit_type = "pol2"
231 
232 print("Fit type", fit_type, "pileup bins", len(o_recoeff_fit))
233 tg_fit.Fit(fit_type, "q")
234 
235 csvfile = open(out_dir, 'w')
236 csvwriter = csv.writer(csvfile, delimiter=',')
237 csvwriter.writerow(['FillNum','RunNum','LBNum','LBStart','LBEnd','LBLive','LBFull','OffLumi','OffMu', 'PassGRL',
238  'ZeeRaw','ZeeRawErr','ZeeN1','ZeeN2','ZeeEffTrig','ZeeErrTrig','ZeeEffReco','ZeeErrReco','ZeeEffComb','ZeeErrComb','ZeeEffAComb','ZeeErrAComb','ZeeDefTrig','ZeeDefReco','ZeeLumi','ZeeLumiErr','ZeeRate',
239  'ZmumuRaw','ZmumuRawErr','ZmumuN1','ZmumuN2','ZmumuEffTrig','ZmumuErrTrig','ZmumuEffReco','ZmumuErrReco','ZmumuEffComb','ZmumuErrComb','ZmumuEffAComb','ZmumuErrAComb','ZmumuDefTrig','ZmumuDefReco','ZmumuLumi','ZmumuLumiErr','ZmumuRate',
240  'ZllLumi','ZllLumiErr'])
241 
242 lb_minus_one_reco_eff = {}
243 lb_minus_one_reco_eff["Zee"] = [1.0, 1.0, 1]
244 lb_minus_one_reco_eff["Zmumu"] = [1.0, 1.0, 1]
245 
246 lb_minus_one_trig_eff = {}
247 lb_minus_one_trig_eff["Zee"] = [1.0, 1.0, 1]
248 lb_minus_one_trig_eff["Zmumu"] = [1.0, 1.0, 1]
249 
250 for ibin in range(1, int(lbmax-lbmin)+1):
251  out_dict = {}
252  out_dict["Zee"] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
253  out_dict["Zmumu"] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
254 
255  this_lb = int(lb_full.GetBinCenter(ibin))
256  loclivetime = divisor[ibin]
257  try:
258  this_fill = lb_lhcfill[this_lb]
259  except KeyError:
260  print("Fill not set. NA.")
261  this_fill = "NA"
262 
263  passgrl = 1
264  for channel in ["Zee", "Zmumu"]:
265  if grl and not grl.HasRunLumiBlock(int(runname[4:]), this_lb):
266  passgrl = 0
267  continue
268 
269  lb = "lb_" + str(this_lb)
270  if channel == 'Zee':
271  # Nominal signal histogram
272  hname = runname + '/lb_'+str(int(ibin+lbmin-0.5))+'/GLOBAL/DQTGlobalWZFinder/m_Z_mass_opsele'
273 
274  # Tag-and-probe histos
275  h = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_eltrigtp_matches_os' % (runname, lb))
276  hmo = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_good_os' % (runname, lb))
277  hms = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_good_ss' % (runname, lb))
278  hno = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_bad_os' % (runname, lb))
279  hns = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_bad_ss' % (runname, lb))
280  #hphoton = fin.Get("%s/%s/GLOBAL/DQTGlobalWZFinder/m_elContainertp_nomatch" % (runname, lb))
281  #hpass = fin.Get("%s/%s/GLOBAL/DQTGlobalWZFinder/m_ele_tight_passkine" % (runname, lb))
282  #hphoton.GetXaxis().SetRangeUser(66000, 250000)
283  #hpass.GetXaxis().SetRangeUser(66000, 250000)
284  if args.campaign in ["mc21", "mc23a"]:
285  ACCEPTANCE = 0.2971
286  else:
287  ACCEPTANCE = 0.2996
288  elif channel == 'Zmumu':
289  # Nominal signal histogram
290  hname = runname + '/lb_'+str(int(ibin+lbmin-0.5))+'/GLOBAL/DQTGlobalWZFinder/m_Z_mass_opsmu'
291 
292  # Tag-and-probe histos
293  h = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_mutrigtp_matches' % (runname, lb))
294  hmo = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_muloosetp_match_os' % (runname, lb))
295  hms = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_muloosetp_match_ss' % (runname, lb))
296  hno = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_muloosetp_nomatch_os' % (runname, lb))
297  hns = fin.Get('%s/%s/GLOBAL/DQTGlobalWZFinder/m_muloosetp_nomatch_ss' % (runname, lb))
298  if args.campaign in ["mc21", "mc23a"]:
299  ACCEPTANCE = 0.3292
300  else:
301  ACCEPTANCE = 0.3323224
302 
303  try:
304  z_m = fin.Get(hname).Integral()
305  z_merr = math.sqrt(z_m)
306  except AttributeError:
307  if channel == "Zee":
308  zee_missing_lbs.append(int(ibin+lbmin-0.5))
309  elif channel == "Zmumu":
310  zmumu_missing_lbs.append(int(ibin+lbmin-0.5))
311 
312  continue
313 
314 
315  N1 = N2 = 0
316  try:
317  N1 = h.GetBinContent(2)
318  N2 = h.GetBinContent(3)
319  if do_toys:
320  eff_trig, err_trig, arr_trig, arr_NZ = toys.toy_trigeff(N1, N2, ntoys)
321  else:
322  eff_trig, err_trig = dq_eff.trig_tag_and_probe(h, lb_minus_one_trig_eff[channel])
323  except TypeError:
324  eff_trig, err_trig = 0.0, 0.0
325  except AttributeError:
326  eff_trig, err_trig = 0.0, 0.0
327  if channel == "Zmumu":
328  try:
329  bin1 = hmo.GetXaxis().FindBin(86000)
330  bin2 = hmo.GetXaxis().FindBin(95000)
331  if do_toys:
332  eff_reco, err_reco, arr_reco = toys.muon_toy_recoeff(hmo.Integral(bin1, bin2), hms.Integral(bin1, bin2), hno.Integral(bin1, bin2), hns.Integral(bin1, bin2), ntoys)
333  else:
334  eff_reco, err_reco = dq_eff.reco_tag_and_probe(hmo, hms, hno, hns, lb_minus_one_reco_eff[channel])
335  except TypeError:
336  eff_reco, err_reco = 0.0, 0.0
337  except AttributeError:
338  eff_reco, err_reco = 0.0, 0.0
339  elif channel == "Zee":
340  try:
341  if do_toys:
342  bin1 = hmo.GetXaxis().FindBin(75000)
343  bin2 = hmo.GetXaxis().FindBin(104000)
344  bin3 = hmo.GetXaxis().FindBin(120000)
345  bin4 = hmo.GetXaxis().FindBin(250000)
346  matchos_peak = hmo.Integral(bin1, bin2)
347  matchos_tail = hmo.Integral(bin3, bin4)
348  matchss_tail = hms.Integral(bin3, bin4)
349  nomatchos_peak = hno.Integral(bin1, bin2)
350  nomatchos_tail = hno.Integral(bin3, bin4)
351  templateos_peak = hto.Integral(bin1, bin2)
352  templateos_tail = hto.Integral(bin3, bin4)
353  templatess_tail = hts.Integral(bin3, bin4)
354  eff_reco, err_reco, arr_reco = toys.electron_toy_recoeff(matchos_peak, matchos_tail, matchss_tail, nomatchos_peak, nomatchos_tail, templateos_peak, templateos_tail, templatess_tail, ntoys)
355  else:
356  eff_reco, err_reco = dq_eff.template_method(hmo, hms, hno, hns, hto, hts, True, lb_minus_one_reco_eff[channel], tg_fit.GetFunction(fit_type).Eval(official_mu[ibin]))
357 
358  except TypeError:
359  eff_reco, err_reco = 0.0, 0.0
360  except AttributeError:
361  eff_reco, err_reco = 0.0, 0.0
362 
363  #dq_eff.container_efficiency(hphoton, hphotontotal, h_fit, hpass, hto, hts)
364 
365 
366  defaulted_reco_eff = 0
367  defaulted_trig_eff = 0
368  if eff_reco == lb_minus_one_reco_eff[channel][0]:
369  defaulted_reco_eff = 1
370  if eff_trig == lb_minus_one_trig_eff[channel][0]:
371  defaulted_trig_eff = 1
372 
373  if eff_reco != 0.0:
374  lb_minus_one_reco_eff[channel] = [eff_reco, err_reco, this_lb]
375  if eff_trig != 0.0:
376  lb_minus_one_trig_eff[channel] = [eff_trig, err_trig, this_lb]
377 
378  if do_toys:
379  arr_comb = (1.0 - (1.0 - arr_trig)**2) * (arr_reco)**2
380  nonan_arr_comb = arr_comb[~np.isnan(arr_comb)]
381  eff_comb = np.median(nonan_arr_comb)
382  err_comb = nonan_arr_comb.std()
383  else:
384  eff_comb = (1-(1-eff_trig)**2)*(eff_reco)**2
385  err_comb = ((eff_reco**2*2*(1-eff_trig)*err_trig)**2+(2*eff_reco*(1-(1-eff_trig)**2)*err_reco)**2)**.5
386 
387  eff_Acomb = ACCEPTANCE * eff_comb
388  err_Acomb = ACCEPTANCE * err_comb
389 
390  lblive = divisor[ibin]
391 
392  if lblive < 9:
393  continue
394 
395  loclivetime = lblive
396  run = int(runname.replace("run_", ""))
397  if do_toys:
398  effcy = arr_comb * dq_cf.correction(official_mu[ibin], channel, campaign, run)
399  else:
400  effcy = eff_comb * dq_cf.correction(official_mu[ibin], channel, campaign, run)
401  effcyerr = err_comb * dq_cf.correction(official_mu[ibin], channel, campaign, run)
402 
403  if run == 302831 and this_lb < 11:
404  loclivetime = 0
405  elif run == 329835 and this_lb < 554:
406  loclivetime = 0
407  elif run == 310247 and (this_lb == 442 or this_lb == 462):
408  loclivetime = 0
409  elif run == 281385 and this_lb < 197:
410  loclivetime = lblive * 4.0/6.0 # ad-hoc scale factor
411  elif run == 281385 and this_lb < 375:
412  loclivetime = lblive * 5.0/6.0 # ad-hoc scale factor
413  elif run == 286367:
414  loclivetime = lblive * 5.0/6.0 # ad-hoc scale factor
415  else:
416  loclivetime = lblive
417 
418  zlumi = zlumistat = zrate = 0.0
419  CORRECTIONS = ZPURITYFACTOR/ACCEPTANCE/ZXSEC
420 
421  if do_toys and loclivetime != 0.0:
422  arr_zlumi = np.divide(arr_NZ, effcy) * (CORRECTIONS)/loclivetime
423  arr_zlumi = arr_zlumi[~np.isnan(arr_zlumi)]
424  zlumi = np.median(arr_zlumi)
425  zlumistat = arr_zlumi.std()
426  zrate = zlumi / CORRECTIONS
427  elif (loclivetime != 0.0 and effcy != 0.0):
428  zlumi = (z_m/effcy)*(CORRECTIONS)/loclivetime
429  zlumistat = math.sqrt(pow(z_merr/effcy, 2) + pow(z_m/effcy**2*effcyerr, 2))*CORRECTIONS/loclivetime
430  zrate = zlumi / CORRECTIONS
431 
432 
433  out_dict[channel] = [z_m, z_merr, N1, N2, eff_trig, err_trig, eff_reco, err_reco, eff_comb, err_comb, eff_Acomb, err_Acomb, defaulted_trig_eff, defaulted_reco_eff, zlumi, zlumistat, zrate]
434 
435  run = int(runname.replace("run_", ""))
436 
437  lumi_index = len(out_dict['Zee'])-3
438  error_index = len(out_dict['Zee'])-2
439  zll_lumi = (out_dict['Zee'][lumi_index] + out_dict['Zmumu'][lumi_index])/2
440  zll_lumi_err = 0.5 * math.sqrt( pow(out_dict['Zee'][error_index], 2) + pow(out_dict['Zmumu'][error_index], 2) )
441  out_write = [this_fill, run, this_lb, lb_start_end[this_lb][0], lb_start_end[this_lb][1], loclivetime, lb_full[ibin], official_lum_zero[ibin], official_mu[ibin], passgrl] + out_dict["Zee"] + out_dict["Zmumu"] + [zll_lumi, zll_lumi_err]
442  csvwriter.writerow(out_write)
443 
444 print("Missing LBs in Zee channel: ", zee_missing_lbs)
445 print("Missing LBs in Zmumu channel: ", zmumu_missing_lbs)
446 
447 csvfile.close()
python.iov_arrangement.inverse_lblb
def inverse_lblb(iovs)
Definition: iov_arrangement.py:34
python.db.fetch_iovs
def fetch_iovs(folder_name, since=None, until=None, channels=None, tag="", what="all", max_records=-1, with_channel=True, loud=False, database=None, convert_time=False, named_channels=False, selection=None, runs=None, with_time=False, unicode_strings=False)
Definition: DQUtils/python/db.py:67
RootHelpers::FindBin
Int_t FindBin(const TAxis *axis, const double x)
Definition: RootHelpers.cxx:14
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
array
Trk::open
@ open
Definition: BinningType.h:40
readCCLHist.int
int
Definition: readCCLHist.py:84
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
str
Definition: BTagTrackIpAccessor.cxx:11
readCCLHist.float
float
Definition: readCCLHist.py:83