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

References mathSSE.sqrt().

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

Variable Documentation

estimatePileup_makeJSON_2015.args

Definition at line 147 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.aveLumi

Definition at line 241 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.BX

Let's start the fun.

Definition at line 164 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.csvDict

Definition at line 190 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.default

Definition at line 140 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.delivered

Definition at line 203 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.description

Definition at line 137 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.dest

Definition at line 140 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.events

Definition at line 178 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.GapDict

Definition at line 182 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.help

Definition at line 141 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.InGap

Definition at line 181 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.inputGroup

Definition at line 138 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.ipiece

Definition at line 197 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LastDelivered

Definition at line 184 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lastindex

Definition at line 260 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lastLumiS

Definition at line 233 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LastValidLumi

Definition at line 183 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lumi

Definition at line 202 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LumiArray

Definition at line 273 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.luminometer

Definition at line 217 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LumiString

Definition at line 244 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.mode

Definition at line 274 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.OldRun

Definition at line 179 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.options

Definition at line 147 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.output

Definition at line 155 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.outputfile

Definition at line 299 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.OUTPUTLINE

Definition at line 172 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.parameters

## Main Program

Definition at line 135 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.parser

Definition at line 136 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.peakratio

Definition at line 239 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pieces

Definition at line 195 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pileup

Definition at line 240 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pileupGroup

Definition at line 139 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.record

Definition at line 235 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.recorded

Definition at line 203 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.run

Definition at line 202 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.runLumiDict

Definition at line 189 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.selBXs

Definition at line 14 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.sepRE

Definition at line 177 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.trunc

Definition at line 261 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.type

Definition at line 140 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.xingInstLumiArray

Definition at line 218 of file estimatePileup_makeJSON_2015.py.