CMS 3D CMS Logo

Functions | Variables
estimatePileup Namespace Reference

Functions

def fillPileupHistogram (deadTable, parameters, runNumber=0, hist=None, debug=False, mode='deadtable')
 

Variables

 action
 
 args
 
 basename
 
 beammode
 
 beamModeChoices
 
 choices
 
 csvDict
 
 dbGroup
 
 deadTable
 
 debug
 
 default
 
 delivered
 
 description
 
 dest
 
 events
 
 extension
 
 f
 
 fileparsingResult
 
 help
 
 hist
 
 histFile
 
 histList
 
 inputfilecontent
 
 inputGroup
 
 inputRange
 Get input source. More...
 
 lumi
 
 lumiversion
 
 lumiXing
 
 maxPileupBin
 
 minBiasXsec
 
 mode
 
 noWarnings
 
 options
 
 output
 
 parameters
 

## Main Program

More...
 
 parser
 
 pieces
 
 pileupGroup
 
 pileupHist
 Let's start the fun. More...
 
 pileupHistName
 
 recorded
 
 recordedData
 
 run
 
 runLumiDict
 
 runNumber
 pprint (recordedData) More...
 
 sepRE
 
 session
 
 svc
 
 type
 
 verbose
 Save what we need in the parameters object. More...
 
 xingInstLumiArray
 
 xingMinLum
 

Function Documentation

def estimatePileup.fillPileupHistogram (   deadTable,
  parameters,
  runNumber = 0,
  hist = None,
  debug = False,
  mode = 'deadtable' 
)
Given a deadtable and run number, will (create if necessary
and) fill histogram with expected pileup distribution.  If a
histogram is created, it is owned by the user and is his/her
responsibility to clean up the memory.

Definition at line 17 of file estimatePileup.py.

References createfilelist.int, and edm.print().

17  mode='deadtable'):
18  '''Given a deadtable and run number, will (create if necessary
19  and) fill histogram with expected pileup distribution. If a
20  histogram is created, it is owned by the user and is his/her
21  responsibility to clean up the memory.'''
22  if hist:
23  maxBin = hist.GetNbinsX()
24  upper = int( hist.GetBinLowEdge(maxBin) + \
25  hist.GetBinWidth(maxBin) + 0.25 )
26  else:
27  histname = '%s_%s' % (parameters.pileupHistName, runNumber)
28  hist = ROOT.TH1D (histname, histname, parameters.maxPileupBin + 1,
29  -0.5, parameters.maxPileupBin + 0.5)
30  upper = parameters.maxPileupBin
31  for lumiSection, deadArray in sorted (six.iteritems(deadTable)):
32  if mode == 'csv':
33  numerator = float (deadArray[1])
34  denominator = float (deadArray[0])
35  instLumiArray = deadArray[2]
36  livetime = 1
37  if numerator < 0:
38  numerator = 0
39  if denominator:
40  livetime = numerator / denominator
41  else:
42  # we got everything from lumiDB
43  if len(deadArray) <= parameters.xingIndex:
44  # for some reason the xing instantaneous luminosity
45  # information isn't there. Print a warning and then skip
46  # it:
47  if parameters.noWarnings:
48  continue
49  if runNumber:
50  print("No Xing Instantaneous luminosity information for run %d, lumi section %d" \
51  % (runNumber, lumiSection))
52  else:
53  print("No Xing Instantaneous luminosity information for lumi section %d" \
54  % lumiSection)
55  continue
56  numerator = float (deadArray[0])
57  denominator = float (deadArray[2] * deadArray[4])
58  xingInstLumiArray = deadArray[parameters.xingIndex]
59  # here we only want the instantaneous luminosities and don't
60  # care which crosings they fall in. So we only want the odd
61  instLumiArray = [(xingInstLumiArray[index], xingInstLumiArray[index + 1]) \
62  for index in range( 0, len (xingInstLumiArray), 2 ) ]
63  livetime = 1
64  if numerator < 0:
65  numerator = 0
66  if denominator:
67  livetime = 1 - numerator / denominator
68  # totalInstLumi = reduce(lambda x, y: x+y, instLumiArray) # not needed
69  for xing, xingInstLumi in instLumiArray:
70  xingIntLumi = xingInstLumi * parameters.lumiSectionLen * livetime
71  mean = xingInstLumi * parameters.minBiasXsec * \
72  parameters.rotationTime
73  if mean > 100:
74  if runNumber:
75  print("mean number of pileup events > 100 for run %d, lum %d : m %f l %f" % \
76  (runNumber, lumiSection, mean, xingInstLumi))
77  else:
78  print("mean number of pileup events > 100 for lum %d: m %f l %f" % \
79  (lumiSection, mean, xingInstLumi))
80 
81  for obs in range (upper):
82  prob = ROOT.TMath.Poisson (obs, mean)
83  totalProb += prob
84  hist.Fill (obs, prob * xingIntLumi)
85  if debug:
86  print("ls", lumiSection, "xing", xing, "inst", xingInstLumi, \
87  "mean", mean, "totalProb", totalProb, 1 - totalProb)
88  print(" hist mean", hist.GetMean())
89  if totalProb < 1:
90  hist.Fill (obs, (1 - totalProb) * xingIntLumi)
91  return hist
92 
93 
94 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66

