CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
weight.Weight Class Reference
Inheritance diagram for weight.Weight:

Public Member Functions

def __init__ (self, genNEvents, xSection, genEff, intLumi=FBINV, addWeight=1)
 
def __str__ (self)
 
def GetWeight (self)
 
def SetIntLumi (self, lumi)
 

Public Attributes

 addWeight
 
 genEff
 
 genNEvents
 
 intLumi
 
 xSection
 

Static Public Attributes

 FBINV
 

Detailed Description

make names uniform wrt Component.

COLIN: messy... should I have several types of weight (base, data, mc)?
COLIN: need to add other weighting factors

Definition at line 9 of file weight.py.

Constructor & Destructor Documentation

def weight.Weight.__init__ (   self,
  genNEvents,
  xSection,
  genEff,
  intLumi = FBINV,
  addWeight = 1 
)

Definition at line 18 of file weight.py.

18  intLumi = FBINV, addWeight=1):
19  self.genNEvents = int(genNEvents)
20  if xSection is not None:
21  self.xSection = float(xSection)
22  else:
23  self.xSection = None
24  self.genEff = float(genEff)
25  if intLumi is not None:
26  self.intLumi = float(intLumi)
27  else:
28  self.intLumi = Weight.FBINV
29  self.addWeight = float(addWeight)
30 

Member Function Documentation

def weight.Weight.__str__ (   self)

Definition at line 44 of file weight.py.

References weight.Weight.addWeight, config.MCComponent.addWeight, weight.Weight.genEff, weight.Weight.genNEvents, weight.Weight.GetWeight(), weight.Weight.intLumi, config.DataComponent.intLumi, config.MCComponent.intLumi, weight.Weight.xSection, and config.MCComponent.xSection.

44  def __str__(self):
45  if self.xSection is None:
46  return ' intLumi = %5.2f, addWeight = %3.2f' \
47  % ( self.intLumi,
48  self.addWeight )
49  else:
50  return ' genN = %d, xsec = %5.5f pb, genEff = %2.2f, intLumi = %5.2f, addWeight = %3.2f -> weight = %3.5f' \
51  % ( self.genNEvents,
52  self.xSection,
53  self.genEff,
54  self.intLumi,
55  self.addWeight,
56  self.GetWeight() )
57 
58 
def GetWeight(self)
Definition: weight.py:31
def __str__(self)
Definition: weight.py:44
def weight.Weight.GetWeight (   self)
Return the weight

Definition at line 31 of file weight.py.

References weight.Weight.addWeight, config.MCComponent.addWeight, weight.Weight.genEff, weight.Weight.genNEvents, weight.Weight.intLumi, config.DataComponent.intLumi, config.MCComponent.intLumi, weight.Weight.xSection, and config.MCComponent.xSection.

Referenced by weight.Weight.__str__().

31  def GetWeight(self):
32  '''Return the weight'''
33  if self.xSection is None:
34  # data
35  return 1
36  else:
37  # MC
38  return self.addWeight * self.xSection * self.intLumi / ( self.genNEvents * self.genEff)
39 
def GetWeight(self)
Definition: weight.py:31
def weight.Weight.SetIntLumi (   self,
  lumi 
)
Set integrated luminosity.

Definition at line 40 of file weight.py.

References rltinfo.RLTInfo.dict, and cond::IOVKeysDescription.dict().

40  def SetIntLumi(self, lumi):
41  '''Set integrated luminosity.'''
42  self.dict['intLumi'] = lumi
43 
def SetIntLumi(self, lumi)
Definition: weight.py:40

Member Data Documentation

weight.Weight.addWeight

Definition at line 29 of file weight.py.

Referenced by weight.Weight.__str__(), and weight.Weight.GetWeight().

weight.Weight.FBINV
static

Definition at line 15 of file weight.py.

weight.Weight.genEff

Definition at line 24 of file weight.py.

Referenced by weight.Weight.__str__(), and weight.Weight.GetWeight().

weight.Weight.genNEvents

Definition at line 19 of file weight.py.

Referenced by weight.Weight.__str__(), and weight.Weight.GetWeight().

weight.Weight.intLumi

Definition at line 26 of file weight.py.

Referenced by weight.Weight.__str__(), and weight.Weight.GetWeight().

weight.Weight.xSection

Definition at line 21 of file weight.py.

Referenced by weight.Weight.__str__(), and weight.Weight.GetWeight().