1 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
2 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
8 def __init__(self, cfg_ana, cfg_comp, looperName ):
9 super(PDFWeightsAnalyzer,self).
__init__(cfg_ana,cfg_comp,looperName)
10 self.
doPDFWeights = hasattr(self.cfg_ana,
"PDFWeights")
and len(self.cfg_ana.PDFWeights) > 0
22 self.mchandles[
'pdfstuff'] = AutoHandle(
'generator',
'GenEventInfoProduct' )
25 super(PDFWeightsAnalyzer,self).
beginLoop(setup)
28 from ROOT
import PdfWeightProducerTool
31 for pdf
in self.cfg_ana.PDFWeights:
32 self.pdfWeightTool.addPdfSet(pdf+
".LHgrid")
33 self.pdfWeightTool.beginJob()
37 self.pdfWeightTool.processEvent(self.mchandles[
'pdfstuff'].product())
39 for pdf
in self.cfg_ana.PDFWeights:
40 ws = self.pdfWeightTool.getWeights(pdf+
".LHgrid")
41 event.pdfWeights[pdf] = [w
for w
in ws]
44 self.readCollections( event.input )
47 if not self.cfg_comp.isMC:
54 setattr(PDFWeightsAnalyzer,
"defaultConfig",
55 cfg.Analyzer(PDFWeightsAnalyzer,