Variable Documentation

estimatePileup.action

Definition at line 111 of file estimatePileup.py.

estimatePileup.args

Definition at line 152 of file estimatePileup.py.

estimatePileup.basename
estimatePileup.beammode

Definition at line 172 of file estimatePileup.py.

estimatePileup.beamModeChoices

Definition at line 105 of file estimatePileup.py.

estimatePileup.choices

Definition at line 124 of file estimatePileup.py.

estimatePileup.csvDict

Definition at line 197 of file estimatePileup.py.

estimatePileup.dbGroup

Definition at line 108 of file estimatePileup.py.

estimatePileup.deadTable

Definition at line 261 of file estimatePileup.py.

estimatePileup.debug

Definition at line 220 of file estimatePileup.py.

estimatePileup.default

Definition at line 124 of file estimatePileup.py.

estimatePileup.delivered

Definition at line 207 of file estimatePileup.py.

estimatePileup.description

Definition at line 107 of file estimatePileup.py.

estimatePileup.dest

Definition at line 111 of file estimatePileup.py.

estimatePileup.events

Definition at line 196 of file estimatePileup.py.

estimatePileup.extension

Definition at line 245 of file estimatePileup.py.

estimatePileup.f

Definition at line 250 of file estimatePileup.py.

estimatePileup.fileparsingResult

Definition at line 248 of file estimatePileup.py.

estimatePileup.help

Definition at line 112 of file estimatePileup.py.

estimatePileup.hist

Definition at line 218 of file estimatePileup.py.

estimatePileup.histFile

Definition at line 230 of file estimatePileup.py.

estimatePileup.histList

Definition at line 189 of file estimatePileup.py.

estimatePileup.inputfilecontent

Definition at line 251 of file estimatePileup.py.

estimatePileup.inputGroup

Definition at line 109 of file estimatePileup.py.

estimatePileup.inputRange
estimatePileup.lumi

Definition at line 206 of file estimatePileup.py.

estimatePileup.lumiversion
estimatePileup.lumiXing

Definition at line 169 of file estimatePileup.py.

estimatePileup.maxPileupBin

Definition at line 176 of file estimatePileup.py.

estimatePileup.minBiasXsec

Definition at line 174 of file estimatePileup.py.

estimatePileup.mode

Definition at line 221 of file estimatePileup.py.

estimatePileup.noWarnings

Definition at line 168 of file estimatePileup.py.

estimatePileup.options

Definition at line 152 of file estimatePileup.py.

estimatePileup.output

Definition at line 160 of file estimatePileup.py.

estimatePileup.parameters

## Main Program

Definition at line 104 of file estimatePileup.py.

estimatePileup.parser

Definition at line 106 of file estimatePileup.py.

estimatePileup.pieces

Definition at line 199 of file estimatePileup.py.

estimatePileup.pileupGroup

Definition at line 110 of file estimatePileup.py.

estimatePileup.pileupHist

Let's start the fun.

Definition at line 186 of file estimatePileup.py.

estimatePileup.pileupHistName

Definition at line 175 of file estimatePileup.py.

estimatePileup.recorded

Definition at line 207 of file estimatePileup.py.

estimatePileup.recordedData

Definition at line 257 of file estimatePileup.py.

estimatePileup.run

Definition at line 206 of file estimatePileup.py.

estimatePileup.runLumiDict

Definition at line 195 of file estimatePileup.py.

estimatePileup.runNumber

pprint (recordedData)

Definition at line 219 of file estimatePileup.py.

estimatePileup.sepRE

Definition at line 194 of file estimatePileup.py.

estimatePileup.session

Definition at line 178 of file estimatePileup.py.

estimatePileup.svc

Definition at line 178 of file estimatePileup.py.

estimatePileup.type

Definition at line 126 of file estimatePileup.py.

estimatePileup.verbose

Save what we need in the parameters object.

Definition at line 167 of file estimatePileup.py.

estimatePileup.xingInstLumiArray

Definition at line 208 of file estimatePileup.py.

estimatePileup.xingMinLum

Definition at line 173 of file estimatePileup.py.