CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
generateEDF.LumiInfoCont Class Reference
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

◆ __init__()

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

Definition at line 113 of file generateEDF.py.

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 
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 

References print().

Member Function Documentation

◆ __str__()

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 

◆ _integrateContainer()

def generateEDF.LumiInfoCont._integrateContainer (   self)
private

Definition at line 200 of file generateEDF.py.

200  def _integrateContainer (self):
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 

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

◆ iteritems()

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 

◆ keys()

def generateEDF.LumiInfoCont.keys (   self)

Definition at line 192 of file generateEDF.py.

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

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

◆ max()

def generateEDF.LumiInfoCont.max (   self,
  key 
)

Definition at line 188 of file generateEDF.py.

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

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

◆ min()

def generateEDF.LumiInfoCont.min (   self,
  key 
)

Definition at line 184 of file generateEDF.py.

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

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

Member Data Documentation

◆ _max

generateEDF.LumiInfoCont._max
private

Definition at line 119 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

◆ _min

generateEDF.LumiInfoCont._min
private

Definition at line 118 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

◆ allowNoXing

generateEDF.LumiInfoCont.allowNoXing

Definition at line 122 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ invunits

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.

◆ maxIntLum

generateEDF.LumiInfoCont.maxIntLum

Definition at line 127 of file generateEDF.py.

◆ maxRun

generateEDF.LumiInfoCont.maxRun

Definition at line 125 of file generateEDF.py.

◆ minIntLum

generateEDF.LumiInfoCont.minIntLum

Definition at line 126 of file generateEDF.py.

◆ minMaxKeys

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 116 of file generateEDF.py.

◆ minRun

generateEDF.LumiInfoCont.minRun

Definition at line 124 of file generateEDF.py.

◆ noWarnings

generateEDF.LumiInfoCont.noWarnings

Definition at line 123 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ totalRecLum

generateEDF.LumiInfoCont.totalRecLum

Definition at line 120 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ xingInfo

generateEDF.LumiInfoCont.xingInfo

Definition at line 121 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

min
T min(T a, T b)
Definition: MathUtil.h:58
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
TriggerAnalyzer.__str__
def __str__(self)
Definition: TriggerAnalyzer.py:103