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

References createfilelist.int.

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

Variable Documentation

estimatePileup.action

Definition at line 109 of file estimatePileup.py.

estimatePileup.args

Definition at line 150 of file estimatePileup.py.

estimatePileup.basename
estimatePileup.beammode

Definition at line 170 of file estimatePileup.py.

estimatePileup.beamModeChoices

Definition at line 103 of file estimatePileup.py.

estimatePileup.choices

Definition at line 122 of file estimatePileup.py.

estimatePileup.csvDict

Definition at line 195 of file estimatePileup.py.

estimatePileup.dbGroup

Definition at line 106 of file estimatePileup.py.

estimatePileup.deadTable

Definition at line 259 of file estimatePileup.py.

estimatePileup.debug

Definition at line 218 of file estimatePileup.py.

estimatePileup.default

Definition at line 122 of file estimatePileup.py.

estimatePileup.delivered

Definition at line 205 of file estimatePileup.py.

estimatePileup.description

Definition at line 105 of file estimatePileup.py.

estimatePileup.dest

Definition at line 109 of file estimatePileup.py.

estimatePileup.events

Definition at line 194 of file estimatePileup.py.

estimatePileup.extension

Definition at line 243 of file estimatePileup.py.

estimatePileup.f

Definition at line 248 of file estimatePileup.py.

estimatePileup.fileparsingResult

Definition at line 246 of file estimatePileup.py.

estimatePileup.help

Definition at line 110 of file estimatePileup.py.

estimatePileup.hist

Definition at line 216 of file estimatePileup.py.

estimatePileup.histFile

Definition at line 228 of file estimatePileup.py.

estimatePileup.histList

Definition at line 187 of file estimatePileup.py.

estimatePileup.inputfilecontent

Definition at line 249 of file estimatePileup.py.

estimatePileup.inputGroup

Definition at line 107 of file estimatePileup.py.

estimatePileup.inputRange
estimatePileup.lumi

Definition at line 204 of file estimatePileup.py.

estimatePileup.lumiversion
estimatePileup.lumiXing

Definition at line 167 of file estimatePileup.py.

estimatePileup.maxPileupBin

Definition at line 174 of file estimatePileup.py.

estimatePileup.minBiasXsec

Definition at line 172 of file estimatePileup.py.

estimatePileup.mode

Definition at line 219 of file estimatePileup.py.

estimatePileup.noWarnings

Definition at line 166 of file estimatePileup.py.

estimatePileup.options

Definition at line 150 of file estimatePileup.py.

estimatePileup.output

Definition at line 158 of file estimatePileup.py.

estimatePileup.parameters

## Main Program

Definition at line 102 of file estimatePileup.py.

estimatePileup.parser

Definition at line 104 of file estimatePileup.py.

estimatePileup.pieces

Definition at line 197 of file estimatePileup.py.

estimatePileup.pileupGroup

Definition at line 108 of file estimatePileup.py.

estimatePileup.pileupHist

Let's start the fun.

Definition at line 184 of file estimatePileup.py.

estimatePileup.pileupHistName

Definition at line 173 of file estimatePileup.py.

estimatePileup.recorded

Definition at line 205 of file estimatePileup.py.

estimatePileup.recordedData

Definition at line 255 of file estimatePileup.py.

estimatePileup.run

Definition at line 204 of file estimatePileup.py.

estimatePileup.runLumiDict

Definition at line 193 of file estimatePileup.py.

estimatePileup.runNumber

pprint (recordedData)

Definition at line 217 of file estimatePileup.py.

estimatePileup.sepRE

Definition at line 192 of file estimatePileup.py.

estimatePileup.session

Definition at line 176 of file estimatePileup.py.

estimatePileup.svc

Definition at line 176 of file estimatePileup.py.

estimatePileup.type

Definition at line 124 of file estimatePileup.py.

estimatePileup.verbose

Save what we need in the parameters object.

Definition at line 165 of file estimatePileup.py.

estimatePileup.xingInstLumiArray

Definition at line 206 of file estimatePileup.py.

estimatePileup.xingMinLum

Definition at line 171 of file estimatePileup.py.