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

 doPDFWeights
 
 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  if self.doPDFWeights:
self.pdfWeightInit = False

Member Function Documentation

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

Definition at line 24 of file PDFWeightsAnalyzer.py.

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

Definition at line 18 of file PDFWeightsAnalyzer.py.

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

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

Definition at line 27 of file PDFWeightsAnalyzer.py.

References gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit.

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

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

Definition at line 35 of file PDFWeightsAnalyzer.py.

References gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.initPDFWeights(), core.Analyzer.Analyzer.mchandles, and gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit.

Referenced by gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.process().

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

Definition at line 43 of file PDFWeightsAnalyzer.py.

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

Referenced by ConfigBuilder.ConfigBuilder.__init__(), ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.anyOf(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), ConfigBuilder.ConfigBuilder.prepare(), ConfigBuilder.ConfigBuilder.prepare_ALCA(), ConfigBuilder.ConfigBuilder.prepare_DQM(), ConfigBuilder.ConfigBuilder.prepare_FASTSIM(), ConfigBuilder.ConfigBuilder.prepare_HARVESTING(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder.scheduleSequence().

43 
44  def process(self, event):
45  self.readCollections( event.input )
46 
47  # if not MC, nothing to do
48  if not self.cfg_comp.isMC:
49  return True
50 
51  if self.doPDFWeights:
52  self.makePDFWeights(event)
53  return True
54 
setattr(PDFWeightsAnalyzer,"defaultConfig",

Member Data Documentation

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

Definition at line 12 of file PDFWeightsAnalyzer.py.

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

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

Definition at line 56 of file PDFWeightsAnalyzer.py.

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightTool

Definition at line 30 of file PDFWeightsAnalyzer.py.