CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
JetTracksAssociatorAtVertex Class Reference

#include <JetTracksAssociatorAtVertex.h>

Inheritance diagram for JetTracksAssociatorAtVertex:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 JetTracksAssociatorAtVertex (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~JetTracksAssociatorAtVertex ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

JetTracksAssociationDRVertex mAssociator
 
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
 
edm::InputTag mJets
 
int mTrackQuality
 
edm::InputTag mTracks
 
edm::InputTag pvSrc
 if true, use the track/jet association with vertex assignment to tracks More...
 
bool useAssigned
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 20 of file JetTracksAssociatorAtVertex.h.

Constructor & Destructor Documentation

JetTracksAssociatorAtVertex::JetTracksAssociatorAtVertex ( const edm::ParameterSet fConfig)

Definition at line 19 of file JetTracksAssociatorAtVertex.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), pvSrc, and useAssigned.

20  : mJets (fConfig.getParameter<edm::InputTag> ("jets")),
21  mTracks (fConfig.getParameter<edm::InputTag> ("tracks")),
22  mAssociator (fConfig.getParameter<double> ("coneSize")),
23  mAssociatorAssigned (fConfig.getParameter<double> ("coneSize")),
24  useAssigned(false), pvSrc()
25 {
26 
27  if ( fConfig.exists("useAssigned") ) {
28  useAssigned = fConfig.getParameter<bool> ("useAssigned");
29  pvSrc = fConfig.getParameter<edm::InputTag> ("pvSrc");
30  }
31 
32  produces<reco::JetTracksAssociation::Container> ();
33 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::InputTag pvSrc
if true, use the track/jet association with vertex assignment to tracks
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
JetTracksAssociationDRVertex mAssociator
JetTracksAssociatorAtVertex::~JetTracksAssociatorAtVertex ( )
virtual

Definition at line 35 of file JetTracksAssociatorAtVertex.cc.

35 {}

Member Function Documentation

void JetTracksAssociatorAtVertex::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 37 of file JetTracksAssociatorAtVertex.cc.

References reco::JetExtendedAssociation::allJets(), muonTagProbeFilters_cff::allTracks, edm::Event::getByLabel(), i, mAssociator, mAssociatorAssigned, mJets, mTracks, JetTracksAssociationDRVertex::produce(), JetTracksAssociationDRVertexAssigned::produce(), edm::Handle< T >::product(), edm::Event::put(), pvSrc, and useAssigned.

37  {
39  fEvent.getByLabel (mJets, jets_h);
41  fEvent.getByLabel (mTracks, tracks_h);
42 
43  std::auto_ptr<reco::JetTracksAssociation::Container> jetTracks (new reco::JetTracksAssociation::Container (reco::JetRefBaseProd(jets_h)));
44 
45  // format inputs
46  std::vector <edm::RefToBase<reco::Jet> > allJets;
47  allJets.reserve (jets_h->size());
48  for (unsigned i = 0; i < jets_h->size(); ++i) allJets.push_back (jets_h->refAt(i));
49  std::vector <reco::TrackRef> allTracks;
50  allTracks.reserve (tracks_h->size());
51  // run algo
52  for (unsigned i = 0; i < tracks_h->size(); ++i) {
53  allTracks.push_back (reco::TrackRef (tracks_h, i));
54  }
55  if ( !useAssigned ) {
56  mAssociator.produce (&*jetTracks, allJets, allTracks);
57  } else {
59  fEvent.getByLabel(pvSrc,pvHandle);
60  const reco::VertexCollection & vertices = *pvHandle.product();
61  mAssociatorAssigned.produce (&*jetTracks, allJets, allTracks,vertices);
62  }
63 
64 
65  // store output
66  fEvent.put (jetTracks);
67 }
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
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks, const reco::VertexCollection &vertices) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void produce(reco::JetTracksAssociation::Container *fAssociation, const std::vector< edm::RefToBase< reco::Jet > > &fJets, const std::vector< reco::TrackRef > &fTracks) const
edm::InputTag pvSrc
if true, use the track/jet association with vertex assignment to tracks
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
JetTracksAssociationDRVertexAssigned mAssociatorAssigned
JetTracksAssociationDRVertex mAssociator
T const * product() const
Definition: Handle.h:74

Member Data Documentation

JetTracksAssociationDRVertex JetTracksAssociatorAtVertex::mAssociator
private

Definition at line 31 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

JetTracksAssociationDRVertexAssigned JetTracksAssociatorAtVertex::mAssociatorAssigned
private

Definition at line 32 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

edm::InputTag JetTracksAssociatorAtVertex::mJets
private

Definition at line 28 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

int JetTracksAssociatorAtVertex::mTrackQuality
private

Definition at line 30 of file JetTracksAssociatorAtVertex.h.

edm::InputTag JetTracksAssociatorAtVertex::mTracks
private

Definition at line 29 of file JetTracksAssociatorAtVertex.h.

Referenced by produce().

edm::InputTag JetTracksAssociatorAtVertex::pvSrc
private

if true, use the track/jet association with vertex assignment to tracks

Definition at line 34 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().

bool JetTracksAssociatorAtVertex::useAssigned
private

Definition at line 33 of file JetTracksAssociatorAtVertex.h.

Referenced by JetTracksAssociatorAtVertex(), and produce().