PhysicsTools
Heppy
python
analyzers
core
Analyzer.py
Go to the documentation of this file.
1
from
__future__
import
print_function
2
import
os
3
import
logging
4
5
from
PhysicsTools.HeppyCore.framework.analyzer
import
Analyzer
as
CoreAnalyzer
6
import
six
7
8
class
Analyzer
(CoreAnalyzer):
9
'''Base Analyzer class. Used in Looper.'''
10
11
def
declareHandles
(self):
12
self.
handles
= {}
13
self.
mchandles
= {}
14
15
def
beginLoop
(self, setup):
16
'''Automatically called by Looper, for all analyzers.'''
17
super(Analyzer, self).
beginLoop
(setup)
18
self.
declareHandles
()
19
20
21
def
process
(self, event ):
22
'''Automatically called by Looper, for all analyzers.
23
each analyzer in the sequence will be passed the same event instance.
24
each analyzer can access, modify, and store event information, of any type.'''
25
print
(self.cfg_ana.name)
26
self.
readCollections
( event.input )
27
28
def
readCollections
(self, iEvent ):
29
'''You must call this function at the beginning of the process
30
function of your child analyzer.'''
31
# if not self.beginLoopCalled:
32
# # necessary in case the user calls process to go straight to a given event, before looping
33
# self.beginLoop(setup)
34
for
str,handle
in
six.iteritems(self.
handles
):
35
handle.Load( iEvent )
36
if
self.cfg_comp.isMC:
37
for
str,handle
in
six.iteritems(self.
mchandles
):
38
handle.Load( iEvent )
core.Analyzer.Analyzer.declareHandles
def declareHandles(self)
Definition:
Analyzer.py:11
core.Analyzer.Analyzer.process
def process(self, event)
Definition:
Analyzer.py:21
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition:
JobReport.cc:66
core.Analyzer.Analyzer.beginLoop
def beginLoop(self, setup)
Definition:
Analyzer.py:15
core.Analyzer.Analyzer
Definition:
Analyzer.py:8
core.Analyzer.Analyzer.handles
handles
Definition:
Analyzer.py:12
core.Analyzer.Analyzer.readCollections
def readCollections(self, iEvent)
Definition:
Analyzer.py:28
core.Analyzer.Analyzer.mchandles
mchandles
Definition:
Analyzer.py:13
Generated for CMSSW Reference Manual by
1.8.16