File indexing completed on 2024-11-25 02:29:49
0001 import os
0002 import logging
0003
0004 from PhysicsTools.HeppyCore.framework.analyzer import Analyzer as CoreAnalyzer
0005
0006 class Analyzer(CoreAnalyzer):
0007 '''Base Analyzer class. Used in Looper.'''
0008
0009 def declareHandles(self):
0010 self.handles = {}
0011 self.mchandles = {}
0012
0013 def beginLoop(self, setup):
0014 '''Automatically called by Looper, for all analyzers.'''
0015 super(Analyzer, self).beginLoop(setup)
0016 self.declareHandles()
0017
0018
0019 def process(self, event ):
0020 '''Automatically called by Looper, for all analyzers.
0021 each analyzer in the sequence will be passed the same event instance.
0022 each analyzer can access, modify, and store event information, of any type.'''
0023 print(self.cfg_ana.name)
0024 self.readCollections( event.input )
0025
0026 def readCollections(self, iEvent ):
0027 '''You must call this function at the beginning of the process
0028 function of your child analyzer.'''
0029
0030
0031
0032 for str,handle in self.handles.items():
0033 handle.Load( iEvent )
0034 if self.cfg_comp.isMC:
0035 for str,handle in self.mchandles.items():
0036 handle.Load( iEvent )