CMS 3D CMS Logo

Functions | Variables
estimatePileup_makeJSON_2015 Namespace Reference

Functions

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

Variables

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

## Main Program

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

Function Documentation

def estimatePileup_makeJSON_2015.CalcPileup (   deadTable,
  parameters,
  luminometer,
  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_2015.py.

References mathSSE.sqrt().

14 def CalcPileup (deadTable, parameters, luminometer, 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 (deadTable.iteritems()):
22  numerator = 0
23  if luminometer == "HFOC":
24  threshold = 8.
25  else:
26  threshold = 1.2
27  if mode == 'csv':
28  numerator = float (deadArray[1])
29  denominator = float (deadArray[0])
30  instLumiArray = deadArray[2]
31  livetime = 1
32  if numerator < 0:
33  numerator = 0
34  if denominator:
35  livetime = numerator / denominator
36 
37 
38 
39  #print "params", parameters.lumiSectionLen, parameters.rotationTime
40 
41  else:
42  print "no csv input! Doh!"
43  return
44  # totalInstLumi = reduce(lambda x, y: x+y, instLumiArray) # not needed
45  if lumiSection > 0:
46  TotalLumi = 0
47  TotalInt = 0
48  TotalInt2 = 0
49  TotalWeight = 0
50  TotalWeight2 = 0
51  FilledXings = 0
52  for xing, xingInstLumi, xingDelvLumi in instLumiArray:
53  if selBXs and xing not in selBXs:
54  continue
55  xingIntLumi = xingInstLumi * livetime # * parameters.lumiSectionLen
56  mean = xingInstLumi * parameters.rotationTime / parameters.lumiSectionLen
57  if mean > 100:
58  if runNumber:
59  print "mean number of pileup events > 100 for run %d, lum %d : m %f l %f" % \
60  (runNumber, lumiSection, mean, xingInstLumi)
61  else:
62  print "mean number of pileup events > 100 for lum %d: m %f l %f" % \
63  (lumiSection, mean, xingInstLumi)
64  #print "mean number of pileup events for lum %d: m %f idx %d l %f" % (lumiSection, mean, xing, xingIntLumi)
65 
66  if xingInstLumi > threshold:
67 
68  TotalLumi = TotalLumi+xingIntLumi
69  TotalInt+= mean*xingIntLumi
70  FilledXings = FilledXings+1
71  #print "xing inst lumi %f %f %d" % (xingIntLumi,TotalLumi,FilledXings)
72 
73  #compute weighted mean, then loop again to get weighted RMS
74  MeanInt = 0
75  if TotalLumi >0:
76  MeanInt = TotalInt/TotalLumi
77  for xing, xingInstLumi, xingDelvlumi in instLumiArray:
78  if selBXs and xing not in selBXs:
79  continue
80  if xingInstLumi > threshold:
81  xingIntLumi = xingInstLumi * livetime # * parameters.lumiSectionLen
82  mean = xingInstLumi * parameters.rotationTime / parameters.lumiSectionLen
83  TotalInt2+= xingIntLumi*(mean-MeanInt)*(mean-MeanInt)
84  TotalWeight+= xingIntLumi
85  TotalWeight2+= xingIntLumi*xingIntLumi
86 
87 
88 
89  if ((lumiSection > 0)):
90  #print " LS, Total lumi, filled xings %d, %f, %d" %(lumiSection,TotalLumi,FilledXings)
91  if FilledXings > 0:
92  AveLumi = TotalLumi/FilledXings
93  else:
94  AveLumi = 0
95  RMSLumi = 0
96  Denom = TotalWeight*TotalWeight-TotalWeight2
97  if TotalLumi > 0 and Denom > 0:
98  RMSLumi = sqrt(TotalWeight/(TotalWeight*TotalWeight-TotalWeight2)*TotalInt2)
99  LumiString = "[%d,%2.4e,%2.4e,%2.4e]," % (lumiSection, TotalLumi, RMSLumi, MeanInt)
100  LumiArray.append(lumiSection)
101  LumiArray.append(TotalLumi) # should really weight by total lumi in LS
102  LumiArray.append(RMSLumi)
103  LumiArray.append(MeanInt)
104  lumiX=MeanInt*parameters.lumiSectionLen*FilledXings*(1./parameters.rotationTime)
105 
106  #print lumiX
107  # if TotalLumi<(lumiX*0.8):
108 # print lumiSection
109 # print FilledXings
110 # print TotalLumi
111 # print lumiX
112 # print numerator
113 # print denominator
114 
115  #print FilledXings
116  return LumiArray
117 
118 
119 
T sqrt(T t)
Definition: SSEVec.h:18
def CalcPileup(deadTable, parameters, luminometer, mode='deadtable')

Variable Documentation

estimatePileup_makeJSON_2015.args

Definition at line 146 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.aveLumi

Definition at line 240 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.BX

Let's start the fun.

Definition at line 163 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.csvDict

Definition at line 189 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.default

Definition at line 139 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.delivered

Definition at line 202 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.description

Definition at line 136 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.dest

Definition at line 139 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.events

Definition at line 177 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.GapDict

Definition at line 181 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.help

Definition at line 140 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.InGap

Definition at line 180 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.inputGroup

Definition at line 137 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.ipiece

Definition at line 196 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LastDelivered

Definition at line 183 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lastindex

Definition at line 259 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lastLumiS

Definition at line 232 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LastValidLumi

Definition at line 182 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lumi

Definition at line 201 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LumiArray

Definition at line 272 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.luminometer

Definition at line 216 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LumiString

Definition at line 243 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.mode

Definition at line 273 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.OldRun

Definition at line 178 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.options

Definition at line 146 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.output

Definition at line 154 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.outputfile

Definition at line 298 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.OUTPUTLINE

Definition at line 171 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.parameters

## Main Program

Definition at line 134 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.parser

Definition at line 135 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.peakratio

Definition at line 238 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pieces

Definition at line 194 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pileup

Definition at line 239 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pileupGroup

Definition at line 138 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.record

Definition at line 234 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.recorded

Definition at line 202 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.run

Definition at line 201 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.runLumiDict

Definition at line 188 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.selBXs

Definition at line 13 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.sepRE

Definition at line 176 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.trunc

Definition at line 260 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.type

Definition at line 139 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.xingInstLumiArray

Definition at line 217 of file estimatePileup_makeJSON_2015.py.