CMS 3D CMS Logo

List of all members | Public Member Functions
SimpleJetAnalyzer.SimpleJetAnalyzer Class Reference
Inheritance diagram for SimpleJetAnalyzer.SimpleJetAnalyzer:

Public Member Functions

def declareHandles (self)
 
def process (self, event)
 

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.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, and core.Analyzer.Analyzer.mchandles.

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

Definition at line 26 of file SimpleJetAnalyzer.py.

References core.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, analyzer.Analyzer.instance_label, config.Analyzer.instance_label, config.Service.instance_label, join(), genParticles_cff.map, 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(), 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().

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