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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 112 of file generateEDF.py.

References print().

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

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

◆ iteritems()

def generateEDF.LumiInfoCont.iteritems (   self)

Definition at line 195 of file generateEDF.py.

195  def iteritems (self):
196  return sorted (dict.iteritems (self))
197 
198 

◆ keys()

def generateEDF.LumiInfoCont.keys (   self)

Definition at line 191 of file generateEDF.py.

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

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

◆ max()

def generateEDF.LumiInfoCont.max (   self,
  key 
)

Definition at line 187 of file generateEDF.py.

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

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

◆ min()

def generateEDF.LumiInfoCont.min (   self,
  key 
)

Definition at line 183 of file generateEDF.py.

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

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

Member Data Documentation

◆ _max

generateEDF.LumiInfoCont._max
private

Definition at line 118 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.max().

◆ _min

generateEDF.LumiInfoCont._min
private

Definition at line 117 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont.min().

◆ allowNoXing

generateEDF.LumiInfoCont.allowNoXing

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

◆ maxIntLum

generateEDF.LumiInfoCont.maxIntLum

Definition at line 126 of file generateEDF.py.

◆ maxRun

generateEDF.LumiInfoCont.maxRun

Definition at line 124 of file generateEDF.py.

◆ minIntLum

generateEDF.LumiInfoCont.minIntLum

Definition at line 125 of file generateEDF.py.

◆ minMaxKeys

generateEDF.LumiInfoCont.minMaxKeys

Definition at line 115 of file generateEDF.py.

◆ minRun

generateEDF.LumiInfoCont.minRun

Definition at line 123 of file generateEDF.py.

◆ noWarnings

generateEDF.LumiInfoCont.noWarnings

Definition at line 122 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ totalRecLum

generateEDF.LumiInfoCont.totalRecLum

Definition at line 119 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().

◆ xingInfo

generateEDF.LumiInfoCont.xingInfo

Definition at line 120 of file generateEDF.py.

Referenced by generateEDF.LumiInfoCont._integrateContainer().