CMS 3D CMS Logo

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__ (self, cfg_ana, cfg_comp, looperName)
 
def beginLoop (self, setup)
 
def declareHandles (self)
 
def initPDFWeights (self)
 
def makePDFWeights (self, event)
 
def process (self, event)
 

Public Attributes

 doPDFVars
 
 doPDFWeights
 
 genInfo
 
 pdfWeightInit
 
 pdfWeightTool
 

Static Public Attributes

 PDFWeights
 

Detailed Description

 

Definition at line 6 of file PDFWeightsAnalyzer.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 8 of file PDFWeightsAnalyzer.py.

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
11  self.doPDFVars = hasattr(self.cfg_ana, "doPDFVars") and self.cfg_ana.doPDFVars == True
12  if self.doPDFWeights:
13  self.pdfWeightInit = False
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ beginLoop()

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

Definition at line 25 of file PDFWeightsAnalyzer.py.

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

◆ declareHandles()

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  def declareHandles(self):
20  super(PDFWeightsAnalyzer, self).declareHandles()
21 
22  if self.doPDFVars or self.doPDFWeights:
23  self.mchandles['pdfstuff'] = AutoHandle( 'generator', 'GenEventInfoProduct' )
24 

◆ initPDFWeights()

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  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()
35 
void beginJob()
Definition: Breakpoints.cc:14

◆ makePDFWeights()

def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.makePDFWeights (   self,
  event 
)

Definition at line 36 of file PDFWeightsAnalyzer.py.

References analyzer.Analyzer.cfg_ana, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.genInfo, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.initPDFWeights(), gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightTool, and processEvent().

36  def makePDFWeights(self, event):
37  if not self.pdfWeightInit: self.initPDFWeights()
38  self.pdfWeightTool.processEvent(self.genInfo)
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]
43 
dispatcher processEvent(e, inputTag, standby)

◆ process()

def gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.process (   self,
  event 
)

Definition at line 44 of file PDFWeightsAnalyzer.py.

References analyzer.Analyzer.cfg_comp, looper.Looper.cfg_comp, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFVars, gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFWeights, and core.Analyzer.Analyzer.readCollections().

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.doPDFVars or self.doPDFWeights:
52  self.genInfo = self.mchandles['pdfstuff'].product()
53  if self.doPDFWeights:
54  self.makePDFWeights(event)
55  if self.doPDFVars:
56  event.pdf_x1 = self.genInfo.pdf().x.first
57  event.pdf_x2 = self.genInfo.pdf().x.second
58  event.pdf_id1 = self.genInfo.pdf().id.first
59  event.pdf_id2 = self.genInfo.pdf().id.second
60  event.pdf_scale = self.genInfo.pdf().scalePDF
61 
62  return True
63 
64 setattr(PDFWeightsAnalyzer,"defaultConfig",

Member Data Documentation

◆ doPDFVars

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFVars

◆ doPDFWeights

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.doPDFWeights

◆ genInfo

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.genInfo

◆ pdfWeightInit

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightInit

◆ PDFWeights

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.PDFWeights
static

Definition at line 66 of file PDFWeightsAnalyzer.py.

◆ pdfWeightTool

gen.PDFWeightsAnalyzer.PDFWeightsAnalyzer.pdfWeightTool