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
gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer Class Reference
Inheritance diagram for gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer:

Public Member Functions

def __init__
 
def beginLoop
 
def declareHandles
 
def initPDFWeights
 
def makePDFWeights
 
def process
 

Public Attributes

 doPDFVars
 
 doPDFWeights
 
 genInfo
 
 pdfWeightInit
 
 pdfWeightTool
 

Static Public Attributes

list PDFWeights = []
 

Detailed Description

 

Definition at line 6 of file PDFWeightsAnalyzer.py.

Constructor & Destructor Documentation

def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.__init__ (   self,
  cfg_ana,
  cfg_comp,
  looperName 
)

Definition at line 8 of file PDFWeightsAnalyzer.py.

8 
9  def __init__(self, cfg_ana, cfg_comp, looperName ):
10  super(PDFWeightsAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
11  self.doPDFWeights = hasattr(self.cfg_ana, "PDFWeights") and len(self.cfg_ana.PDFWeights) > 0
12  self.doPDFVars = hasattr(self.cfg_ana, "doPDFVars") and self.cfg_ana.doPDFVars == True
13  if self.doPDFWeights:
self.pdfWeightInit = False

Member Function Documentation

def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.beginLoop (   self,
  setup 
)

Definition at line 25 of file PDFWeightsAnalyzer.py.

25 
26  def beginLoop(self, setup):
27  super(PDFWeightsAnalyzer,self).beginLoop(setup)
def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.declareHandles (   self)

Definition at line 19 of file PDFWeightsAnalyzer.py.

References gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFVars, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFWeights, and core.Analyzer.Analyzer.mchandles.

19 
20  def declareHandles(self):
21  super(PDFWeightsAnalyzer, self).declareHandles()
22 
23  if self.doPDFVars or self.doPDFWeights:
24  self.mchandles['pdfstuff'] = AutoHandle( 'generator', 'GenEventInfoProduct' )
def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.initPDFWeights (   self)

Definition at line 28 of file PDFWeightsAnalyzer.py.

References gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit.

Referenced by gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.makePDFWeights().

28 
29  def initPDFWeights(self):
30  from ROOT import PdfWeightProducerTool
31  self.pdfWeightInit = True
32  self.pdfWeightTool = PdfWeightProducerTool()
33  for pdf in self.cfg_ana.PDFWeights:
34  self.pdfWeightTool.addPdfSet(pdf+".LHgrid")
35  self.pdfWeightTool.beginJob()
def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.makePDFWeights (   self,
  event 
)

Definition at line 36 of file PDFWeightsAnalyzer.py.

References gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.genInfo, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.initPDFWeights(), and gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit.

36 
37  def makePDFWeights(self, event):
38  if not self.pdfWeightInit: self.initPDFWeights()
39  self.pdfWeightTool.processEvent(self.genInfo)
40  event.pdfWeights = {}
41  for pdf in self.cfg_ana.PDFWeights:
42  ws = self.pdfWeightTool.getWeights(pdf+".LHgrid")
43  event.pdfWeights[pdf] = [w for w in ws]
def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.process (   self,
  event 
)

Definition at line 44 of file PDFWeightsAnalyzer.py.

References gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFVars, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFWeights, and core.Analyzer.Analyzer.readCollections().

Referenced by ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_PATFILTER(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder.scheduleSequence().

44 
45  def process(self, event):
46  self.readCollections( event.input )
47 
48  # if not MC, nothing to do
49  if not self.cfg_comp.isMC:
50  return True
51 
52  if self.doPDFVars or self.doPDFWeights:
53  self.genInfo = self.mchandles['pdfstuff'].product()
54  if self.doPDFWeights:
55  self.makePDFWeights(event)
56  if self.doPDFVars:
57  event.pdf_x1 = self.genInfo.pdf().x.first
58  event.pdf_x2 = self.genInfo.pdf().x.second
59  event.pdf_id1 = self.genInfo.pdf().id.first
60  event.pdf_id2 = self.genInfo.pdf().id.second
61  event.pdf_scale = self.genInfo.pdf().scalePDF
62 
63  return True
64 
setattr(PDFWeightsAnalyzer,"defaultConfig",

Member Data Documentation

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFVars

Definition at line 11 of file PDFWeightsAnalyzer.py.

Referenced by gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.declareHandles(), and gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.process().

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFWeights

Definition at line 10 of file PDFWeightsAnalyzer.py.

Referenced by gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.declareHandles(), and gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.process().

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.genInfo

Definition at line 52 of file PDFWeightsAnalyzer.py.

Referenced by gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.makePDFWeights().

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit

Definition at line 13 of file PDFWeightsAnalyzer.py.

Referenced by gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.initPDFWeights(), and gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.makePDFWeights().

list gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.PDFWeights = []
static

Definition at line 66 of file PDFWeightsAnalyzer.py.

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightTool

Definition at line 31 of file PDFWeightsAnalyzer.py.