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 111 of file generateEDF.py.

Constructor & Destructor Documentation

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

Definition at line 113 of file generateEDF.py.

References edm.print().

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

Member Function Documentation

def generateEDF.LumiInfoCont.__str__ (   self)

Definition at line 177 of file generateEDF.py.

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

Definition at line 200 of file generateEDF.py.

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

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

Definition at line 196 of file generateEDF.py.

196  def iteritems (self):
197  return sorted (dict.iteritems (self))
198 
199 
def generateEDF.LumiInfoCont.keys (   self)

Definition at line 192 of file generateEDF.py.

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

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

Definition at line 188 of file generateEDF.py.

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

188  def max (self, key):
189  return self._max[key]
190 
191 
def generateEDF.LumiInfoCont.min (   self,
  key 
)

Definition at line 184 of file generateEDF.py.

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

184  def min (self, key):
185  return self._min[key]
186 
187 

Member Data Documentation

generateEDF.LumiInfoCont._max
private

Definition at line 119 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

generateEDF.LumiInfoCont._min
private

Definition at line 118 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

generateEDF.LumiInfoCont.allowNoXing

Definition at line 122 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 157 of file generateEDF.py.

generateEDF.LumiInfoCont.maxIntLum

Definition at line 127 of file generateEDF.py.

generateEDF.LumiInfoCont.maxRun

Definition at line 125 of file generateEDF.py.

generateEDF.LumiInfoCont.minIntLum

Definition at line 126 of file generateEDF.py.

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 116 of file generateEDF.py.

generateEDF.LumiInfoCont.minRun

Definition at line 124 of file generateEDF.py.

generateEDF.LumiInfoCont.noWarnings

Definition at line 123 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.totalRecLum

Definition at line 120 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.xingInfo

Definition at line 121 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().