ATLAS Offline Software
Functions | Variables
ilumi2histo Namespace Reference

Functions

def ilumi2histo (ifile, ofile, relunc=3.2)
 Read in a ilumicalc file and output a file with a histogram that contains the luminosity per run. More...
 

Variables

 parser = argparse.ArgumentParser()
 read options
More...
 
 help
 
 dest
 
 default
 
 config = parser.parse_args()
 

Function Documentation

◆ ilumi2histo()

def ilumi2histo.ilumi2histo (   ifile,
  ofile,
  relunc = 3.2 
)

Read in a ilumicalc file and output a file with a histogram that contains the luminosity per run.

Definition at line 6 of file ilumi2histo.py.

6 def ilumi2histo(ifile, ofile, relunc=3.2):
7  """!
8  Read in a ilumicalc file and output a file with a histogram that contains the
9  luminosity per run.
10  """
11  lumi_map = {}
12 
13  try:
14  m_file = TFile.Open(ifile,'read')
15 
16  for k in m_file.GetListOfKeys():
17  if '_intlumi' in k.GetName():
18 
19  run = m_file.Get(k.GetName()).GetTitle().split()[-1]
20 
21  #OLD WAY (look at histogram title)
22  #if not 'Delivered' in m_file.Get(k.GetName()).GetTitle():
23  # print 'WARNING : No lumi provided for run ',run
24  # continue
25  #lumi = m_file.Get(k.GetName()).GetTitle().split('=')[1]
26  #lumi = float(lumi.split('/')[0])
27 
28 
29  #NEW WAY (look at last filled bin)
30  h = m_file.Get(k.GetName())
31  lumi = h.GetBinContent( h.GetNbinsX()-9 )
32 
33  lumi_map[run] = float(lumi)*1e-6
34 
35  except IOError as e:
36  print('IlumiCalc file not found!')
37  print(os.strerror(e.errno))
38 
39 
40  lumi_histo = TH1F('lumi_histo',';;Int. Luminosity [pb]',len(lumi_map.keys()),0.,float(len(lumi_map.keys())))
41  lumi_histo.Sumw2()
42 
43  ib=1
44  lsrt = lumi_map.keys()
45  lsrt.sort()
46  for k in lsrt:
47  lumi_histo.SetBinContent(ib, float(lumi_map[k]))
48  if relunc > 0:
49  lumi_histo.SetBinError(ib, float(lumi_map[k])*float(relunc)/100.)
50  lumi_histo.GetXaxis().SetBinLabel(ib, k)
51  ib+=1
52 
53  lumi_histo.SaveAs(ofile)
54 
55 

Variable Documentation

◆ config

ilumi2histo.config = parser.parse_args()

Definition at line 64 of file ilumi2histo.py.

◆ default

ilumi2histo.default

Definition at line 60 of file ilumi2histo.py.

◆ dest

ilumi2histo.dest

Definition at line 60 of file ilumi2histo.py.

◆ help

ilumi2histo.help

Definition at line 60 of file ilumi2histo.py.

◆ parser

ilumi2histo.parser = argparse.ArgumentParser()

read options

Definition at line 59 of file ilumi2histo.py.

ilumi2histo.ilumi2histo
def ilumi2histo(ifile, ofile, relunc=3.2)
Read in a ilumicalc file and output a file with a histogram that contains the luminosity per run.
Definition: ilumi2histo.py:6
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
readCCLHist.float
float
Definition: readCCLHist.py:83
Trk::split
@ split
Definition: LayerMaterialProperties.h:38