CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
analyzer.Analyzer Class Reference
Inheritance diagram for analyzer.Analyzer:

Public Member Functions

def __init__ (self, cfg_ana, cfg_comp, looperName)
 
def __str__ (self)
 
def beginLoop (self, setup)
 
def endLoop (self, setup)
 
def process (self, event)
 
def write (self, setup)
 

Public Attributes

 averages
 
 cfg_ana
 
 cfg_comp
 
 class_object
 
 counters
 
 instance_label
 
 looperName
 
 name
 
 verbose
 

Static Public Attributes

 beginLoopCalled
 
 dirName
 
 mainLogger
 

Detailed Description

Base Analyzer class. Used in Looper.

Your custom analyzers should inherit from this class

Definition at line 10 of file analyzer.py.

Constructor & Destructor Documentation

def analyzer.Analyzer.__init__ (   self,
  cfg_ana,
  cfg_comp,
  looperName 
)
Create an analyzer.

Parameters (also stored as attributes for later use):
cfg_ana: configuration parameters for this analyzer (e.g. a pt cut)
cfg_comp: configuration parameters for the data or MC component (e.g. DYJets)
looperName: name of the Looper which runs this analyzer.

Attributes:
dirName : analyzer directory, where you can write anything you want

Definition at line 16 of file analyzer.py.

16  def __init__(self, cfg_ana, cfg_comp, looperName ):
17  """Create an analyzer.
18 
19  Parameters (also stored as attributes for later use):
20  cfg_ana: configuration parameters for this analyzer (e.g. a pt cut)
21  cfg_comp: configuration parameters for the data or MC component (e.g. DYJets)
22  looperName: name of the Looper which runs this analyzer.
23 
24  Attributes:
25  dirName : analyzer directory, where you can write anything you want
26  """
27  self.class_object = cfg_ana.class_object
28  self.instance_label = cfg_ana.instance_label
29  self.name = cfg_ana.name
30  self.verbose = cfg_ana.verbose
31  self.cfg_ana = cfg_ana
32  self.cfg_comp = cfg_comp
33  self.looperName = looperName
def __init__(self, cfg_ana, cfg_comp, looperName)
Definition: analyzer.py:16

Member Function Documentation

def analyzer.Analyzer.__str__ (   self)
A multipurpose printout. Should do the job for most analyzers.

Definition at line 74 of file analyzer.py.

References analyzer.Analyzer.averages, analyzer.Analyzer.cfg_ana, join(), genParticles_cff.map, and str.

74  def __str__(self):
75  """A multipurpose printout. Should do the job for most analyzers."""
76  ana = str( self.cfg_ana )
77  count = ''
78  ave = ''
79  if hasattr(self, 'counters') and len( self.counters.counters ) > 0:
80  count = '\n'.join(map(str, self.counters.counters))
81  if hasattr(self, 'averages') and len( self.averages ) > 0:
82  ave = '\n'.join(map(str, self.averages))
83  return '\n'.join( [ana, count, ave] )
84 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
#define str(s)
def __str__(self)
Definition: analyzer.py:74
def analyzer.Analyzer.beginLoop (   self,
  setup 
)
Automatically called by Looper, for all analyzers.

Definition at line 47 of file analyzer.py.

47  def beginLoop(self, setup):
48  """Automatically called by Looper, for all analyzers."""
49  self.counters = Counters()
50  self.averages = Averages()
51  self.mainLogger.info( 'beginLoop ' + self.cfg_ana.name )
52  self.beginLoopCalled = True
53 
def beginLoop(self, setup)
Definition: analyzer.py:47
def analyzer.Analyzer.endLoop (   self,
  setup 
)
Automatically called by Looper, for all analyzers.

Definition at line 54 of file analyzer.py.

References str.

54  def endLoop(self, setup):
55  """Automatically called by Looper, for all analyzers."""
56  #print self.cfg_ana
57  self.mainLogger.info( '' )
58  self.mainLogger.info( str(self) )
59  self.mainLogger.info( '' )
60 
def endLoop(self, setup)
Definition: analyzer.py:54
#define str(s)
def analyzer.Analyzer.process (   self,
  event 
)
Automatically called by Looper, for all analyzers.
each analyzer in the sequence will be passed the same event instance.
each analyzer can access, modify, and store event information, of any type.

Definition at line 61 of file analyzer.py.

Referenced by ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), ConfigBuilder.ConfigBuilder.prepare(), ConfigBuilder.ConfigBuilder.prepare_ALCA(), ConfigBuilder.ConfigBuilder.prepare_DQM(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_PATFILTER(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder.scheduleSequence().

61  def process(self, event ):
62  """Automatically called by Looper, for all analyzers.
63  each analyzer in the sequence will be passed the same event instance.
64  each analyzer can access, modify, and store event information, of any type."""
65  print self.cfg_ana.name
66 
67 
def process(self, event)
Definition: analyzer.py:61
def analyzer.Analyzer.write (   self,
  setup 
)
Called by Looper.write, for all analyzers.
Just overload it if you have histograms to write.

Definition at line 68 of file analyzer.py.

References analyzer.Analyzer.dirName, and MuonIsolationDQM.dirName.

68  def write(self, setup):
69  """Called by Looper.write, for all analyzers.
70  Just overload it if you have histograms to write."""
71  self.counters.write( self.dirName )
72  self.averages.write( self.dirName )
73 
def write(self, setup)
Definition: analyzer.py:68

Member Data Documentation

analyzer.Analyzer.beginLoopCalled
static

Definition at line 45 of file analyzer.py.

analyzer.Analyzer.class_object

Definition at line 27 of file analyzer.py.

analyzer.Analyzer.counters
analyzer.Analyzer.dirName
static
analyzer.Analyzer.looperName

Definition at line 33 of file analyzer.py.

analyzer.Analyzer.mainLogger
static

Definition at line 43 of file analyzer.py.