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

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

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

Variable Documentation

estimatePileup_makeJSON_2015.args

Definition at line 148 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.aveLumi

Definition at line 242 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.BX

Let's start the fun.

Definition at line 165 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.csvDict

Definition at line 191 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.default

Definition at line 141 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.delivered

Definition at line 204 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.description

Definition at line 138 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.dest

Definition at line 141 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.events

Definition at line 179 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.GapDict

Definition at line 183 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.help

Definition at line 142 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.InGap

Definition at line 182 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.inputGroup

Definition at line 139 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.ipiece

Definition at line 198 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LastDelivered

Definition at line 185 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lastindex

Definition at line 261 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lastLumiS

Definition at line 234 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LastValidLumi

Definition at line 184 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.lumi

Definition at line 203 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LumiArray

Definition at line 274 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.luminometer

Definition at line 218 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.LumiString

Definition at line 245 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.mode

Definition at line 275 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.OldRun

Definition at line 180 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.options

Definition at line 148 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.output

Definition at line 156 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.outputfile

Definition at line 300 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.OUTPUTLINE

Definition at line 173 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.parameters

## Main Program

Definition at line 136 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.parser

Definition at line 137 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.peakratio

Definition at line 240 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pieces

Definition at line 196 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pileup

Definition at line 241 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.pileupGroup

Definition at line 140 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.record

Definition at line 236 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.recorded

Definition at line 204 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.run

Definition at line 203 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.runLumiDict

Definition at line 190 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.selBXs

Definition at line 15 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.sepRE

Definition at line 178 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.trunc

Definition at line 262 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.type

Definition at line 141 of file estimatePileup_makeJSON_2015.py.

estimatePileup_makeJSON_2015.xingInstLumiArray

Definition at line 219 of file estimatePileup_makeJSON_2015.py.