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
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
self.
handles
.
items
():
34
handle.Load( iEvent )
35
if
self.cfg_comp.isMC:
36
for
str,handle
in
self.
mchandles
.
items
():
37
handle.Load( iEvent )
mps_monitormerge.items
list items
Definition:
mps_monitormerge.py:29
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition:
Utilities.cc:46
core.Analyzer.Analyzer.declareHandles
def declareHandles(self)
Definition:
Analyzer.py:10
core.Analyzer.Analyzer.process
def process(self, event)
Definition:
Analyzer.py:20
core.Analyzer.Analyzer.beginLoop
def beginLoop(self, setup)
Definition:
Analyzer.py:14
core.Analyzer.Analyzer
Definition:
Analyzer.py:7
core.Analyzer.Analyzer.handles
handles
Definition:
Analyzer.py:11
core.Analyzer.Analyzer.readCollections
def readCollections(self, iEvent)
Definition:
Analyzer.py:27
core.Analyzer.Analyzer.mchandles
mchandles
Definition:
Analyzer.py:12
Generated for CMSSW Reference Manual by
1.8.16