CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
mhtjuProducerCpp.mhtjuProducerCpp Class Reference
Inheritance diagram for mhtjuProducerCpp.mhtjuProducerCpp:

Public Member Functions

def __init__ (self)
 
def analyze (self, event)
 
def beginFile (self, inputFile, outputFile, inputTree, wrappedOutputTree)
 
def beginJob (self)
 
def endFile (self, inputFile, outputFile, inputTree, wrappedOutputTree)
 
def endJob (self)
 
def initReaders (self, tree)
 

Public Attributes

 Jet_phi
 
 Jet_pt
 
 nJet
 
 out
 
 worker
 

Private Attributes

 _ttreereaderversion
 

Detailed Description

Definition at line 13 of file mhtjuProducerCpp.py.

Constructor & Destructor Documentation

◆ __init__()

def mhtjuProducerCpp.mhtjuProducerCpp.__init__ (   self)

Definition at line 14 of file mhtjuProducerCpp.py.

References print().

14  def __init__(self):
15  base = os.getenv("NANOAODTOOLS_BASE")
16  if base:
17  # Running in standalone mode: compile the C++ helper
18  if "/MhtjuProducerCppWorker_cc.so" not in ROOT.gSystem.GetLibraries():
19  print("Load C++ MhtjuProducerCppWorker worker module")
20  ROOT.gROOT.ProcessLine(
21  ".L %s/test/examples/MhtjuProducerCppWorker.cc+O" % base)
22  else:
23  # Load the helper from the CMSSW compiled. This is not required if
24  # dictionaries for the helper are generated with classes_def.xml and
25  # classes.h
26  base = "%s/src/PhysicsTools/NanoAODTools" % os.getenv("CMSSW_BASE")
27  ROOT.gSystem.Load("libPhysicsToolsNanoAODToolsTest.so")
28  ROOT.gROOT.ProcessLine(".L %s/test/examples/MhtjuProducerCppWorker.h" % base)
29  self.worker = ROOT.MhtjuProducerCppWorker()
30  pass
31 
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)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Function Documentation

◆ analyze()

def mhtjuProducerCpp.mhtjuProducerCpp.analyze (   self,
  event 
)
process event, return True (go to next module) or False (fail,
go to next event)

Definition at line 58 of file mhtjuProducerCpp.py.

References mhtjuProducerCpp.mhtjuProducerCpp._ttreereaderversion, mhtjuProducerCpp.mhtjuProducerCpp.initReaders(), exampleModule.exampleProducer.out, mhtjuProducerCpp.mhtjuProducerCpp.out, ProcMultiply.out, PhysicsTools::Calibration::ProcMultiply.out, BeamHaloAnalyzer.out, l1ct::Event.out, and mhtjuProducerCpp.mhtjuProducerCpp.worker.

58  def analyze(self, event):
59  """process event, return True (go to next module) or False (fail,
60  go to next event)"""
61 
62  # do this check at every event, as other modules might have read
63  # further branches
64  if event._tree._ttreereaderversion > self._ttreereaderversion:
65  self.initReaders(event._tree)
66  # do NOT access other branches in python between the check/call to
67  # initReaders and the call to C++ worker code
68  output = self.worker.getHT()
69 
70  self.out.fillBranch("MHTju_pt", output[0])
71  self.out.fillBranch("MHTju_phi", -output[1]) # note the minus
72  return True
73 
74 
75 # define modules using the syntax 'name = lambda : constructor' to avoid
76 # having them loaded when not needed
77 
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override

◆ beginFile()

def mhtjuProducerCpp.mhtjuProducerCpp.beginFile (   self,
  inputFile,
  outputFile,
  inputTree,
  wrappedOutputTree 
)

Definition at line 38 of file mhtjuProducerCpp.py.

38  def beginFile(self, inputFile, outputFile, inputTree, wrappedOutputTree):
39  self.initReaders(inputTree) # initReaders must be called in beginFile
40  self.out = wrappedOutputTree
41  self.out.branch("MHTju_pt", "F")
42  self.out.branch("MHTju_phi", "F")
43 

◆ beginJob()

def mhtjuProducerCpp.mhtjuProducerCpp.beginJob (   self)

Definition at line 32 of file mhtjuProducerCpp.py.

32  def beginJob(self):
33  pass
34 
void beginJob()
Definition: Breakpoints.cc:14

◆ endFile()

def mhtjuProducerCpp.mhtjuProducerCpp.endFile (   self,
  inputFile,
  outputFile,
  inputTree,
  wrappedOutputTree 
)

Definition at line 44 of file mhtjuProducerCpp.py.

44  def endFile(self, inputFile, outputFile, inputTree, wrappedOutputTree):
45  pass
46 

◆ endJob()

def mhtjuProducerCpp.mhtjuProducerCpp.endJob (   self)

Definition at line 35 of file mhtjuProducerCpp.py.

35  def endJob(self):
36  pass
37 

◆ initReaders()

def mhtjuProducerCpp.mhtjuProducerCpp.initReaders (   self,
  tree 
)

Definition at line 49 of file mhtjuProducerCpp.py.

Referenced by mhtjuProducerCpp.mhtjuProducerCpp.analyze().

49  def initReaders(self, tree):
50  self.nJet = tree.valueReader("nJet")
51  self.Jet_pt = tree.arrayReader("Jet_pt")
52  self.Jet_phi = tree.arrayReader("Jet_phi")
53  self.worker.setJets(self.nJet, self.Jet_pt, self.Jet_phi)
54  # self._ttreereaderversion must be set AFTER all calls to
55  # tree.valueReader or tree.arrayReader
56  self._ttreereaderversion = tree._ttreereaderversion
57 

Member Data Documentation

◆ _ttreereaderversion

mhtjuProducerCpp.mhtjuProducerCpp._ttreereaderversion
private

Definition at line 56 of file mhtjuProducerCpp.py.

Referenced by mhtjuProducerCpp.mhtjuProducerCpp.analyze().

◆ Jet_phi

mhtjuProducerCpp.mhtjuProducerCpp.Jet_phi

Definition at line 52 of file mhtjuProducerCpp.py.

◆ Jet_pt

mhtjuProducerCpp.mhtjuProducerCpp.Jet_pt

Definition at line 51 of file mhtjuProducerCpp.py.

◆ nJet

mhtjuProducerCpp.mhtjuProducerCpp.nJet

Definition at line 50 of file mhtjuProducerCpp.py.

◆ out

mhtjuProducerCpp.mhtjuProducerCpp.out

◆ worker

mhtjuProducerCpp.mhtjuProducerCpp.worker

Definition at line 29 of file mhtjuProducerCpp.py.

Referenced by mhtjuProducerCpp.mhtjuProducerCpp.analyze().