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

Constructor & Destructor Documentation

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

Definition at line 108 of file generateEDF.py.

References edm.print().

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

Member Function Documentation

def generateEDF.LumiInfoCont.__str__ (   self)

Definition at line 172 of file generateEDF.py.

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

Definition at line 195 of file generateEDF.py.

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

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

Definition at line 191 of file generateEDF.py.

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

Definition at line 187 of file generateEDF.py.

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

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

Definition at line 183 of file generateEDF.py.

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

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

Definition at line 179 of file generateEDF.py.

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

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

Member Data Documentation

generateEDF.LumiInfoCont._max
private

Definition at line 114 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

generateEDF.LumiInfoCont._min
private

Definition at line 113 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

generateEDF.LumiInfoCont.allowNoXing

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

generateEDF.LumiInfoCont.maxIntLum

Definition at line 122 of file generateEDF.py.

generateEDF.LumiInfoCont.maxRun

Definition at line 120 of file generateEDF.py.

generateEDF.LumiInfoCont.minIntLum

Definition at line 121 of file generateEDF.py.

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 111 of file generateEDF.py.

generateEDF.LumiInfoCont.minRun

Definition at line 119 of file generateEDF.py.

generateEDF.LumiInfoCont.noWarnings

Definition at line 118 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.totalRecLum

Definition at line 115 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.xingInfo

Definition at line 116 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().