CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetTracksAssociatorExplicit.cc
Go to the documentation of this file.
1 // \class JetTracksAssociatorExplicit JetTracksAssociatorExplicit.cc
2 //
3 // Original Author: Andrea Rizzi
4 // Created: Wed Apr 12 11:12:49 CEST 2006
5 // Accommodated for Jet Package by: Fedor Ratnikov Jul. 30, 2007
6 // $Id: JetTracksAssociatorExplicit.cc,v 1.1 2012/01/13 21:11:04 srappocc Exp $
7 //
9 
10 // user include files
16 
18 
20  : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
21  mTracks (fConfig.getParameter<edm::InputTag> ("tracks")),
22  mAssociatorExplicit ()
23 {
24 
25  produces<reco::JetTracksAssociation::Container> ();
26 }
27 
29 
32  fEvent.getByLabel (mJets, jets_h);
34  fEvent.getByLabel (mTracks, tracks_h);
35 
36  std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));
37 
38  // format inputs
39  std::vector <edm::RefToBase<reco::Jet> > allJets;
40  allJets.reserve (jets_h->size());
41  for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
42  std::vector <reco::TrackRef> allTracks;
43  allTracks.reserve (tracks_h->size());
44  // run algo
45  for (unsigned i = 0; i < tracks_h->size(); ++i) {
46  allTracks.push_back (reco::TrackRef (tracks_h, i));
47  }
48 
49 
50  mAssociatorExplicit.produce (&*jetTracks, allJets, allTracks);
51 
52 
53  // store output
54  fEvent.put (jetTracks);
55 }
std::vector< reco::JetBaseRef > allJets(const Container &)
fill list of all jets associated with values. Return # of jets in the list
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks) const
JetTracksAssociatorExplicit(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
JetTracksAssociationExplicit mAssociatorExplicit
virtual void produce(edm::Event &, const edm::EventSetup &)