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 16 of file estimatePileup.py.

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

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

Variable Documentation

estimatePileup.action

Definition at line 110 of file estimatePileup.py.

estimatePileup.args

Definition at line 151 of file estimatePileup.py.

estimatePileup.basename
estimatePileup.beammode

Definition at line 171 of file estimatePileup.py.

estimatePileup.beamModeChoices

Definition at line 104 of file estimatePileup.py.

estimatePileup.choices

Definition at line 123 of file estimatePileup.py.

estimatePileup.csvDict

Definition at line 196 of file estimatePileup.py.

estimatePileup.dbGroup

Definition at line 107 of file estimatePileup.py.

estimatePileup.deadTable

Definition at line 260 of file estimatePileup.py.

estimatePileup.debug

Definition at line 219 of file estimatePileup.py.

estimatePileup.default

Definition at line 123 of file estimatePileup.py.

estimatePileup.delivered

Definition at line 206 of file estimatePileup.py.

estimatePileup.description

Definition at line 106 of file estimatePileup.py.

estimatePileup.dest

Definition at line 110 of file estimatePileup.py.

estimatePileup.events

Definition at line 195 of file estimatePileup.py.

estimatePileup.extension

Definition at line 244 of file estimatePileup.py.

estimatePileup.f

Definition at line 249 of file estimatePileup.py.

estimatePileup.fileparsingResult

Definition at line 247 of file estimatePileup.py.

estimatePileup.help

Definition at line 111 of file estimatePileup.py.

estimatePileup.hist

Definition at line 217 of file estimatePileup.py.

estimatePileup.histFile

Definition at line 229 of file estimatePileup.py.

estimatePileup.histList

Definition at line 188 of file estimatePileup.py.

estimatePileup.inputfilecontent

Definition at line 250 of file estimatePileup.py.

estimatePileup.inputGroup

Definition at line 108 of file estimatePileup.py.

estimatePileup.inputRange
estimatePileup.lumi

Definition at line 205 of file estimatePileup.py.

estimatePileup.lumiversion
estimatePileup.lumiXing

Definition at line 168 of file estimatePileup.py.

estimatePileup.maxPileupBin

Definition at line 175 of file estimatePileup.py.

estimatePileup.minBiasXsec

Definition at line 173 of file estimatePileup.py.

estimatePileup.mode

Definition at line 220 of file estimatePileup.py.

estimatePileup.noWarnings

Definition at line 167 of file estimatePileup.py.

estimatePileup.options

Definition at line 151 of file estimatePileup.py.

estimatePileup.output

Definition at line 159 of file estimatePileup.py.

estimatePileup.parameters

## Main Program

Definition at line 103 of file estimatePileup.py.

estimatePileup.parser

Definition at line 105 of file estimatePileup.py.

estimatePileup.pieces

Definition at line 198 of file estimatePileup.py.

estimatePileup.pileupGroup

Definition at line 109 of file estimatePileup.py.

estimatePileup.pileupHist

Let's start the fun.

Definition at line 185 of file estimatePileup.py.

estimatePileup.pileupHistName

Definition at line 174 of file estimatePileup.py.

estimatePileup.recorded

Definition at line 206 of file estimatePileup.py.

estimatePileup.recordedData

Definition at line 256 of file estimatePileup.py.

estimatePileup.run

Definition at line 205 of file estimatePileup.py.

estimatePileup.runLumiDict

Definition at line 194 of file estimatePileup.py.

estimatePileup.runNumber

pprint (recordedData)

Definition at line 218 of file estimatePileup.py.

estimatePileup.sepRE

Definition at line 193 of file estimatePileup.py.

estimatePileup.session

Definition at line 177 of file estimatePileup.py.

estimatePileup.svc

Definition at line 177 of file estimatePileup.py.

estimatePileup.type

Definition at line 125 of file estimatePileup.py.

estimatePileup.verbose

Save what we need in the parameters object.

Definition at line 166 of file estimatePileup.py.

estimatePileup.xingInstLumiArray

Definition at line 207 of file estimatePileup.py.

estimatePileup.xingMinLum

Definition at line 172 of file estimatePileup.py.