CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def __str__
 
def GetWeight
 
def SetIntLumi
 

Public Attributes

 addWeight
 
 genEff
 
 genNEvents
 
 intLumi
 
 xSection
 

Static Public Attributes

int FBINV = 1000
 

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 
19  intLumi = FBINV, addWeight=1):
20  self.genNEvents = int(genNEvents)
21  if xSection is not None:
22  self.xSection = float(xSection)
23  else:
24  self.xSection = None
25  self.genEff = float(genEff)
26  if intLumi is not None:
27  self.intLumi = float(intLumi)
28  else:
29  self.intLumi = Weight.FBINV
30  self.addWeight = float(addWeight)

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 
45  def __str__(self):
46  if self.xSection is None:
47  return ' intLumi = %5.2f, addWeight = %3.2f' \
48  % ( self.intLumi,
49  self.addWeight )
50  else:
51  return ' genN = %d, xsec = %5.5f pb, genEff = %2.2f, intLumi = %5.2f, addWeight = %3.2f -> weight = %3.5f' \
52  % ( self.genNEvents,
53  self.xSection,
54  self.genEff,
55  self.intLumi,
56  self.addWeight,
57  self.GetWeight() )
58 
def __str__
Definition: weight.py:44
def GetWeight
Definition: weight.py:31
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 
32  def GetWeight(self):
33  '''Return the weight'''
34  if self.xSection is None:
35  # data
36  return 1
37  else:
38  # MC
39  return self.addWeight * self.xSection * self.intLumi / ( self.genNEvents * self.genEff)
def GetWeight
Definition: weight.py:31
def weight.Weight.SetIntLumi (   self,
  lumi 
)
Set integrated luminosity.

Definition at line 40 of file weight.py.

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

40 
41  def SetIntLumi(self, lumi):
42  '''Set integrated luminosity.'''
43  self.dict['intLumi'] = lumi
def SetIntLumi
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().

int weight.Weight.FBINV = 1000
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().