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

References edm.print(), and mathSSE.sqrt().

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

Variable Documentation

estimatePileup_makeJSON.args

Definition at line 122 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.aveLumi

Definition at line 196 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.csvDict

Definition at line 154 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.default

Definition at line 117 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.delivered

Definition at line 160 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.description

Definition at line 114 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.dest

Definition at line 117 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.events

Definition at line 142 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.GapDict

Definition at line 146 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.help

Definition at line 118 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.InGap

Definition at line 145 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.inputGroup

Definition at line 115 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LastDelivered

Definition at line 148 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lastindex

Definition at line 215 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lastLumiS

Definition at line 188 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LastValidLumi

Definition at line 147 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.lumi

Definition at line 159 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LumiArray

Definition at line 228 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.LumiString

Definition at line 199 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.mode

Definition at line 229 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.OldRun

Definition at line 143 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.options

Definition at line 122 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.output

Definition at line 130 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.outputfile

Definition at line 254 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.OUTPUTLINE

Let's start the fun.

Definition at line 136 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.parameters

## Main Program

Definition at line 112 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.parser

Definition at line 113 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.peakratio

Definition at line 194 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pieces

Definition at line 155 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.pileup
estimatePileup_makeJSON.pileupGroup

Definition at line 116 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.record

Definition at line 190 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.recorded

Definition at line 160 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.run

Definition at line 159 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.runLumiDict

Definition at line 153 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.sepRE

Definition at line 141 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.trunc
estimatePileup_makeJSON.type

Definition at line 117 of file estimatePileup_makeJSON.py.

estimatePileup_makeJSON.xingInstLumiArray

Definition at line 174 of file estimatePileup_makeJSON.py.