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 11 of file weight.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 19 of file weight.py.

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

Member Function Documentation

◆ __str__()

def weight.Weight.__str__ (   self)

Definition at line 46 of file weight.py.

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

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.

◆ GetWeight()

def weight.Weight.GetWeight (   self)
Return the weight

Definition at line 33 of file weight.py.

33  def GetWeight(self):
34  '''Return the weight'''
35  if self.xSection is None:
36  # data
37  return 1
38  else:
39  # MC
40  return self.addWeight * self.xSection * self.intLumi / ( self.genNEvents * self.genEff)
41 

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__().

◆ SetIntLumi()

def weight.Weight.SetIntLumi (   self,
  lumi 
)
Set integrated luminosity.

Definition at line 42 of file weight.py.

42  def SetIntLumi(self, lumi):
43  '''Set integrated luminosity.'''
44  self.dict['intLumi'] = lumi
45 

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

Member Data Documentation

◆ addWeight

weight.Weight.addWeight

Definition at line 30 of file weight.py.

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

◆ FBINV

weight.Weight.FBINV
static

Definition at line 17 of file weight.py.

◆ genEff

weight.Weight.genEff

Definition at line 25 of file weight.py.

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

◆ genNEvents

weight.Weight.genNEvents

Definition at line 20 of file weight.py.

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

◆ intLumi

weight.Weight.intLumi

Definition at line 27 of file weight.py.

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

◆ xSection

weight.Weight.xSection

Definition at line 22 of file weight.py.

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

dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
createfilelist.int
int
Definition: createfilelist.py:10
TriggerAnalyzer.__str__
def __str__(self)
Definition: TriggerAnalyzer.py:103