1 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
2 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
3 from PhysicsTools.Heppy.physicsobjects.Jet
import Jet, GenJet
7 '''Just a simple jet analyzer, to be used in tutorials.
14 filter_func = lambda x : x.pt()>30 # filtering function for the jets
15 njets = 4, # keeping the first 4 leading jets passing cuts
21 self.handles[
'jets'] = AutoHandle(
'slimmedJets',
22 'std::vector<pat::Jet>' )
23 self.mchandles[
'genjets'] = AutoHandle(
'slimmedGenJets',
24 'std::vector<reco::GenJet>')
27 super(SimpleJetAnalyzer, self).readCollections(event.input)
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]
33 if self.cfg_comp.isMC:
34 genjets = map(GenJet, self.mchandles[
'genjets'].product())
37 jet.gen = matches[jet]
39 setattr(event, self.instance_label, jets)
40 setattr(event,
'_'.
join([self.instance_label,
'gen']), genjets)
def matchObjectCollection
static std::string join(char **cmd)