Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
6
class
Analyzer
(CoreAnalyzer):
7
'''Base Analyzer class. Used in Looper.'''
8
9
def
declareHandles
(self):
10
self.
handles
= {}
11
self.
mchandles
= {}
12
13
def
beginLoop
(self, setup):
14
'''Automatically called by Looper, for all analyzers.'''
15
super(Analyzer, self).
beginLoop
(setup)
16
self.
declareHandles
()
17
18
19
def
process
(self, event ):
20
'''Automatically called by Looper, for all analyzers.
21
each analyzer in the sequence will be passed the same event instance.
22
each analyzer can access, modify, and store event information, of any type.'''
23
print
self.cfg_ana.name
24
self.
readCollections
( event.input )
25
26
def
readCollections
(self, iEvent ):
27
'''You must call this function at the beginning of the process
28
function of your child analyzer.'''
29
# if not self.beginLoopCalled:
30
# # necessary in case the user calls process to go straight to a given event, before looping
31
# self.beginLoop(setup)
32
for
str,handle
in
self.handles.iteritems():
33
handle.Load( iEvent )
34
if
self.cfg_comp.isMC:
35
for
str,handle
in
self.mchandles.iteritems():
36
handle.Load( iEvent )
core.Analyzer.Analyzer
Definition:
Analyzer.py:6
core.Analyzer.Analyzer.mchandles
mchandles
Definition:
Analyzer.py:11
core.Analyzer.Analyzer.process
def process
Definition:
Analyzer.py:19
core.Analyzer.Analyzer.handles
handles
Definition:
Analyzer.py:10
core.Analyzer.Analyzer.readCollections
def readCollections
Definition:
Analyzer.py:26
core.Analyzer.Analyzer.beginLoop
def beginLoop
Definition:
Analyzer.py:13
core.Analyzer.Analyzer.declareHandles
def declareHandles
Definition:
Analyzer.py:9
Generated for CMSSW Reference Manual by
1.8.5