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

References mathSSE.sqrt().

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

Variable Documentation

estimatePileup_makeJSON.args

Definition at line 121 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.aveLumi

Definition at line 195 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.csvDict

Definition at line 153 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.default

Definition at line 116 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.delivered

Definition at line 159 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.description

Definition at line 113 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.dest

Definition at line 116 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.events

Definition at line 141 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.GapDict

Definition at line 145 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.help

Definition at line 117 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.InGap

Definition at line 144 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.inputGroup

Definition at line 114 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LastDelivered

Definition at line 147 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lastindex

Definition at line 214 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lastLumiS

Definition at line 187 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LastValidLumi

Definition at line 146 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lumi

Definition at line 158 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LumiArray

Definition at line 227 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LumiString

Definition at line 198 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.mode

Definition at line 228 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.OldRun

Definition at line 142 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.options

Definition at line 121 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.output

Definition at line 129 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.outputfile
estimatePileup_makeJSON.OUTPUTLINE

Let's start the fun.

Definition at line 135 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.parameters

## Main Program

Definition at line 111 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.parser

Definition at line 112 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.peakratio

Definition at line 193 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pieces

Definition at line 154 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pileup

Definition at line 194 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pileupGroup

Definition at line 115 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.record

Definition at line 189 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.recorded

Definition at line 159 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.run

Definition at line 158 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.runLumiDict

Definition at line 152 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.sepRE

Definition at line 140 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.trunc
estimatePileup_makeJSON.type

Definition at line 116 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.xingInstLumiArray

Definition at line 173 of file estimatePileup_makeJSON.py.