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

References createfilelist.int.

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

Variable Documentation

estimatePileup.action

Definition at line 108 of file estimatePileup.py.

estimatePileup.args

Definition at line 149 of file estimatePileup.py.

estimatePileup.basename
estimatePileup.beammode

Definition at line 169 of file estimatePileup.py.

estimatePileup.beamModeChoices

Definition at line 102 of file estimatePileup.py.

estimatePileup.choices

Definition at line 121 of file estimatePileup.py.

estimatePileup.csvDict

Definition at line 194 of file estimatePileup.py.

estimatePileup.dbGroup

Definition at line 105 of file estimatePileup.py.

estimatePileup.deadTable

Definition at line 258 of file estimatePileup.py.

estimatePileup.debug

Definition at line 217 of file estimatePileup.py.

estimatePileup.default

Definition at line 121 of file estimatePileup.py.

estimatePileup.delivered

Definition at line 204 of file estimatePileup.py.

estimatePileup.description

Definition at line 104 of file estimatePileup.py.

estimatePileup.dest

Definition at line 108 of file estimatePileup.py.

estimatePileup.events

Definition at line 193 of file estimatePileup.py.

estimatePileup.extension
estimatePileup.f

Definition at line 247 of file estimatePileup.py.

estimatePileup.fileparsingResult

Definition at line 245 of file estimatePileup.py.

estimatePileup.help

Definition at line 109 of file estimatePileup.py.

estimatePileup.hist

Definition at line 215 of file estimatePileup.py.

estimatePileup.histFile

Definition at line 227 of file estimatePileup.py.

estimatePileup.histList

Definition at line 186 of file estimatePileup.py.

estimatePileup.inputfilecontent

Definition at line 248 of file estimatePileup.py.

estimatePileup.inputGroup

Definition at line 106 of file estimatePileup.py.

estimatePileup.inputRange
estimatePileup.lumi

Definition at line 203 of file estimatePileup.py.

estimatePileup.lumiversion
estimatePileup.lumiXing

Definition at line 166 of file estimatePileup.py.

estimatePileup.maxPileupBin

Definition at line 173 of file estimatePileup.py.

estimatePileup.minBiasXsec

Definition at line 171 of file estimatePileup.py.

estimatePileup.mode

Definition at line 218 of file estimatePileup.py.

estimatePileup.noWarnings

Definition at line 165 of file estimatePileup.py.

estimatePileup.options

Definition at line 149 of file estimatePileup.py.

estimatePileup.output

Definition at line 157 of file estimatePileup.py.

estimatePileup.parameters

## Main Program

Definition at line 101 of file estimatePileup.py.

estimatePileup.parser

Definition at line 103 of file estimatePileup.py.

estimatePileup.pieces

Definition at line 196 of file estimatePileup.py.

estimatePileup.pileupGroup

Definition at line 107 of file estimatePileup.py.

estimatePileup.pileupHist

Let's start the fun.

Definition at line 183 of file estimatePileup.py.

estimatePileup.pileupHistName

Definition at line 172 of file estimatePileup.py.

estimatePileup.recorded

Definition at line 204 of file estimatePileup.py.

estimatePileup.recordedData

Definition at line 254 of file estimatePileup.py.

estimatePileup.run

Definition at line 203 of file estimatePileup.py.

estimatePileup.runLumiDict

Definition at line 192 of file estimatePileup.py.

estimatePileup.runNumber

pprint (recordedData)

Definition at line 216 of file estimatePileup.py.

estimatePileup.sepRE

Definition at line 191 of file estimatePileup.py.

estimatePileup.session

Definition at line 175 of file estimatePileup.py.

estimatePileup.svc

Definition at line 175 of file estimatePileup.py.

estimatePileup.type

Definition at line 123 of file estimatePileup.py.

estimatePileup.verbose

Save what we need in the parameters object.

Definition at line 164 of file estimatePileup.py.

estimatePileup.xingInstLumiArray

Definition at line 205 of file estimatePileup.py.

estimatePileup.xingMinLum

Definition at line 170 of file estimatePileup.py.