CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BoostedJetMerger.cc
Go to the documentation of this file.
2 
3 
5  jetLabel_(iConfig.getParameter<edm::InputTag>("jetSrc")),
6  subjetLabel_(iConfig.getParameter<edm::InputTag>("subjetSrc"))
7 {
8  //register products
9  produces<std::vector<pat::Jet> > ();
10 }
11 
12 
14 {
15 }
16 
17 
18 // ------------ method called to produce the data ------------
19 void
21 {
22 
23  std::auto_ptr< std::vector<pat::Jet> > outputs( new std::vector<pat::Jet> );
24 
26  edm::Handle< edm::View<pat::Jet> > subjetHandle;
27 
28  iEvent.getByLabel( jetLabel_, jetHandle );
29  iEvent.getByLabel( subjetLabel_, subjetHandle );
30 
31  for ( edm::View<pat::Jet>::const_iterator ijetBegin = jetHandle->begin(),
32  ijetEnd = jetHandle->end(), ijet = ijetBegin; ijet != ijetEnd; ++ijet ) {
33 
34  outputs->push_back( *ijet );
35  std::vector< edm::Ptr<reco::Candidate> > nextSubjets;
36 
37  for ( unsigned int isubjet = 0; isubjet < ijet->numberOfDaughters(); ++isubjet ) {
38  edm::Ptr<reco::Candidate> const & subjet = ijet->daughterPtr(isubjet);
39  edm::View<pat::Jet>::const_iterator ifound = find_if( subjetHandle->begin(),
40  subjetHandle->end(),
41  FindCorrectedSubjet(subjet) );
42  if ( ifound != subjetHandle->end() ) {
43  nextSubjets.push_back( subjetHandle->ptrAt( ifound - subjetHandle->begin() ) );
44 
45  }
46  }
47  outputs->back().clearDaughters();
48  for ( std::vector< edm::Ptr<reco::Candidate> >::const_iterator nextSubjet = nextSubjets.begin(),
49  nextSubjetEnd = nextSubjets.end(); nextSubjet != nextSubjetEnd; ++nextSubjet ) {
50  outputs->back().addDaughter( *nextSubjet );
51  }
52 
53 
54  }
55 
56  iEvent.put(outputs);
57 
58 }
59 
60 // ------------ method called once each job just before starting event loop ------------
61 void
63 {
64 }
65 
66 // ------------ method called once each job just after ending the event loop ------------
67 void
69 }
70 
71 //define this as a plug-in
virtual void endJob()
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginJob()
Definition: EDProducer.h:65
int iEvent
Definition: GenABIO.cc:243
BoostedJetMerger(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag jetLabel_
edm::InputTag subjetLabel_