CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
generateEDF.LumiInfoCont Class Reference

LumiInfoCont Class

More...

Inheritance diagram for generateEDF.LumiInfoCont:

Public Member Functions

def __init__ (self, filename, kwargs)
 
def __str__ (self)
 
def iteritems (self)
 
def keys (self)
 
def max (self, key)
 
def min (self, key)
 

Public Attributes

 allowNoXing
 
 invunits
 Now that everything is setup, switch integrated ## luminosity to more reasonable units. More...
 
 maxIntLum
 
 maxRun
 
 minIntLum
 
 minMaxKeys
 
 minRun
 
 noWarnings
 
 totalRecLum
 
 xingInfo
 

Private Member Functions

def _integrateContainer (self)
 

Private Attributes

 _max
 
 _min
 

Detailed Description

LumiInfoCont Class

Definition at line 107 of file generateEDF.py.

Constructor & Destructor Documentation

def generateEDF.LumiInfoCont.__init__ (   self,
  filename,
  kwargs 
)

Definition at line 109 of file generateEDF.py.

References edm.print().

109  def __init__ (self, filename, **kwargs):
110  print("loading luminosity information from '%s'." % filename)
111  source = open (filename, 'r')
112  self.minMaxKeys = ['totInstLum', 'aveInstLum', 'numXings',
113  'delivered', 'recorded']
114  self._min = {}
115  self._max = {}
116  self.totalRecLum = 0.
117  self.xingInfo = False
118  self.allowNoXing = kwargs.get ('ignore')
119  self.noWarnings = kwargs.get ('noWarnings')
120  self.minRun = 0
121  self.maxRun = 0
122  self.minIntLum = 0
123  self.maxIntLum = 0
124 
125  for key in self.minMaxKeys:
126  self._min[key] = -1
127  self._max[key] = 0
128  for line in source:
129  try:
130  lumi = LumiInfo (line)
131  except:
132  continue
133  self[lumi.key] = lumi
134  self.totalRecLum += lumi.recorded
135  if not self.xingInfo and lumi.xingInfo:
136  self.xingInfo = True
137  if lumi.xingInfo:
138  #print "yes", lumi.keyString
139  if not self.xingInfo:
140  print("huh?")
141  for key in self.minMaxKeys:
142  val = getattr (lumi, key)
143  if val < self._min[key] or self._min[key] < 0:
144  self._min[key] = val
145  if val > self._max[key] or not self._max[key]:
146  self._max[key] = val
147  source.close()
148  ######################################################
149  ## Now that everything is setup, switch integrated ##
150  ## luminosity to more reasonable units. ##
151  ######################################################
152  # the default is '1/mb', but that's just silly.
153  self.invunits = 'nb'
154  lumFactor = 1e3
155  if self.totalRecLum > 1e9:
156  lumFactor = 1e9
157  self.invunits = 'fb'
158  elif self.totalRecLum > 1e6:
159  lumFactor = 1e6
160  self.invunits = 'pb'
161  # use lumFactor to make everything consistent
162  #print "units", self.invunits, "factor", lumFactor
163  self.totalRecLum /= lumFactor
164  for lumis in self.values():
165  lumis.delivered /= lumFactor
166  lumis.recorded /= lumFactor
167  # Probably want to rename this next subroutine, but I'll leave
168  # it alone for now...
169  self._integrateContainer()
170 
171 
172 
def __init__(self, filename, kwargs)
Definition: generateEDF.py:109
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
invunits
Now that everything is setup, switch integrated ## luminosity to more reasonable units.
Definition: generateEDF.py:153

Member Function Documentation

def generateEDF.LumiInfoCont.__str__ (   self)

Definition at line 173 of file generateEDF.py.

173  def __str__ (self):
174  retval = 'run, lum del ( dt ) inst (#xng)\n'
175  for key, value in sorted (six.iteritems(self)):
176  retval += "%s\n" % value
177  return retval
178 
179 
def generateEDF.LumiInfoCont._integrateContainer (   self)
private

