CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
analyzer.Analyzer Class Reference
Inheritance diagram for analyzer.Analyzer:

Public Member Functions

def __init__
 
def __str__
 
def beginLoop
 
def endLoop
 
def process
 
def write
 

Public Attributes

 averages
 
 beginLoopCalled
 
 cfg_ana
 
 cfg_comp
 
 class_object
 
 counters
 
 instance_label
 
 looperName
 
 name
 
 verbose
 

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 
17  def __init__(self, cfg_ana, cfg_comp, looperName ):
18  """Create an analyzer.
19 
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.
24 
25  Attributes:
26  dirName : analyzer directory, where you can write anything you want
27  """
28  self.class_object = cfg_ana.class_object
29  self.instance_label = cfg_ana.instance_label
30  self.name = cfg_ana.name
31  self.verbose = cfg_ana.verbose
32  self.cfg_ana = cfg_ana
33  self.cfg_comp = cfg_comp
self.looperName = looperName

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(), and python.multivaluedict.map().

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

Definition at line 47 of file analyzer.py.

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

Definition at line 54 of file analyzer.py.

54 
55  def endLoop(self, setup):
56  """Automatically called by Looper, for all analyzers."""
57  #print self.cfg_ana
58  self.mainLogger.info( '' )
59  self.mainLogger.info( str(self) )
60  self.mainLogger.info( '' )
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.__init__(), ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.anyOf(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), ConfigBuilder.ConfigBuilder.prepare(), ConfigBuilder.ConfigBuilder.prepare_ALCA(), ConfigBuilder.ConfigBuilder.prepare_DQM(), ConfigBuilder.ConfigBuilder.prepare_FASTSIM(), ConfigBuilder.ConfigBuilder.prepare_HARVESTING(), ConfigBuilder.ConfigBuilder.prepare_HLT(), ConfigBuilder.ConfigBuilder.prepare_LHE(), ConfigBuilder.ConfigBuilder.prepare_VALIDATION(), ConfigBuilder.ConfigBuilder.renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder.renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder.scheduleSequence().

61 
62  def process(self, event ):
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."""
66  print self.cfg_ana.name
67 
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 addOnTests.testit.dirName, MuonIsolationDQM.dirName, MuIsoValidation.dirName, VariablePlotter::SubDirectory.dirName, V0Validator.dirName, and VariablePlotter::Directory.dirName.

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

Member Data Documentation

analyzer.Analyzer.averages

Definition at line 50 of file analyzer.py.

Referenced by analyzer.Analyzer.__str__(), objects.VertexAnalyzer.VertexAnalyzer.process(), and core.PileUpAnalyzer.PileUpAnalyzer.process().

analyzer.Analyzer.beginLoopCalled

Definition at line 52 of file analyzer.py.

analyzer.Analyzer.cfg_ana

Definition at line 31 of file analyzer.py.

Referenced by analyzer.Analyzer.__str__(), DiLeptonAnalyzer.DiLeptonAnalyzer.beginLoop(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareCoreVariables(), core.AutoFillTreeProducer.AutoFillTreeProducer.declareVariables(), gen.GeneratorAnalyzer.GeneratorAnalyzer.makeMCInfo(), objects.TauAnalyzer.TauAnalyzer.makeTaus(), JetAnalyzer.JetAnalyzer.process(), objects.VertexAnalyzer.VertexAnalyzer.process(), core.AutoFillTreeProducer.AutoFillTreeProducer.process(), DiLeptonAnalyzer.DiLeptonAnalyzer.selectionSequence(), DiLeptonAnalyzer.DiLeptonAnalyzer.shiftEnergyScale(), and DiLeptonAnalyzer.DiLeptonAnalyzer.trigMatched().

analyzer.Analyzer.cfg_comp

Definition at line 32 of file analyzer.py.

Referenced by looper.Looper._build(), core.AutoFillTreeProducer.AutoFillTreeProducer.fillCoreVariables(), looper.Looper.loop(), and JetAnalyzer.JetAnalyzer.process().

analyzer.Analyzer.class_object

Definition at line 27 of file analyzer.py.

analyzer.Analyzer.counters

Definition at line 49 of file analyzer.py.

Referenced by counter.Counters.__str__(), counter.Counters.addCounter(), counter.Counters.counter(), and counter.Counters.write().

analyzer.Analyzer.instance_label

Definition at line 28 of file analyzer.py.

Referenced by config.Analyzer.build_name(), and config.Service.build_name().

analyzer.Analyzer.looperName

Definition at line 33 of file analyzer.py.

analyzer.Analyzer.name

Definition at line 29 of file analyzer.py.

Referenced by dirstructure.Directory.__create_pie_image(), dqm_interfaces.DirID.__eq__(), dirstructure.Directory.__get_full_path(), dirstructure.Comparison.__get_img_name(), dataset.Dataset.__getDataType(), dataset.Dataset.__getFileInfoList(), cuy.divideElement.__init__(), cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), dirstructure.Comparison.__make_image(), dirstructure.Directory.__repr__(), dqm_interfaces.DirID.__repr__(), dirstructure.Comparison.__repr__(), config.CFG.__str__(), counter.Counter.__str__(), average.Average.__str__(), dirstructure.Directory.calcStats(), python.rootplot.utilities.Hist.divide(), python.rootplot.utilities.Hist.divide_wilson(), utils.StatisticalTest.get_status(), dirstructure.Directory.print_report(), python.rootplot.utilities.Hist.TGraph(), python.rootplot.utilities.Hist.TH1F(), Vispa.Views.PropertyView.Property.valueChanged(), counter.Counter.write(), and average.Average.write().

analyzer.Analyzer.verbose

Definition at line 30 of file analyzer.py.

Referenced by python.diff_provenance.difference.list_diff(), python.diffProv.difference.list_diff(), python.diff_provenance.difference.module_diff(), python.diffProv.difference.module_diff(), python.diff_provenance.difference.onefilemodules(), and python.diffProv.difference.onefilemodules().