CMS 3D CMS Logo

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

Public Member Functions

def declareHandles
 
def process
 

Detailed Description

Just a simple jet analyzer, to be used in tutorials.

example configuration:

jets = cfg.Analyzer(
   SimpleJetAnalyzer,
   'jets',
   filter_func = lambda x : x.pt()>30 # filtering function for the jets
   njets = 4, # keeping the first 4 leading jets passing cuts 
)

Definition at line 6 of file SimpleJetAnalyzer.py.

Member Function Documentation

def SimpleJetAnalyzer.SimpleJetAnalyzer.declareHandles (   self)

Definition at line 19 of file SimpleJetAnalyzer.py.

References core.AutoHandle.AutoHandle.handles, core.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, and core.Analyzer.Analyzer.mchandles.

19 
20  def declareHandles(self):
21  super(SimpleJetAnalyzer, self).declareHandles()
22  self.handles['jets'] = AutoHandle( 'slimmedJets',
23  'std::vector<pat::Jet>' )
24  self.mchandles['genjets'] = AutoHandle( 'slimmedGenJets',
25  'std::vector<reco::GenJet>')
def SimpleJetAnalyzer.SimpleJetAnalyzer.process (   self,
  event 
)

Definition at line 26 of file SimpleJetAnalyzer.py.

References core.AutoHandle.AutoHandle.handles, core.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, analyzer.Analyzer.instance_label, config.Analyzer.instance_label, config.Service.instance_label, join(), deltar.matchObjectCollection(), and core.Analyzer.Analyzer.mchandles.

Referenced by ConfigBuilder.ConfigBuilder.addExtraStream(), ConfigBuilder.ConfigBuilder.completeInputCommand(), ConfigBuilder.ConfigBuilder.doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules.leave(), 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().

26 
27  def process(self, event):
28  super(SimpleJetAnalyzer, self).readCollections(event.input)
29  # creating Jet python objects wrapping the EDM jets
30  jets = map(Jet, self.handles['jets'].product())
31  jets = [ jet for jet in jets if self.cfg_ana.filter_func(jet)]
32  jets = jets[:self.cfg_ana.njets]
33 
34  if self.cfg_comp.isMC:
35  genjets = map(GenJet, self.mchandles['genjets'].product())
36  matches = matchObjectCollection(jets, genjets, 0.2)
37  for jet in jets:
38  jet.gen = matches[jet]
39 
40  setattr(event, self.instance_label, jets)
41  setattr(event, '_'.join([self.instance_label, 'gen']), genjets)
def matchObjectCollection
Definition: deltar.py:152
static std::string join(char **cmd)
Definition: RemoteFile.cc:18