Definition at line 196 of file generateEDF.py.

References generateEDF.LumiInfoCont.allowNoXing, generateEDF.LumiInfoCont.noWarnings, edm.print(), generateEDF.LumiInfoCont.totalRecLum, generateEDF.LumiInfo.xingInfo, and generateEDF.LumiInfoCont.xingInfo.

197  # calculate numbers for recorded integrated luminosity
198  total = 0.
199  for key, lumi in six.iteritems(self):
200  total += lumi.recorded
201  lumi.totalRecorded = total
202  lumi.fracRecorded = total / self.totalRecLum
203  # calculate numbers for average xing instantaneous luminosity
204  if not self.xingInfo:
205  # nothing to do here
206  return
207  xingKeyList = []
208  maxAveInstLum = 0.
209  for key, lumi in six.iteritems(self):
210  if not lumi.xingInfo and not lumi.fixXingInfo():
211  if not self.noWarnings:
212  print("Do not have lumi xing info for %s" % lumi.keyString)
213  if not self.allowNoXing:
214  print("Setting no Xing info flag")
215  self.xingInfo = False
216  return
217  continue
218  xingKeyList.append( (lumi.aveInstLum, key) )
219  if lumi.aveInstLum > maxAveInstLum:
220  maxAveInstLum = lumi.aveInstLum
221  xingKeyList.sort()
222  total = 0.
223  for tup in xingKeyList:
224  lumi = self[tup[1]]
225  total += lumi.recorded
226  lumi.totalAXILrecorded = total
227  lumi.fracAXILrecorded = total / self.totalRecLum
228  lumi.fracAXIL = lumi.aveInstLum / maxAveInstLum
229 
230 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def generateEDF.LumiInfoCont.iteritems (   self)

Definition at line 192 of file generateEDF.py.

192  def iteritems (self):
193  return sorted (dict.iteritems (self))
194 
195 
def generateEDF.LumiInfoCont.keys (   self)

Definition at line 188 of file generateEDF.py.

Referenced by psClasses.queueList.__init__(), psClasses.queueList.smallestQueue(), and psClasses.queueList.thinerQueue().

188  def keys (self):
189  return sorted (dict.keys (self))
190 
191 
def generateEDF.LumiInfoCont.max (   self,
  key 
)

Definition at line 184 of file generateEDF.py.

References GeometryComparisonPlotter._max, generateEDF.LumiInfoCont._max, CompareToMedian._max, and CompareLastFilledBin._max.

184  def max (self, key):
185  return self._max[key]
186 
187 
def generateEDF.LumiInfoCont.min (   self,
  key 
)

Definition at line 180 of file generateEDF.py.

References GeometryComparisonPlotter._min, generateEDF.LumiInfoCont._min, CompareToMedian._min, and CompareLastFilledBin._min.

180  def min (self, key):
181  return self._min[key]
182 
183 

Member Data Documentation

generateEDF.LumiInfoCont._max
private

Definition at line 115 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

generateEDF.LumiInfoCont._min
private

Definition at line 114 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

generateEDF.LumiInfoCont.allowNoXing

Definition at line 118 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.invunits

Now that everything is setup, switch integrated ## luminosity to more reasonable units.

the default is '1/mb', but that's just silly.

Definition at line 153 of file generateEDF.py.

generateEDF.LumiInfoCont.maxIntLum

Definition at line 123 of file generateEDF.py.

generateEDF.LumiInfoCont.maxRun

Definition at line 121 of file generateEDF.py.

generateEDF.LumiInfoCont.minIntLum

Definition at line 122 of file generateEDF.py.

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 112 of file generateEDF.py.

generateEDF.LumiInfoCont.minRun

Definition at line 120 of file generateEDF.py.

generateEDF.LumiInfoCont.noWarnings

Definition at line 119 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.totalRecLum

Definition at line 116 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.xingInfo

Definition at line 117 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().