CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PATGenJetSlimmer.cc
Go to the documentation of this file.
1 //
2 // $Id: PATGenJetSlimmer.cc,v 1.1 2011/03/24 18:45:45 mwlebour Exp $
3 //
4 
18 
20 
21 namespace pat {
22 
24  public:
25  explicit PATGenJetSlimmer(const edm::ParameterSet & iConfig);
26  virtual ~PATGenJetSlimmer() { }
27 
28  virtual void produce(edm::Event & iEvent, const edm::EventSetup & iSetup);
29 
30  private:
33 
38  };
39 
40 } // namespace
41 
43  src_(consumes<edm::View<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("src"))),
44  cut_(iConfig.getParameter<std::string>("cut")),
45  clearDaughters_(iConfig.getParameter<bool>("clearDaughters")),
46  dropSpecific_(iConfig.getParameter<bool>("dropSpecific"))
47 {
48  produces<std::vector<reco::GenJet> >();
49 }
50 
51 void
53  using namespace edm;
54  using namespace std;
55 
57  iEvent.getByToken(src_, src);
58 
59  auto_ptr<vector<reco::GenJet> > out(new vector<reco::GenJet>());
60  out->reserve(src->size());
61 
62  for (View<reco::GenJet>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
63  if (!cut_(*it)) continue;
64 
65  out->push_back(*it);
66  reco::GenJet & jet = out->back();
67 
68  if (clearDaughters_) {
69  jet.clearDaughters();
70  }
71  if (dropSpecific_) {
73  }
74  }
75 
76  iEvent.put(out);
77 }
78 
80 using namespace pat;
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
StringCutObjectSelector< reco::GenJet > cut_
bool clearDaughters_
reset daughters to an empty vector
bool dropSpecific_
drop the specific
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
Matcher of reconstructed objects to L1 Muons.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
Jets made from MC generator particles.
Definition: GenJet.h:24
tuple out
Definition: dbtoconf.py:99
edm::EDGetTokenT< edm::View< reco::GenJet > > src_
void clearDaughters()
clear daughter references
void setSpecific(const Specific &spec)
set the specific (note: responsibility of keeping it consistent with the jet daughers belongs to the ...
Definition: GenJet.h:80
PATGenJetSlimmer(const edm::ParameterSet &iConfig)