1 from __future__
import print_function
8 from PhysicsTools.HeppyCore.statistics.counter
import Counters
9 from PhysicsTools.HeppyCore.statistics.average
import Averages
12 """Base Analyzer class. Used in Looper. 14 Your custom analyzers should inherit from this class 17 def __init__(self, cfg_ana, cfg_comp, looperName ):
18 """Create an analyzer. 20 Parameters (also stored as attributes for later use): 21 cfg_ana: configuration parameters for this analyzer (e.g. a pt cut) 22 cfg_comp: configuration parameters for the data or MC component (e.g. DYJets) 23 looperName: name of the Looper which runs this analyzer. 26 dirName : analyzer directory, where you can write anything you want 35 if hasattr(cfg_ana,
"nosubdir")
and cfg_ana.nosubdir:
49 """Automatically called by Looper, for all analyzers.""" 56 """Automatically called by Looper, for all analyzers.""" 63 """Automatically called by Looper, for all analyzers. 64 each analyzer in the sequence will be passed the same event instance. 65 each analyzer can access, modify, and store event information, of any type.""" 70 """Called by Looper.write, for all analyzers. 71 Just overload it if you have histograms to write.""" 76 """A multipurpose printout. Should do the job for most analyzers.""" 80 if hasattr(self,
'counters')
and len( self.
counters.counters ) > 0:
82 if hasattr(self,
'averages')
and len( self.
averages ) > 0:
84 return '\n'.
join( [ana, count, ave] )
def beginLoop(self, setup)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)
def __init__(self, cfg_ana, cfg_comp, looperName)