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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 110 of file generateEDF.py.

References print().

110  def __init__ (self, filename, **kwargs):
111  print("loading luminosity information from '%s'." % filename)
112  source = open (filename, 'r') self.minMaxKeys = ['totInstLum', 'aveInstLum', 'numXings',
113  'delivered', 'recorded']
114  self._min = {}
115  self._max = {}
116  self.totalRecLum = 0.
117  self.xingInfo = False
118  self.allowNoXing = kwargs.get ('ignore')
119  self.noWarnings = kwargs.get ('noWarnings')
120  self.minRun = 0
121  self.maxRun = 0
122  self.minIntLum = 0
123  self.maxIntLum = 0
124 
125  for key in self.minMaxKeys:
126  self._min[key] = -1
127  self._max[key] = 0
128  for line in source:
129  try:
130  lumi = LumiInfo (line)
131  except:
132  continue
133  self[lumi.key] = lumi
134  self.totalRecLum += lumi.recorded
135  if not self.xingInfo and lumi.xingInfo:
136  self.xingInfo = True
137  if lumi.xingInfo:
138  #print "yes", lumi.keyString
139  if not self.xingInfo:
140  print("huh?")
141  for key in self.minMaxKeys:
142  val = getattr (lumi, key)
143  if val < self._min[key] or self._min[key] < 0:
144  self._min[key] = val
145  if val > self._max[key] or not self._max[key]:
146  self._max[key] = val
147  source.close()
148 
153  self.invunits = 'nb'
154  lumFactor = 1e3
155  if self.totalRecLum > 1e9:
156  lumFactor = 1e9
157  self.invunits = 'fb'
158  elif self.totalRecLum > 1e6:
159  lumFactor = 1e6
160  self.invunits = 'pb'
161  # use lumFactor to make everything consistent
162  #print "units", self.invunits, "factor", lumFactor
163  self.totalRecLum /= lumFactor
164  for lumis in self.values():
165  lumis.delivered /= lumFactor
166  lumis.recorded /= lumFactor
167  # Probably want to rename this next subroutine, but I'll leave
168  # it alone for now...
169  self._integrateContainer()
170 
171 
172 
173 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Function Documentation

◆ __str__()

◆ _integrateContainer()

def generateEDF.LumiInfoCont._integrateContainer (   self)
private

Definition at line 197 of file generateEDF.py.

References generateEDF.LumiInfoCont.allowNoXing, PixelDCSObject< T >.items, EcalContainer< EcalScDetId, Item >.items(), Items.items(), DictTypes.SortedKeysDict.items(), EcalContainer< ESDetId, Item >.items(), EcalContainer< DetId, T >.items(), EcalContainer< EEDetId, Item >.items(), EcalContainer< DetIdT, T >.items(), EcalContainer< EBDetId, Item >.items(), EcalContainer< EcalTrigTowerDetId, Item >.items(), AlignmentSurfaceDeformations.items(), betterConfigParser.AdaptedDict.items(), edm::ErrorObj.items(), FWTableViewManager.items(), betterConfigParser.BetterConfigParser.items(), svgfig.SVG.items(), generateEDF.LumiInfoCont.noWarnings, print(), generateEDF.LumiInfoCont.totalRecLum, generateEDF.LumiInfo.xingInfo, and generateEDF.LumiInfoCont.xingInfo.

197  def _integrateContainer (self):
198  # calculate numbers for recorded integrated luminosity
199  total = 0.
200  for key, lumi in self.items():
201  total += lumi.recorded
202  lumi.totalRecorded = total
203  lumi.fracRecorded = old_div(total, self.totalRecLum)
204  # calculate numbers for average xing instantaneous luminosity
205  if not self.xingInfo:
206  # nothing to do here
207  return
208  xingKeyList = []
209  maxAveInstLum = 0.
210  for key, lumi in self.items():
211  if not lumi.xingInfo and not lumi.fixXingInfo():
212  if not self.noWarnings:
213  print("Do not have lumi xing info for %s" % lumi.keyString)
214  if not self.allowNoXing:
215  print("Setting no Xing info flag")
216  self.xingInfo = False
217  return
218  continue
219  xingKeyList.append( (lumi.aveInstLum, key) )
220  if lumi.aveInstLum > maxAveInstLum:
221  maxAveInstLum = lumi.aveInstLum
222  xingKeyList.sort()
223  total = 0.
224  for tup in xingKeyList:
225  lumi = self[tup[1]]
226  total += lumi.recorded
227  lumi.totalAXILrecorded = total
228  lumi.fracAXILrecorded = old_div(total, self.totalRecLum)
229  lumi.fracAXIL = old_div(lumi.aveInstLum, maxAveInstLum)
230 
231 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ iteritems()

def generateEDF.LumiInfoCont.iteritems (   self)

Definition at line 193 of file generateEDF.py.

193  def iteritems (self):
194  return sorted (dict.iteritems (self))
195 
196 

◆ keys()

def generateEDF.LumiInfoCont.keys (   self)

Definition at line 189 of file generateEDF.py.

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

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

◆ max()

def generateEDF.LumiInfoCont.max (   self,
  key 
)

Definition at line 185 of file generateEDF.py.

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

185  def max (self, key):
186  return self._max[key]
187 
188 

◆ min()

def generateEDF.LumiInfoCont.min (   self,
  key 
)

Definition at line 181 of file generateEDF.py.

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

181  def min (self, key):
182  return self._min[key]
183 
184 

Member Data Documentation

◆ _max

generateEDF.LumiInfoCont._max
private

Definition at line 116 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

◆ _min

generateEDF.LumiInfoCont._min
private

Definition at line 115 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

◆ allowNoXing

generateEDF.LumiInfoCont.allowNoXing

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

◆ maxIntLum

generateEDF.LumiInfoCont.maxIntLum

Definition at line 124 of file generateEDF.py.

◆ maxRun

generateEDF.LumiInfoCont.maxRun

Definition at line 122 of file generateEDF.py.

◆ minIntLum

generateEDF.LumiInfoCont.minIntLum

Definition at line 123 of file generateEDF.py.

◆ minMaxKeys

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 113 of file generateEDF.py.

◆ minRun

generateEDF.LumiInfoCont.minRun

Definition at line 121 of file generateEDF.py.

◆ noWarnings

generateEDF.LumiInfoCont.noWarnings

Definition at line 120 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ totalRecLum

generateEDF.LumiInfoCont.totalRecLum

Definition at line 117 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ xingInfo

generateEDF.LumiInfoCont.xingInfo

Definition at line 118 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().