CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

generateEDF::LumiInfoCont Class Reference

######################## ## ## LumiInfoCont Class ## ## ######################## ## More...

List of all members.

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

00107                                            :
00108         print "loading luminosity information from '%s'." % filename
00109         source = open (filename, 'r')
00110         self.minMaxKeys = ['totInstLum', 'aveInstLum', 'numXings',
00111                      'delivered', 'recorded']
00112         self._min = {}
00113         self._max = {}
00114         self.totalRecLum = 0.
00115         self.xingInfo    = False
00116         self.allowNoXing = kwargs.get ('ignore')
00117         self.noWarnings  = kwargs.get ('noWarnings')
00118         self.minRun      = 0
00119         self.maxRun      = 0
00120         self.minIntLum   = 0
00121         self.maxIntLum   = 0
00122         
00123         for key in self.minMaxKeys:
00124             self._min[key] = -1
00125             self._max[key] =  0
00126         for line in source:
00127             try:
00128                 lumi = LumiInfo (line)
00129             except:
00130                 continue
00131             self[lumi.key] = lumi
00132             self.totalRecLum += lumi.recorded
00133             if not self.xingInfo and lumi.xingInfo:
00134                 self.xingInfo = True
00135             if lumi.xingInfo:
00136                 #print "yes", lumi.keyString
00137                 if not self.xingInfo:
00138                     print "huh?"
00139             for key in self.minMaxKeys:
00140                 val = getattr (lumi, key)
00141                 if val < self._min[key] or self._min[key] < 0:
00142                     self._min[key] = val
00143                 if val > self._max[key] or not self._max[key]:
00144                     self._max[key] = val
00145         source.close()
00146         ######################################################
00147         ## Now that everything is setup, switch integrated  ##
00148         ## luminosity to more reasonable units.             ##
00149         ######################################################
00150         # the default is '1/mb', but that's just silly.
00151         self.invunits = 'nb'
00152         lumFactor = 1e3        
00153         if   self.totalRecLum > 1e9:
00154             lumFactor = 1e9
00155             self.invunits = 'fb'
00156         elif self.totalRecLum > 1e6:
00157             lumFactor = 1e6
00158             self.invunits = 'pb'
00159         # use lumFactor to make everything consistent
00160         #print "units", self.invunits, "factor", lumFactor
00161         self.totalRecLum /= lumFactor
00162         for lumis in self.values():
00163             lumis.delivered /= lumFactor
00164             lumis.recorded  /= lumFactor
00165         # Probably want to rename this next subroutine, but I'll leave
00166         # it alone for now...
00167         self._integrateContainer()
00168 
00169 


Member Function Documentation

def generateEDF::LumiInfoCont::__str__ (   self)

Definition at line 170 of file generateEDF.py.

00171                       :
00172         retval = 'run,     lum     del ( dt  ) inst (#xng)\n'
00173         for key, value in sorted (self.iteritems()):
00174             retval += "%s\n" % value
00175         return retval
00176 

def generateEDF::LumiInfoCont::_integrateContainer (   self) [private]

Definition at line 193 of file generateEDF.py.

00194                                   :
00195         # calculate numbers for recorded integrated luminosity
00196         total = 0.
00197         for key, lumi in self.iteritems():
00198             total += lumi.recorded
00199             lumi.totalRecorded = total
00200             lumi.fracRecorded  = total / self.totalRecLum
00201         # calculate numbers for average xing instantaneous luminosity
00202         if not self.xingInfo:
00203             # nothing to do here
00204             return
00205         xingKeyList = []
00206         maxAveInstLum = 0.
00207         for key, lumi in self.iteritems():
00208             if not lumi.xingInfo and not lumi.fixXingInfo():
00209                 if not self.noWarnings:
00210                     print "Do not have lumi xing info for %s" % lumi.keyString
00211                 if not self.allowNoXing:
00212                     print "Setting no Xing info flag"
00213                     self.xingInfo = False
00214                     return
00215                 continue
00216             xingKeyList.append( (lumi.aveInstLum, key) )
00217             if lumi.aveInstLum > maxAveInstLum:
00218                 maxAveInstLum = lumi.aveInstLum
00219         xingKeyList.sort()
00220         total = 0.
00221         for tup in xingKeyList:
00222             lumi = self[tup[1]]
00223             total += lumi.recorded
00224             lumi.totalAXILrecorded = total
00225             lumi.fracAXILrecorded  = total / self.totalRecLum
00226             lumi.fracAXIL = lumi.aveInstLum / maxAveInstLum
00227 

def generateEDF::LumiInfoCont::iteritems (   self)

Definition at line 189 of file generateEDF.py.

00190                         :
00191         return sorted (dict.iteritems (self))
00192 

def generateEDF::LumiInfoCont::keys (   self)

Definition at line 185 of file generateEDF.py.

00186                    :
00187         return sorted (dict.keys (self))
00188 

def generateEDF::LumiInfoCont::max (   self,
  key 
)

Definition at line 181 of file generateEDF.py.

00182                        :
00183         return self._max[key]
00184 

def generateEDF::LumiInfoCont::min (   self,
  key 
)

Definition at line 177 of file generateEDF.py.

00178                        :
00179         return self._min[key]
00180 


Member Data Documentation

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

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

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.

Definition at line 106 of file generateEDF.py.