test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def __str__
 
def iteritems
 
def keys
 
def max
 
def min
 

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
 

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.

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

171  def __str__ (self):
172  retval = 'run, lum del ( dt ) inst (#xng)\n'
173  for key, value in sorted (self.iteritems()):
174  retval += "%s\n" % value
175  return retval
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  def _integrateContainer (self):
195  # calculate numbers for recorded integrated luminosity
196  total = 0.
197  for key, lumi in self.iteritems():
198  total += lumi.recorded
199  lumi.totalRecorded = total
200  lumi.fracRecorded = total / self.totalRecLum
201  # calculate numbers for average xing instantaneous luminosity
202  if not self.xingInfo:
203  # nothing to do here
204  return
205  xingKeyList = []
206  maxAveInstLum = 0.
207  for key, lumi in self.iteritems():
208  if not lumi.xingInfo and not lumi.fixXingInfo():
209  if not self.noWarnings:
210  print "Do not have lumi xing info for %s" % lumi.keyString
211  if not self.allowNoXing:
212  print "Setting no Xing info flag"
213  self.xingInfo = False
214  return
215  continue
216  xingKeyList.append( (lumi.aveInstLum, key) )
217  if lumi.aveInstLum > maxAveInstLum:
218  maxAveInstLum = lumi.aveInstLum
219  xingKeyList.sort()
220  total = 0.
221  for tup in xingKeyList:
222  lumi = self[tup[1]]
223  total += lumi.recorded
224  lumi.totalAXILrecorded = total
225  lumi.fracAXILrecorded = total / self.totalRecLum
226  lumi.fracAXIL = lumi.aveInstLum / maxAveInstLum
227 
def generateEDF.LumiInfoCont.iteritems (   self)

Definition at line 189 of file generateEDF.py.

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

190  def iteritems (self):
191  return sorted (dict.iteritems (self))
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().

186  def keys (self):
187  return sorted (dict.keys (self))
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.

182  def max (self, key):
183  return self._max[key]
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.

178  def min (self, key):
179  return self._min[key]
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().