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

Constructor & Destructor Documentation

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

Definition at line 106 of file generateEDF.py.

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

Member Function Documentation

def generateEDF.LumiInfoCont.__str__ (   self)

Definition at line 170 of file generateEDF.py.

References DictTypes.SortedKeysDict.iteritems(), and generateEDF.LumiInfoCont.iteritems().

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

Definition at line 193 of file generateEDF.py.

References generateEDF.LumiInfoCont.allowNoXing, DictTypes.SortedKeysDict.iteritems(), generateEDF.LumiInfoCont.iteritems(), generateEDF.LumiInfoCont.noWarnings, generateEDF.LumiInfoCont.totalRecLum, generateEDF.LumiInfo.xingInfo, and generateEDF.LumiInfoCont.xingInfo.

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

Definition at line 189 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.__str__(), and generateEDF.LumiInfoCont._integrateContainer().

189  def iteritems (self):
190  return sorted (dict.iteritems (self))
191 
192 
def generateEDF.LumiInfoCont.keys (   self)

Definition at line 185 of file generateEDF.py.

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

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

Definition at line 181 of file generateEDF.py.

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

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

Definition at line 177 of file generateEDF.py.

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

177  def min (self, key):
178  return self._min[key]
179 
180 

Member Data Documentation

generateEDF.LumiInfoCont._max
private

Definition at line 112 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

generateEDF.LumiInfoCont._min
private

Definition at line 111 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

generateEDF.LumiInfoCont.allowNoXing

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

generateEDF.LumiInfoCont.maxIntLum

Definition at line 120 of file generateEDF.py.

generateEDF.LumiInfoCont.maxRun

Definition at line 118 of file generateEDF.py.

generateEDF.LumiInfoCont.minIntLum

Definition at line 119 of file generateEDF.py.

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 109 of file generateEDF.py.

generateEDF.LumiInfoCont.minRun

Definition at line 117 of file generateEDF.py.

generateEDF.LumiInfoCont.noWarnings

Definition at line 116 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.totalRecLum

Definition at line 113 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

generateEDF.LumiInfoCont.xingInfo

Definition at line 114 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().