CMS 3D CMS Logo

Functions | Variables
estimatePileup_makeJSON Namespace Reference

Functions

def CalcPileup (deadTable, parameters, mode='deadtable')
 

Variables

 args
 
 aveLumi
 
 csvDict
 
 default
 
 delivered
 
 description
 
 dest
 
 events
 
 GapDict
 
 help
 
 InGap
 
 inputGroup
 
 LastDelivered
 
 lastindex
 
 lastLumiS
 
 LastValidLumi
 
 lumi
 
 LumiArray
 
 LumiString
 
 mode
 
 OldRun
 
 options
 
 output
 
 outputfile
 
 OUTPUTLINE
 Let's start the fun. More...
 
 parameters
 

## Main Program

More...
 
 parser
 
 peakratio
 
 pieces
 
 pileup
 
 pileupGroup
 
 record
 
 recorded
 
 run
 
 runLumiDict
 
 sepRE
 
 trunc
 
 type
 
 xingInstLumiArray
 

Function Documentation

def estimatePileup_makeJSON.CalcPileup (   deadTable,
  parameters,
  mode = 'deadtable' 
)
Given a deadtable, will calculate parameters of pileup distribution. Return formatted
string with LumiSection, LS integrated lumi, RMS of bunch to bunch lumi and pileup.

Definition at line 13 of file estimatePileup_makeJSON.py.

References mathSSE.sqrt().

13 def CalcPileup (deadTable, parameters, mode='deadtable'):
14  '''Given a deadtable, will calculate parameters of pileup distribution. Return formatted
15  string with LumiSection, LS integrated lumi, RMS of bunch to bunch lumi and pileup.'''
16 
17  LumiString = ""
18  LumiArray = []
19 
20  for lumiSection, deadArray in sorted (deadTable.iteritems()):
21  numerator = 0
22  if mode == 'csv':
23  numerator = float (deadArray[1])
24  denominator = float (deadArray[0])
25  instLumiArray = deadArray[2]
26  livetime = 1
27  if numerator < 0:
28  numerator = 0
29  if denominator:
30  livetime = numerator / denominator
31 
32  else:
33  print "no csv input! Doh!"
34  return
35  # totalInstLumi = reduce(lambda x, y: x+y, instLumiArray) # not needed
36  if lumiSection > 0:
37  TotalLumi = 0
38  TotalInt = 0
39  TotalInt2 = 0
40  TotalWeight = 0
41  TotalWeight2 = 0
42  FilledXings = 0
43  for xing, xingInstLumi in instLumiArray:
44  xingIntLumi = xingInstLumi * parameters.lumiSectionLen * livetime
45  mean = xingInstLumi * parameters.rotationTime
46  if mean > 100:
47  if runNumber:
48  print "mean number of pileup events > 100 for run %d, lum %d : m %f l %f" % \
49  (runNumber, lumiSection, mean, xingInstLumi)
50  else:
51  print "mean number of pileup events > 100 for lum %d: m %f l %f" % \
52  (lumiSection, mean, xingInstLumi)
53 # print "mean number of pileup events for lum %d: m %f idx %d l %f" % (lumiSection, mean, xing, xingIntLumi)
54 
55  if xingInstLumi > 0.1:
56 
57  TotalLumi = TotalLumi+xingIntLumi
58  TotalInt+= mean*xingIntLumi
59  FilledXings = FilledXings+1
60  #print "xing inst lumi %f %f %d" % (xingIntLumi,TotalLumi,FilledXings)
61 
62  #compute weighted mean, then loop again to get weighted RMS
63  MeanInt = 0
64  if TotalLumi >0:
65  MeanInt = TotalInt/TotalLumi
66  for xing, xingInstLumi in instLumiArray:
67  if xingInstLumi > 0.1:
68  xingIntLumi = xingInstLumi * parameters.lumiSectionLen * livetime
69  mean = xingInstLumi * parameters.rotationTime
70  TotalInt2+= xingIntLumi*(mean-MeanInt)*(mean-MeanInt)
71  TotalWeight+= xingIntLumi
72  TotalWeight2+= xingIntLumi*xingIntLumi
73 
74 
75 
76  if ((lumiSection > 0)):
77  #print " LS, Total lumi, filled xings %d, %f, %d" %(lumiSection,TotalLumi,FilledXings)
78  if FilledXings > 0:
79  AveLumi = TotalLumi/FilledXings
80  else:
81  AveLumi = 0
82  RMSLumi = 0
83  Denom = TotalWeight*TotalWeight-TotalWeight2
84  if TotalLumi > 0 and Denom > 0:
85  RMSLumi = sqrt(TotalWeight/(TotalWeight*TotalWeight-TotalWeight2)*TotalInt2)
86  LumiString = "[%d,%2.4e,%2.4e,%2.4e]," % (lumiSection, TotalLumi, RMSLumi, MeanInt)
87  LumiArray.append(lumiSection)
88  LumiArray.append(TotalLumi) # should really weight by total lumi in LS
89  LumiArray.append(RMSLumi)
90  LumiArray.append(MeanInt)
91 
92  return LumiArray
93 
94 
95 
T sqrt(T t)
Definition: SSEVec.h:18
def CalcPileup(deadTable, parameters, mode='deadtable')

Variable Documentation

estimatePileup_makeJSON.args

Definition at line 120 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.aveLumi

Definition at line 194 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.csvDict

Definition at line 152 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.default

Definition at line 115 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.delivered

Definition at line 158 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.description

Definition at line 112 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.dest

Definition at line 115 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.events

Definition at line 140 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.GapDict

Definition at line 144 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.help

Definition at line 116 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.InGap

Definition at line 143 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.inputGroup

Definition at line 113 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LastDelivered

Definition at line 146 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lastindex

Definition at line 213 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lastLumiS

Definition at line 186 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LastValidLumi

Definition at line 145 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lumi

Definition at line 157 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LumiArray

Definition at line 226 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LumiString

Definition at line 197 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.mode

Definition at line 227 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.OldRun

Definition at line 141 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.options

Definition at line 120 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.output

Definition at line 128 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.outputfile
estimatePileup_makeJSON.OUTPUTLINE

Let's start the fun.

Definition at line 134 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.parameters

## Main Program

Definition at line 110 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.parser

Definition at line 111 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.peakratio

Definition at line 192 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pieces

Definition at line 153 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pileup
estimatePileup_makeJSON.pileupGroup

Definition at line 114 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.record

Definition at line 188 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.recorded

Definition at line 158 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.run

Definition at line 157 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.runLumiDict

Definition at line 151 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.sepRE

Definition at line 139 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.trunc
estimatePileup_makeJSON.type

Definition at line 115 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.xingInstLumiArray

Definition at line 172 of file estimatePileup_makeJSON.py.