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